NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/54232: lib/libm/t_cos:cosf_angles regression on i386



The following reply was made to PR lib/54232; it has been noted by GNATS.

From: coypu%sdf.org@localhost
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/54232: lib/libm/t_cos:cosf_angles regression on i386
Date: Sun, 26 May 2019 22:30:05 +0000

 The commits switched x86 (32 and 64bit) to stop using x87 trigonometric functions.
 So, this calculation (from lib/libm/src/k_sinf.c:44)* differs, and possibly other things too:
 * This is part of the code that runs in this calculation.
 
 
 #!/bin/sh
 cat << EOF > AAAtest.c
 #include <stdio.h>
 static const float
 half =  5.0000000000e-01,/* 0x3f000000 */
 S1  = -1.6666667163e-01, /* 0xbe2aaaab */
 S2  =  8.3333337680e-03, /* 0x3c088889 */
 S3  = -1.9841270114e-04, /* 0xb9500d01 */
 S4  =  2.7557314297e-06, /* 0x3638ef1b */
 S5  = -2.5050759689e-08, /* 0xb2d72f34 */
 S6  =  1.5896910177e-10; /* 0x2f2ec9d3 */
 int main() {
 	float z = 0.274155766;
 	printf("%.18g\n", S2+z*(S3+z*(S4+z*(S5+z*S6))));
 	return 0;
 }
 EOF
 gcc AAAtest.c -m32 -o 32
 gcc AAAtest.c -o 64
 ./32
 ./64
 
 
 outputs:
 0.00827914439122296592
 0.0082791447639465332
 
 Switching to more precision gets a result closer to the 32bit version.
 
 I don't understand why this is calculated very differently.
 


Home | Main Index | Thread Index | Old Index