aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/flt-32/math_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32/math_config.h')
-rw-r--r--sysdeps/ieee754/flt-32/math_config.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sysdeps/ieee754/flt-32/math_config.h b/sysdeps/ieee754/flt-32/math_config.h
index 8d9c8ee..33ea631 100644
--- a/sysdeps/ieee754/flt-32/math_config.h
+++ b/sysdeps/ieee754/flt-32/math_config.h
@@ -165,6 +165,7 @@ issignalingf_inline (float x)
#define BIT_WIDTH 32
#define MANTISSA_WIDTH 23
#define EXPONENT_WIDTH 8
+#define EXPONENT_BIAS 127
#define MANTISSA_MASK 0x007fffff
#define EXPONENT_MASK 0x7f800000
#define EXP_MANT_MASK 0x7fffffff
@@ -177,12 +178,24 @@ is_nan (uint32_t x)
return (x & EXP_MANT_MASK) > EXPONENT_MASK;
}
+static inline bool
+is_inf (uint32_t x)
+{
+ return (x << 1) == (EXPONENT_MASK << 1);
+}
+
static inline uint32_t
get_mantissa (uint32_t x)
{
return x & MANTISSA_MASK;
}
+static inline int
+get_exponent (uint32_t x)
+{
+ return (int)((x >> MANTISSA_WIDTH & 0xff) - EXPONENT_BIAS);
+}
+
/* Convert integer number X, unbiased exponent EP, and sign S to double:
result = X * 2^(EP+1 - exponent_bias)
@@ -208,6 +221,8 @@ attribute_hidden float __math_uflowf (uint32_t);
attribute_hidden float __math_may_uflowf (uint32_t);
attribute_hidden float __math_divzerof (uint32_t);
attribute_hidden float __math_invalidf (float);
+attribute_hidden int __math_invalidf_i (int);
+attribute_hidden long int __math_invalidf_li (long int);
attribute_hidden float __math_edomf (float x);
/* Shared between expf, exp2f, exp10f, and powf. */