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: "Carlos O'Donell" <carlos at redhat dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: dalias at aerifal dot cx, 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 22:20:17 -0400
- Subject: Re: sparc, ia64: Compute cos(M_PI_2l) for your 128-bit long double please.
- References: <5165CFDE dot 6020709 at redhat dot com> <20130410 dot 233850 dot 1096713545971361798 dot davem at davemloft dot net> <20130411123902 dot GF20323 at brightrain dot aerifal dot cx> <20130411 dot 131355 dot 1363768583432053513 dot davem at davemloft dot net>
On 04/11/2013 01:13 PM, David Miller wrote:
> From: Rich Felker <dalias@aerifal.cx>
> Date: Thu, 11 Apr 2013 08:39:02 -0400
>
>> 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.
>
>
> Yes we did lose about 11 digits of precision, here's what I get with all digits
> represented:
>
> 1) 1.5707963267948966192313216916397513987395340490686477865022521659371483593314877680313657037913799285888671875e+00
>
>
> 2) 4.33590506506189051239852201302167598438116167312826517088796786054021932698682098964720558908937992221075038813778... × 10^-35
>
It looks like this has already caused a regression for ppc.
I should have listened to you more carefully Rich, sorry.
I'll fix this ASAP.
http://sourceware.org/bugzilla/show_bug.cgi?id=15359
Failure: Test: cos (pi/2) == 1.082856673921913968223746169860580e-32
Result:
is: 1.08285667392191396822e-32 0x1.c1cd129024e088a67cc7p-107
should be: 1.08285667392191396822e-32 0x1.c1cd129024e088a67cc7p-107
difference: 5.71253355584909492648e-62 0x1.78000000000000000000p-204
ulp : 376.0000
max.ulp : 0.0000
Maximal error of `cos'
is : 376 ulp
accepted: 1 ulp
Cheers,
Carlos.