This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/6] Remove slow paths from sin/cos
- From: Steve Ellcey <sellcey at cavium dot com>
- To: Zack Weinberg <zackw at panix dot com>, Ondřej Bílka <neleai at seznam dot cz>
- Cc: Siddhesh Poyarekar <siddhesh at gotplt dot org>, Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Fri, 09 Mar 2018 15:05:22 -0800
- Subject: Re: [PATCH 2/6] Remove slow paths from sin/cos
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- References: <CAKCAbMg85h8JLK1qUNUgUUDVwU2WCnD4WCCputCM7qhr7y0i6w@mail.gmail.com>
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Fri, 2018-03-09 at 13:52 -0500, Zack Weinberg wrote:
>
> More concretely, for IEEE single, the gap between representable values
> is bigger than 2π for values whose exponent is 2^26 or above. Since
> the sine function is periodic over 2π, that means the result of sinf()
> is effectively meaningless for any input at least that big - _any
> value_ within the input period could have been rounded to the
> representable, so the "true" answer could be anything. (I am tempted
> to suggest that we return NaN for inputs this large, without even
> bothering to do argument reduction.)
>
> For double, this happens at 2^55, and for x86-64 long double it
> happens at 2^66. I _think_ x86-64 long double is 80-bit IEEE
> extended, not quad, but I could be wrong.
>
> zw
And yet we have tests for large numbers in auto-libm-test-out-sin
and auto-libm-test-out-cos. I was testing a different vector sin/cos
implementation on aarch64 and I got some big diffs on very large
output. Maybe we shouldn't test for these values if they are not
of any value.
testing double (vector length 2)
Failure: Test: sin_vlen2 (-0x2p+64)
Result:
is: -0.0000000000000000e+00 -0x0.0000000000000p+0
should be: 4.7183876212354675e-02 0x1.8287c2a760e04p-5
difference: 4.7183876212354675e-02 0x1.8287c2a760e04p-5
ulp : 6799913194491396.0000
max.ulp : 1.0000
Failure: Test: sin_vlen2 (-0x3.3de320f6be87ep+1020)
Result:
is: -0.0000000000000000e+00 -0x0.0000000000000p+0
should be: -9.9219562491895441e-01 -0x1.fc0110a085bafp-1
difference: 9.9219562491895441e-01 0x1.fc0110a085bafp-1
ulp : 8936903693327279.0000
max.ulp : 1.0000