This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: INT(x) == 1 if x < 1?


On Sunday 29 October 2006 23:17, FX Coudert wrote:

> When you say "0.99999999", the compiler understands "the real number
> exactly representible for this kind (here, 4) that is closest to
> 0.99999999". It so happens that this number is 1.000000000000.

Wow, that was fast =)
Yes, I thought so, but then, there's another problem:

As the standard requires (13.14.85, F95 final draft), RANDOM_NUMBER() shall 
return a harvest x in the range 0 <= x < 1. Therefore, on REAL :: x; 
RANDOM_NUMBER(x), INT(x) must(?) equal zero. As I learned the hard way, this 
is not always true?!

	Daniel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]