Support for IEEE754

llewelly@xmission.com llewelly@xmission.com
Thu Apr 15 17:50:00 GMT 2004


JOLY Loic <loic.joly@renault.com> writes:

> Hello,
> 
> I recently tried the following code (platform : PC/Linux, gcc version 3.2) :
> 
> #include <limits>
> #include <iostream>
> 
> using namespace std;
> 
> int main(int argc, char *argv[])
> {
> 	cout << "is IEEE754   = " << numeric_limits<double>::is_iec559<<endl;
> 	cout << "has infinity = " << numeric_limits<double>::has_infinity<<endl;
> 
> 	cout << "infinity > 100 ? " <<
> (numeric_limits<double>::infinity() >100) <<endl;
> 	cout << "infinity= " <<numeric_limits<double>::infinity()<<endl;
> 	
> 	return 1;
> }
> 
> It shows that gcc does not handle the IEEE 754 standard on this
> platform, even if support for this standard is available on this
> processor (The same program run on win/mscv on the same computer shows
> handling for IEEE754).
> 
> Is there any compiler flag, or anything, to make gcc compatible with
> this standard?

Yes; get a current version of gcc. Compiled with gcc 3.3.3, your
    program prints:

is IEEE754   = 1
has infinity = 1
infinity > 100 ? 1
infinity= inf

which shows that it implements IEEE754 at least well enough to pass
    the trivial test you used on the other compiler.

> Is there any (good) reason why gcc is not and will
> never be compliant?

It has always been the intent of the gcc team to implement 
    relevant standards such as IEEE754, ISO 14882, posix, etc. However
    these standards are extrodinarily complex, and like other
    implementors, the gcc team has finite resources. If you find any
    bugs, please report them, see gcc.gnu.org/bugs.html . They will be
    pleased if you do, and make every effort to fix them.

So 'will never' has always been false, and 'is not' is false at least
    with respect to your test case. (though other bugs remain) The
    result is that you appear to be either deliberately insulting,
    grossly ignorant, or both. So in the future, please avoid
    statements that appear to make such statements.
    




More information about the Gcc-help mailing list