This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: INT(x) == 1 if x < 1?
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: FX Coudert <fxcoudert at gmail dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Sun, 29 Oct 2006 23:29:10 +0100
- Subject: Re: INT(x) == 1 if x < 1?
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=jwMg1qToW6DXionIDrdBKNUux09eTBvFKRaq5+hNq+PK1hMA983117XwEZbHnEniIsJ4BIFZU6JUXB7CtYx3eWt/7ohzb9FqjFkD4sKW4Nv/mSy1+Y3brIRrsbfxClnGett67VMFVbU+BUalzKnENOc/QLMgXKtnHUJ8VKIvmHI=
- References: <200610292312.15297.franke.daniel@gmail.com> <B2988DFE-91EA-4DF3-B553-645D124EC3C2@gmail.com>
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