Welcome to Intel® Software Network Quick Login | Join | Help |
Search in Intel® Software Network Forums
in Go

Round decimal digits of a double float number

Last post 05-13-2008, 4:44 PM by tim18. 1 replies.
Sort Posts: Previous Next
 05-13-2008, 2:17 PM 30254751  

Round decimal digits of a double float number

Hello

I´m a doubt: I need use double float numbers but I wish that these numbers have a fixed accuracy of only 3 or 4 digits. For example:

REAL*8      TOUT, BUF(5000,17)

TOUT = (BUF(i,17) - BUF(i-1,17))*60.0D0

resulting in (for example):

TOUT = 10.2839999999995

But I need that this number is rounded to 10.2840000000000.

Does anybody know how I can resolve this problem?

Thanks

IlexSP

 
 05-13-2008, 4:44 PM 30254761 in reply to 30254751  

Re: Round decimal digits of a double float number

From what you posted, I don't know whether you have unrealistic expectations, or have overlooked the Fortran FORMAT specifications, or ..... ?
When you take the difference of two nearly equal binary values, with bits just sufficient to represent 15 or more decimal digits, the results you got are to be expected.
 
View as RSS news feed in XML

Shortcuts


Tags For This Post

...

Community Tags

...