INT(x) == 1 if x < 1?
FX Coudert
fxcoudert@gmail.com
Mon Oct 30 06:56:00 GMT 2006
> 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?!
No, that's always true. RANDOM_NUMBER sets x to a machine-
representible number that lies between 0 (inclusively) and 1
(exclusively). Since it's a machine representible number, it will not
be converted to the nearest machine representible number; this only
happens when you write number in base 10, in the program, or when you
read them by formatted I/O.
FX
More information about the Fortran
mailing list