aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/math_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/math_config.h')
-rw-r--r--sysdeps/ieee754/dbl-64/math_config.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/math_config.h b/sysdeps/ieee754/dbl-64/math_config.h
index 3382e38..d9288c4 100644
--- a/sysdeps/ieee754/dbl-64/math_config.h
+++ b/sysdeps/ieee754/dbl-64/math_config.h
@@ -109,6 +109,7 @@ issignaling_inline (double x)
#define BIT_WIDTH 64
#define MANTISSA_WIDTH 52
#define EXPONENT_WIDTH 11
+#define EXPONENT_BIAS 1023
#define MANTISSA_MASK UINT64_C(0x000fffffffffffff)
#define EXPONENT_MASK UINT64_C(0x7ff0000000000000)
#define EXP_MANT_MASK UINT64_C(0x7fffffffffffffff)
@@ -121,12 +122,24 @@ is_nan (uint64_t x)
return (x & EXP_MANT_MASK) > EXPONENT_MASK;
}
+static inline bool
+is_inf (uint64_t x)
+{
+ return (x << 1) == (EXPONENT_MASK << 1);
+}
+
static inline uint64_t
get_mantissa (uint64_t x)
{
return x & MANTISSA_MASK;
}
+static inline int
+get_exponent (uint64_t x)
+{
+ return (int)((x >> MANTISSA_WIDTH & 0x7ff) - EXPONENT_BIAS);
+}
+
/* Convert integer number X, unbiased exponent EP, and sign S to double:
result = X * 2^(EP+1 - exponent_bias)
@@ -164,6 +177,8 @@ attribute_hidden double __math_divzero (uint32_t);
/* Invalid input unless it is a quiet NaN. */
attribute_hidden double __math_invalid (double);
+attribute_hidden int __math_invalid_i (int);
+attribute_hidden long int __math_invalid_li (long int);
/* Error handling using output checking, only for errno setting. */