Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jan 2009 18:50:03 GMT
From:      David Schultz <das@FreeBSD.ORG>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/130067: Wrong numeric limits in system headers?
Message-ID:  <200901091850.n09Io349056249@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/130067; it has been noted by GNATS.

From: David Schultz <das@FreeBSD.ORG>
To: John Hein <jhein@timing.com>
Cc: =?iso-8859-1?Q?V=E1clav?= Haisman <v.haisman@sh.cvut.cz>,
        freebsd-standards@FreeBSD.ORG, freebsd-gnats-submit@FreeBSD.ORG,
        imp@FreeBSD.ORG
Subject: Re: standards/130067: Wrong numeric limits in system headers?
Date: Fri, 9 Jan 2009 13:41:36 -0500

 On Fri, Jan 09, 2009, John Hein wrote:
 > FWIW, when you compile the OP's sample code on i386 with -pedantic
 > (with 6.x's base gcc 3.4.6 or 7.x's base gcc 4.2.1), you get:
 > 
 > x.cc:11: error: floating constant exceeds range of 'long double'
 > 
 > (the LDBL_MAX line)
 > 
 > That seems to tip the scale more to the 'float.h is wrong' side.
 
 gcc doesn't do quite the right thing with long double constants in
 FreeBSD, and it causes no end of trouble when writing long double
 routines that are intended to work when the FPU is switched to
 extended precision mode.
 
 Older versions of gcc would evaluate long double constant
 expressions at compile time using extended precision, which was
 wrong because it didn't reflect what the FPU would have done at
 runtime. More recent versions of gcc were "fixed" to evaluate all
 long double constants using double precision, which matches what
 the FPU does by default. However, now it's not even possible to
 write a program that uses long double constants, even if the
 program changes the FPU precision at runtime, because gcc
 truncates all the constants at compile time (and generates
 spurious complaints such as the one you mention). C99 defines some
 pragmas that would improve the situation, but gcc doesn't
 implement them.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901091850.n09Io349056249>