summaryrefslogtreecommitdiff
path: root/src/math/exp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/exp2.c')
-rw-r--r--src/math/exp2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/math/exp2.c b/src/math/exp2.c
index 599634e6..16ff5940 100644
--- a/src/math/exp2.c
+++ b/src/math/exp2.c
@@ -4,6 +4,12 @@
TYPE TGFN(exp2)(TYPE x)
{
+ switch (fpclassify(x)) {
+ case FP_ZERO: return 1.0;
+ case FP_INFINITE: return signbit(x) ? 0.0 : x;
+ default: break;
+ }
+
return x;
}