about summary refs log tree commit diff
path: root/src/math/cosh.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/cosh.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/cosh.c')
-rw-r--r--src/math/cosh.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/math/cosh.c b/src/math/cosh.c
index 5f38b276..a1f7dbc7 100644
--- a/src/math/cosh.c
+++ b/src/math/cosh.c
@@ -32,7 +32,7 @@
 
 #include "libm.h"
 
-static const double one = 1.0, half = 0.5, huge = 1.0e300;
+static const double huge = 1.0e300;
 
 double cosh(double x)
 {
@@ -49,21 +49,21 @@ double cosh(double x)
 	/* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
 	if (ix < 0x3fd62e43) {
 		t = expm1(fabs(x));
-		w = one+t;
+		w = 1.0+t;
 		if (ix < 0x3c800000)
 			return w;  /* cosh(tiny) = 1 */
-		return one + (t*t)/(w+w);
+		return 1.0 + (t*t)/(w+w);
 	}
 
 	/* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|))/2; */
 	if (ix < 0x40360000) {
 		t = exp(fabs(x));
-		return half*t + half/t;
+		return 0.5*t + 0.5/t;
 	}
 
-	/* |x| in [22, log(maxdouble)] return half*exp(|x|) */
+	/* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
 	if (ix < 0x40862E42)
-		return half*exp(fabs(x));
+		return 0.5*exp(fabs(x));
 
 	/* |x| in [log(maxdouble), overflowthresold] */
 	if (ix <= 0x408633CE)