Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By eRaaaa

Thread: Multi-Threading

  1. #1
    TonyDaniels is offline Member
    Join Date
    Mar 2012
    Posts
    9
    Rep Power
    0

    Default Multi-Threading

    Hello guys,

    I am using multiple threads to simulate a banking transaction process. The getTotalBalance() method should always output exactly 100000.0, however it is not doing that.

    What am I doing wrong
    Last edited by TonyDaniels; 03-09-2012 at 10:56 PM. Reason: code tags added

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default Re: Multi-Threading

    That is not a multi threading issue :D
    System.out.println(0.3+0.3+0.3);
    Why Floating-Point Numbers May Lose Precision
    Fubarable likes this.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Multi-Threading

    Unformatted code replaced with formatted code from your other double post, code tags added, and double post locked. Please read private message sent you.

  4. #4
    TonyDaniels is offline Member
    Join Date
    Mar 2012
    Posts
    9
    Rep Power
    0

    Default Re: Multi-Threading

    Quote Originally Posted by eRaaaa View Post
    That is not a multi threading issue :D
    System.out.println(0.3+0.3+0.3);
    Why Floating-Point Numbers May Lose Precision

    Sorry about the double posting guys!

    Could you please give me an idea of how I can cast/convert the amounts so that it does not loose precision ?

  5. #5
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

Similar Threads

  1. Multi-threading programing .
    By yifat60 in forum New To Java
    Replies: 1
    Last Post: 11-27-2011, 05:34 PM
  2. Multi-threading issue
    By StevenTNorris in forum Advanced Java
    Replies: 2
    Last Post: 10-19-2011, 10:08 PM
  3. multi-threading problem
    By imorio in forum New To Java
    Replies: 1
    Last Post: 04-25-2011, 07:52 PM
  4. Need Help! Multi-Threading question!
    By pinkette in forum New To Java
    Replies: 8
    Last Post: 01-13-2011, 08:08 PM
  5. Problem in Multi threading.
    By Chetans in forum Advanced Java
    Replies: 3
    Last Post: 03-23-2010, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •