File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about max_values...

 
Isabel Wanderley
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone can explain me why the answer is equal unequal equal equal equal ?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this out:

The output is:
2.147483647E9
2.14748365E9
and thus the value does not compare equal... This has to do with the precision of the value you can fit into the mantissa of float and doubles.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isabel, this question has appeared on other forums/threads before. It is generally considered to be a bad question, because of the f == d comparison. Any program comparing floating point numbers for equality is suspect.
Move 'em on, forget it, but remember the reason why you forgot it.
-Barry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic