Browse Source

math: use sqrtl if FLT_EVAL_METHOD==2 in acosh and acoshf

this makes acosh slightly more precise around 1.0 on i386
Szabolcs Nagy 11 years ago
parent
commit
4b539a826b
2 changed files with 13 additions and 0 deletions
  1. 5 0
      src/math/acosh.c
  2. 8 0
      src/math/acoshf.c

+ 5 - 0
src/math/acosh.c

@@ -1,5 +1,10 @@
 #include "libm.h"
 
+#if FLT_EVAL_METHOD==2
+#undef sqrt
+#define sqrt sqrtl
+#endif
+
 /* acosh(x) = log(x + sqrt(x*x-1)) */
 double acosh(double x)
 {

+ 8 - 0
src/math/acoshf.c

@@ -1,5 +1,13 @@
 #include "libm.h"
 
+#if FLT_EVAL_METHOD==2
+#undef sqrtf
+#define sqrtf sqrtl
+#elif FLT_EVAL_METHOD==1
+#undef sqrtf
+#define sqrtf sqrt
+#endif
+
 /* acosh(x) = log(x + sqrt(x*x-1)) */
 float acoshf(float x)
 {