aspose file tools*
The moose likes Beginning Java and the fly likes About substraction of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About substraction of "double"" Watch "About substraction of "double"" New topic
Author

About substraction of "double"

kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
System.out.println(2.00 - 1.10);
result--> 0.8999999999999999

But,

System.out.println(4.00 - 1.10);
result--> 2.9

Why differences in results.
Please help me out.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See Sun's tech tip, Some things you should know about floating-point arithmetic.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About substraction of "double"