diff options
author | Szabolcs Nagy <nsz@port70.net> | 2017-10-22 13:51:35 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-04-17 13:08:42 -0400 |
commit | 9ef6ca4235b7a66aefa432295c02b4df64a53f2e (patch) | |
tree | 21c1f5ef1a000735d15242cf4e0c4bde50b56ae7 /src/math | |
parent | fe54544f055959bb7406758881d0fb85920b3f0e (diff) | |
download | musl-9ef6ca4235b7a66aefa432295c02b4df64a53f2e.tar.gz musl-9ef6ca4235b7a66aefa432295c02b4df64a53f2e.tar.xz musl-9ef6ca4235b7a66aefa432295c02b4df64a53f2e.zip |
math: add single precision error handling functions
These are supposed to be used in tail call positions when handling special cases in new code. (fp exceptions may be raised "naturally" by the common code path if special casing is more effort.) This implements the error handling apis used in https://github.com/ARM-software/optimized-routines without errno setting.
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/__math_divzerof.c | 6 | ||||
-rw-r--r-- | src/math/__math_invalidf.c | 6 | ||||
-rw-r--r-- | src/math/__math_oflowf.c | 6 | ||||
-rw-r--r-- | src/math/__math_uflowf.c | 6 | ||||
-rw-r--r-- | src/math/__math_xflowf.c | 6 |
5 files changed, 30 insertions, 0 deletions
diff --git a/src/math/__math_divzerof.c b/src/math/__math_divzerof.c new file mode 100644 index 00000000..ce046f3e --- /dev/null +++ b/src/math/__math_divzerof.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_divzerof(uint32_t sign) +{ + return fp_barrierf(sign ? -1.0f : 1.0f) / 0.0f; +} diff --git a/src/math/__math_invalidf.c b/src/math/__math_invalidf.c new file mode 100644 index 00000000..357d4b12 --- /dev/null +++ b/src/math/__math_invalidf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_invalidf(float x) +{ + return (x - x) / (x - x); +} diff --git a/src/math/__math_oflowf.c b/src/math/__math_oflowf.c new file mode 100644 index 00000000..fa7d0620 --- /dev/null +++ b/src/math/__math_oflowf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_oflowf(uint32_t sign) +{ + return __math_xflowf(sign, 0x1p97f); +} diff --git a/src/math/__math_uflowf.c b/src/math/__math_uflowf.c new file mode 100644 index 00000000..94d50f2b --- /dev/null +++ b/src/math/__math_uflowf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_uflowf(uint32_t sign) +{ + return __math_xflowf(sign, 0x1p-95f); +} diff --git a/src/math/__math_xflowf.c b/src/math/__math_xflowf.c new file mode 100644 index 00000000..f2c84784 --- /dev/null +++ b/src/math/__math_xflowf.c @@ -0,0 +1,6 @@ +#include "libm.h" + +float __math_xflowf(uint32_t sign, float y) +{ + return eval_as_float(fp_barrierf(sign ? -y : y) * y); +} |