Results 1 to 4 of 4
  1. #1
    jamborta is offline Member
    Join Date
    Dec 2007
    Posts
    6
    Rep Power
    0

    Default uncorrect result

    hi guys,

    I was debugging something in java and I got an unexpected result for some of the calculation, if I simplify I get this one line

    Java Code:
    System.out.println(15-(3.5*3.8))
    which would print out
    1.700000000000001

    I don't really understand where that 0.000000000000001 comes from.

    thanks.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

  3. #3
    jamborta is offline Member
    Join Date
    Dec 2007
    Posts
    6
    Rep Power
    0

    Default

    thanks. I didn't know that.

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    You're welcome. If you need precision, have a look at BigDecimal
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. column result query
    By vikashkumar in forum JDBC
    Replies: 0
    Last Post: 04-03-2009, 02:23 PM
  2. problem in get result than SQL to jtable
    By MS_Dark in forum New To Java
    Replies: 0
    Last Post: 12-13-2008, 12:52 PM
  3. result select sql in jtable
    By herfnai in forum JDBC
    Replies: 0
    Last Post: 08-17-2008, 12:20 PM
  4. result select sql in jtable
    By herfnai in forum JDBC
    Replies: 0
    Last Post: 08-17-2008, 12:20 PM
  5. getting a random result
    By gradon in forum New To Java
    Replies: 2
    Last Post: 07-19-2007, 03:54 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
  •