aspose file tools
The moose likes Java in General and the fly likes problem in rounding the double value Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "problem in rounding the double value" Watch "problem in rounding the double value" New topic
Author

problem in rounding the double value

anu sav
Ranch Hand

Joined: Jan 30, 2009
Posts: 47
Hi,
i want the double value rounded up to the nearest 0.05
e.g., if input= 10.37 then output= 10.35
if input=10.33 then output=10.35
can anybody help for this logic ?

Thanks
Andrey Kozhanov
Ranch Hand

Joined: Mar 12, 2010
Posts: 79
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32694
    
    4
anu sav wrote: . . .
i want the double value rounded up to the nearest 0.05
e.g., if input= 10.37 then output= 10.35 . . .
That is not rounded up.

Remember all floating-point arithmetic, including rounding, is subject to errors of imprecision.
anu sav
Ranch Hand

Joined: Jan 30, 2009
Posts: 47
Thanks guys..for quick reply. It worked for me.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32694
    
    4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in rounding the double value
 
Similar Threads
ServletStream
to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not
Variable Syntax
Double data type issue
Exponent Problem