math: add double precision error handling functions

This commit is contained in:
Szabolcs Nagy
2019-04-17 13:08:45 -04:00
committed by Rich Felker
parent 9ef6ca4235
commit 4f8acf953c
6 changed files with 35 additions and 0 deletions
+5
View File
@@ -222,5 +222,10 @@ hidden float __math_uflowf(uint32_t);
hidden float __math_oflowf(uint32_t);
hidden float __math_divzerof(uint32_t);
hidden float __math_invalidf(float);
hidden double __math_xflow(uint32_t, double);
hidden double __math_uflow(uint32_t);
hidden double __math_oflow(uint32_t);
hidden double __math_divzero(uint32_t);
hidden double __math_invalid(double);
#endif
+6
View File
@@ -0,0 +1,6 @@
#include "libm.h"
double __math_divzero(uint32_t sign)
{
return fp_barrier(sign ? -1.0 : 1.0) / 0.0;
}
+6
View File
@@ -0,0 +1,6 @@
#include "libm.h"
double __math_invalid(double x)
{
return (x - x) / (x - x);
}
+6
View File
@@ -0,0 +1,6 @@
#include "libm.h"
double __math_oflow(uint32_t sign)
{
return __math_xflow(sign, 0x1p769);
}
+6
View File
@@ -0,0 +1,6 @@
#include "libm.h"
double __math_uflow(uint32_t sign)
{
return __math_xflow(sign, 0x1p-767);
}
+6
View File
@@ -0,0 +1,6 @@
#include "libm.h"
double __math_xflow(uint32_t sign, double y)
{
return eval_as_double(fp_barrier(sign ? -y : y) * y);
}