Fix sin inaccuracy (bz#10709)
Andreas Jaeger
aj@suse.com
Thu Jul 21 11:44:00 GMT 2011
On Sunday, July 03, 2011 02:17:08 PM Andreas Jaeger wrote:
> This fixes an inaccuracy in sin,
>
> Andreas
I send the wrong patch - here's the sine one,
Andreas
2011-07-03 Andreas Jaeger <aj@suse.de>
[BZ#10709]
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Fix incorrect rounding
of sin. Patch suggested by Paul Zimmermann <zimmerma+gcc@loria.fr>.
* math/libm-test.inc (sin_test): Add test case.
--
Andreas Jaeger, Program Manager openSUSE
aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
-------------- next part --------------
commit 71fcaaec2ad71620351372dcb687a065979d8af4
Author: Andreas Jaeger <jaegerandi@gmail.com>
Date: Sun Jul 3 14:13:43 2011 +0200
2011-07-03 Andreas Jaeger <aj@suse.de>
[BZ#10709]
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Fix incorrect rounding
of sin. Patch suggested by Paul Zimmermann <zimmerma+gcc@loria.fr>.
* math/libm-test.inc (sin_test): Add test case.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 04098b4..0c1e34c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -5625,6 +5625,7 @@ sin_test (void)
#ifdef TEST_DOUBLE
TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
+ TEST_f_f (sin, 2.522464e-1, 2.4957989804940911e-1);
#endif
END (sin);
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index b40776f..1cfa516 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001, 2009 Free Software Foundation
+ * Copyright (C) 2001, 2009, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -127,7 +127,7 @@ double __sin(double x){
cor=(ssn+s*ccs-sn*c)+cs*s;
res=sn+cor;
cor=(sn-res)+cor;
- return (res==res+1.025*cor)? res : slow1(x);
+ return (res==res+1.096*cor)? res : slow1(x);
} /* else if (k < 0x3feb6000) */
/*----------------------- 0.855469 <|x|<2.426265 ----------------------*/
More information about the Libc-alpha
mailing list