This is the mail archive of the
mailing list for the GNU Fortran project.
Re: INT(x) == 1 if x < 1?
As the standard requires (13.14.85, F95 final draft), RANDOM_NUMBER
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
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.