math: add double precision error handling functions
This commit is contained in:
committed by
Rich Felker
parent
9ef6ca4235
commit
4f8acf953c
@@ -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
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "libm.h"
|
||||
|
||||
double __math_divzero(uint32_t sign)
|
||||
{
|
||||
return fp_barrier(sign ? -1.0 : 1.0) / 0.0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "libm.h"
|
||||
|
||||
double __math_invalid(double x)
|
||||
{
|
||||
return (x - x) / (x - x);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "libm.h"
|
||||
|
||||
double __math_oflow(uint32_t sign)
|
||||
{
|
||||
return __math_xflow(sign, 0x1p769);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "libm.h"
|
||||
|
||||
double __math_uflow(uint32_t sign)
|
||||
{
|
||||
return __math_xflow(sign, 0x1p-767);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user