aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
authorPo Lu2021-11-30 08:16:50 +0800
committerPo Lu2021-11-30 08:16:50 +0800
commit8f5d2a3181d22f858ede3fb6a1452f99272901fe (patch)
tree1921a09e17c7c29d2637b073cf7b2158c71c6017 /src/floatfns.c
parent901938109f7b5574e97e787bee10441086680de8 (diff)
parentd8dd705e9d82df96d67d88e1bf90373b6b4fbaa9 (diff)
downloademacs-8f5d2a3181d22f858ede3fb6a1452f99272901fe.tar.gz
emacs-8f5d2a3181d22f858ede3fb6a1452f99272901fe.zip
Merge remote-tracking branch 'origin/master' into feature/pgtk
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index aadae4fd9d6..f52dae47193 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -347,6 +347,21 @@ int
347double_integer_scale (double d) 347double_integer_scale (double d)
348{ 348{
349 int exponent = ilogb (d); 349 int exponent = ilogb (d);
350#ifdef HAIKU
351 /* On Haiku, the values returned by ilogb are nonsensical when
352 confronted with tiny numbers, inf, or NaN, which breaks the trick
353 used by code on other platforms, so we have to test for each case
354 manually, and return the appropriate value. */
355 if (exponent == FP_ILOGB0)
356 {
357 if (isnan (d))
358 return (DBL_MANT_DIG - DBL_MIN_EXP) + 2;
359 if (isinf (d))
360 return (DBL_MANT_DIG - DBL_MIN_EXP) + 1;
361
362 return (DBL_MANT_DIG - DBL_MIN_EXP);
363 }
364#endif
350 return (DBL_MIN_EXP - 1 <= exponent && exponent < INT_MAX 365 return (DBL_MIN_EXP - 1 <= exponent && exponent < INT_MAX
351 ? DBL_MANT_DIG - 1 - exponent 366 ? DBL_MANT_DIG - 1 - exponent
352 : (DBL_MANT_DIG - DBL_MIN_EXP 367 : (DBL_MANT_DIG - DBL_MIN_EXP