🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1966

Re: floating point constant folding

#1966
From: Henry Spencer
Date: Tue, 13 Nov 1990 17:40
18 lines
1326 bytes
In article <8191@star.cs.vu.nl> eck@cs.vu.nl (Hans van Eck) writes:
>Is it allowed to evaluate constant floating point expressions with greater
>range and precision than that of the execution environment in contexts
>where a constant is not required?
>
>There are unexpected implications of both allowing and disallowing such
>folding, but I cannot find a statement in the standard that unambiguously
>says what a translator may or may not do.

I believe the relevant statement is the "as if" rule discussed in 2.1.2.3:
the compiler can do anything it pleases, provided the observable results
are the same.  Observable results include overflow exceptions and the values
of data items written out to files.  Evaluating constant floating-point
expressions at compile time using different floating-point hardware strikes
me as a minefield of difficulties.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry@zoo.toronto.edu   utzoo!henry
Technical Details
Message-ID: <1990Nov13.174025.1520@zoo.toronto.edu>
Path: arc1-ca.pugleaf.net!utzoo!henry
References: <8191@star.cs.vu.nl>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: floating point constant folding
Message-ID: <1990Nov13.174025.1520@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <8191@star.cs.vu.nl>
Date: Tue, 13 Nov 90 17:40:25 GMT