about summary refs log tree commit diff
path: root/src/math/exp.c
diff options
context:
space:
mode:
authornsz <nsz@port70.net>2012-03-19 23:41:19 +0100
committernsz <nsz@port70.net>2012-03-19 23:41:19 +0100
commit0cbb65479147ecdaa664e88cc2a5a925f3de502f (patch)
tree7b6dc53fcec6497d55746d3cc47f167a20b7aa57 /src/math/exp.c
parentb03255af77776703c8d48819e824d09f6f54ba86 (diff)
downloadmusl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.tar.gz
musl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.tar.xz
musl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.zip
code cleanup of named constants
zero, one, two, half are replaced by const literals
The policy was to use the f suffix for float consts (1.0f),
but don't use suffix for long double consts (these consts
can be exactly represented as double).
Diffstat (limited to 'src/math/exp.c')
-rw-r--r--src/math/exp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/math/exp.c b/src/math/exp.c
index a538b8cd..29bf9609 100644
--- a/src/math/exp.c
+++ b/src/math/exp.c
@@ -74,7 +74,6 @@
 #include "libm.h"
 
 static const double
-one     = 1.0,
 halF[2] = {0.5,-0.5,},
 huge    = 1.0e+300,
 o_threshold =  7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
@@ -134,8 +133,8 @@ double exp(double x)
 		STRICT_ASSIGN(double, x, hi - lo);
 	} else if(hx < 0x3e300000)  {  /* |x| < 2**-28 */
 		/* raise inexact */
-		if (huge+x > one)
-			return one+x;
+		if (huge+x > 1.0)
+			return 1.0+x;
 	} else
 		k = 0;
 
@@ -147,8 +146,8 @@ double exp(double x)
 		INSERT_WORDS(twopk, 0x3ff00000+((k+1000)<<20), 0);
 	c  = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
 	if (k == 0)
-		return one - ((x*c)/(c-2.0) - x);
-	y = one-((lo-(x*c)/(2.0-c))-hi);
+		return 1.0 - ((x*c)/(c-2.0) - x);
+	y = 1.0-((lo-(x*c)/(2.0-c))-hi);
 	if (k < -1021)
 		return y*twopk*twom1000;
 	if (k == 1024)