[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: standards/130067: Wrong numeric limits in system headers?
- To: Václav Haisman <v_(_dot_)_haisman_(_at_)_sh_(_dot_)_cvut_(_dot_)_cz>
- Subject: Re: standards/130067: Wrong numeric limits in system headers?
- From: John Hein <jhein_(_at_)_timing_(_dot_)_com>
- Date: Fri, 9 Jan 2009 08:57:26 -0700
- Cc: freebsd-standards_(_at_)_FreeBSD_(_dot_)_ORG, das_(_at_)_FreeBSD_(_dot_)_ORG, freebsd-gnats-submit_(_at_)_FreeBSD_(_dot_)_ORG, imp_(_at_)_FreeBSD_(_dot_)_ORG
Václav Haisman wrote at 22:56 +0100 on Jan 8, 2009:
> David Schultz wrote, On 6.1.2009 20:03:
> > On FreeBSD/i386, long doubles are represented with 64 bits of
> > precision, but computations are performed with 53 bits of
> > precision. In a sane world, this discrepancy wouldn't exist, but
> > for reasons I won't get into, they do, and probably always will.
> >
> > C99 defines the LDBL constants based on what can be represented,
> > not what can be computed as the result of arithmetic operations,
> > so my interpretation is that the values in float.h are correct,
> > though confusing.
> I am not language lawyer but even if it were true that the constants are
> right, there is still the problem that they (especially the LDBL_MAX value)
> are useless with the provided GCC. Either GCC or the headers should be
> changed. Otherwise the constants are rather useless and unusable.
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.
_______________________________________________
freebsd-standards_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-standards
To unsubscribe, send any mail to "freebsd-standards-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org