summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-09-19 16:59:10 -0400
committerRich Felker <dalias@aerifal.cx>2011-09-19 16:59:10 -0400
commit089aeb08a083d798b59fc84cbff9383f304b1b8f (patch)
treebd2f1aabbf3bfed36b74a5a4fd46eeda1b74b4f7
parent53431b091b22a663a428c67f8c617740f5882706 (diff)
downloadmusl-089aeb08a083d798b59fc84cbff9383f304b1b8f.tar.gz
musl-089aeb08a083d798b59fc84cbff9383f304b1b8f.tar.bz2
musl-089aeb08a083d798b59fc84cbff9383f304b1b8f.tar.xz
musl-089aeb08a083d798b59fc84cbff9383f304b1b8f.zip
fix incorrect long double parameters on arm (and other future ports)
this was the cause of crashes in printf when attempting to print floating point values.
-rw-r--r--arch/arm/bits/float.h20
-rw-r--r--src/stdlib/frexpl.c12
2 files changed, 22 insertions, 10 deletions
diff --git a/arch/arm/bits/float.h b/arch/arm/bits/float.h
index 044b516b..75fdc9bc 100644
--- a/arch/arm/bits/float.h
+++ b/arch/arm/bits/float.h
@@ -1,14 +1,14 @@
#define FLT_ROUNDS 1
-#define FLT_EVAL_METHOD 2
+#define FLT_EVAL_METHOD 0
-#define LDBL_MIN 3.3621031431120935063e-4932L
-#define LDBL_MAX 1.1897314953572317650e+4932L
-#define LDBL_EPSILON 1.0842021724855044340e-19L
+#define LDBL_MIN 2.2250738585072014e-308
+#define LDBL_MAX 1.7976931348623157e+308
+#define LDBL_EPSILON 2.2204460492503131e-16
-#define LDBL_MANT_DIG 64
-#define LDBL_MIN_EXP (-16381)
-#define LDBL_MAX_EXP 16384
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
-#define LDBL_DIG 18
-#define LDBL_MIN_10_EXP (-4931)
-#define LDBL_MAX_10_EXP 4932
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
diff --git a/src/stdlib/frexpl.c b/src/stdlib/frexpl.c
index ecfff007..3472bf70 100644
--- a/src/stdlib/frexpl.c
+++ b/src/stdlib/frexpl.c
@@ -1,5 +1,8 @@
#include <math.h>
#include <inttypes.h>
+#include <float.h>
+
+#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
/* This version is for 80-bit little endian long double */
@@ -23,3 +26,12 @@ long double frexpl(long double x, int *e)
y.hw[4] |= 0x3ffe;
return y.ld;
}
+
+#else
+
+long double frexpl(long double x, int *e)
+{
+ return frexp(x, e);
+}
+
+#endif