aspose file tools
The moose likes Java in General and the fly likes double and float loosing precision - java core knowledge Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "double and float loosing precision - java core knowledge" Watch "double and float loosing precision - java core knowledge" New topic
Author

double and float loosing precision - java core knowledge

Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
Hello,



The output of this program is:

50.12333
0.12333000000000283
float ----------------------
50.12333
0.12332916


Can anyone explain these values? I would expect no loss of precision with such small values!
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
value doesn't matter when you're dealing with floating point arithmetic. There's no magical number after which suddenly you start to loose precision, no magic formula that will tell you if and if so how much precision will be lost at any point.

http://docs.sun.com/source/806-3568/ncg_goldberg.html


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: double and float loosing precision - java core knowledge
 
Similar Threads
iterating a double
float * double...newbie question
Keyboard.Class/Anyone with brains.pt2
Precision and scale of a decimal value
Problem with DecimalFormat