This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: Serious bug


Craig Burley wrote:
> 
> And, the approximation method used to obtain *any* "incarnation" of
> a number (computed from a text constant, an operation on other
> numbers, etc.) is rarely required to be the exact same approximation
> method for all numbers of that type.
> 
> This means that, in languages like Fortran, C, and, I would guess,
> C++, it is permitted for evaluation of
> 
>   3.1 - 3.1
> 
> to return a non-zero number, because the approximations of the two
> `3.1' constants need not be identical.

Well, that's just silly.  If everyone agrees with that, I'm glad I
didn't bother to go back to school for any "Computer Science" courses.

> In Fortran, anyway, this leads to situations that quite contradict
> what I think you're saying is "guaranteed" of a language like Fortran:
> 
>         REAL R
>         DOUBLE PRECISION D
> 
>         R = 3.1
>         D = 3.1
>         IF (R .EQ. D) PRINT *, 'Equal!'
>         END
> 
> The above program is not necessarily going to print "Equal!" on all
> standard-conforming compilers.

That's NOT what I'm talking about.  It's this (I haven't used Fortran
since grad school, so I can't check the syntax of your example):

>         DOUBLE PRECISION R
>         DOUBLE PRECISION D
> 
>         R = 3.1
>         D = 3.1
>         IF (R .EQ. D) PRINT *, 'Equal!'
>         END

Get it?  I'm sorry if my statements didn't make it clear that I am only
talking about numbers of exactly the same type (including precision).

-- 
Dick Hadsell			914-381-8400 x5446 Fax: 914-381-9790
Reply-to:			hadsell@blueskystudios.com
Blue Sky | VIFX                 http://www.bluesky-vifx.com
1 South Road, Harrison, NY 10528


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