This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sparc, ia64: Compute cos(M_PI_2l) for your 128-bit long double please.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]