svn commit: r240828 - head/lib/msun/src
Steve Kargl
kargl at FreeBSD.org
Sat Sep 22 15:38:31 UTC 2012
Author: kargl
Date: Sat Sep 22 15:38:29 2012
New Revision: 240828
URL: http://svn.freebsd.org/changeset/base/240828
Log:
* Use ENTERI() and RETURNI() to toggle the rounding precision if
necessary, so that cosl(), sinl() and tanl() work on i386 even
for naive callers.
Suggested by: bde
Reviewed by: bde
Approved by: das (mentor)
Modified:
head/lib/msun/src/s_cosl.c
head/lib/msun/src/s_sinl.c
head/lib/msun/src/s_tanl.c
Modified: head/lib/msun/src/s_cosl.c
==============================================================================
--- head/lib/msun/src/s_cosl.c Sat Sep 22 15:19:11 2012 (r240827)
+++ head/lib/msun/src/s_cosl.c Sat Sep 22 15:38:29 2012 (r240828)
@@ -33,6 +33,9 @@ __FBSDID("$FreeBSD$");
*/
#include <float.h>
+#ifdef __i386__
+#include <ieeefp.h>
+#endif
#include "math.h"
#include "math_private.h"
@@ -63,9 +66,11 @@ cosl(long double x)
if (z.bits.exp == 32767)
return ((x - x) / (x - x));
+ ENTERI();
+
/* Optimize the case where x is already within range. */
if (z.e < M_PI_4)
- return (__kernel_cosl(z.e, 0));
+ RETURNI(__kernel_cosl(z.e, 0));
e0 = __ieee754_rem_pio2l(x, y);
hi = y[0];
@@ -86,5 +91,5 @@ cosl(long double x)
break;
}
- return (hi);
+ RETURNI(hi);
}
Modified: head/lib/msun/src/s_sinl.c
==============================================================================
--- head/lib/msun/src/s_sinl.c Sat Sep 22 15:19:11 2012 (r240827)
+++ head/lib/msun/src/s_sinl.c Sat Sep 22 15:38:29 2012 (r240828)
@@ -28,6 +28,9 @@
__FBSDID("$FreeBSD$");
#include <float.h>
+#ifdef __i386__
+#include <ieeefp.h>
+#endif
#include "math.h"
#include "math_private.h"
@@ -59,10 +62,12 @@ sinl(long double x)
if (z.bits.exp == 32767)
return ((x - x) / (x - x));
+ ENTERI();
+
/* Optimize the case where x is already within range. */
if (z.e < M_PI_4) {
hi = __kernel_sinl(z.e, 0, 0);
- return (s ? -hi : hi);
+ RETURNI(s ? -hi : hi);
}
e0 = __ieee754_rem_pio2l(x, y);
@@ -84,5 +89,5 @@ sinl(long double x)
break;
}
- return (hi);
+ RETURNI(hi);
}
Modified: head/lib/msun/src/s_tanl.c
==============================================================================
--- head/lib/msun/src/s_tanl.c Sat Sep 22 15:19:11 2012 (r240827)
+++ head/lib/msun/src/s_tanl.c Sat Sep 22 15:38:29 2012 (r240828)
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$");
*/
#include <float.h>
+#ifdef __i386__
+#include <ieeefp.h>
+#endif
#include "math.h"
#include "math_private.h"
@@ -65,10 +68,12 @@ tanl(long double x)
if (z.bits.exp == 32767)
return ((x - x) / (x - x));
+ ENTERI();
+
/* Optimize the case where x is already within range. */
if (z.e < M_PI_4) {
hi = __kernel_tanl(z.e, 0, 0);
- return (s ? -hi : hi);
+ RETURNI(s ? -hi : hi);
}
e0 = __ieee754_rem_pio2l(x, y);
@@ -86,5 +91,5 @@ tanl(long double x)
break;
}
- return (hi);
+ RETURNI(hi);
}
More information about the svn-src-all
mailing list