This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: sparc, ia64: Compute cos(M_PI_2l) for your 128-bit long double please.
- From: Rich Felker <dalias at aerifal dot cx>
- To: David Miller <davem at davemloft dot net>
- Cc: carlos at redhat dot com, schwab at linux-m68k dot org, vapier at gentoo dot org, brooks_moses at mentor dot com, libc-alpha at sourceware dot org, joseph at codesourcery dot com, aj at suse dot com, thomas at codesourcery dot com
- Date: Thu, 11 Apr 2013 08:39:02 -0400
- Subject: Re: sparc, ia64: Compute cos(M_PI_2l) for your 128-bit long double please.
- References: <5164D25B dot 9090406 at redhat dot com> <m2fvyyjp82 dot fsf at igel dot home> <5165CFDE dot 6020709 at redhat dot com> <20130410 dot 233850 dot 1096713545971361798 dot davem at davemloft dot net>
On Wed, Apr 10, 2013 at 11:38:50PM -0400, David Miller wrote:
> From: "Carlos O'Donell" <carlos@redhat.com>
> Date: Wed, 10 Apr 2013 16:47:26 -0400
>
> > Could you check the answer for cos(M_PI_2l) on sparc for 128-bit
> > long double?
>
> 1) printf ("%.100Le\n", (long double)(M_PI_2l/2.0L));
100 is not enough. The precision needs to be equal to at least the
number of bits in the significand, and if the exponent is negative
(not the case here), then it needs to be at least the sum of the
exponent and number of bits in the significand.
I would just use something like "%.100000g\n". The %g format discards
trailing zeros, and the huge precision will ensure you don't miss
anything.
Rich