summaryrefslogtreecommitdiff
path: root/libm/fpmacros.c
diff options
context:
space:
mode:
Diffstat (limited to 'libm/fpmacros.c')
-rw-r--r--libm/fpmacros.c108
1 files changed, 63 insertions, 45 deletions
diff --git a/libm/fpmacros.c b/libm/fpmacros.c
index a9f63df4b..3dbc8a13c 100644
--- a/libm/fpmacros.c
+++ b/libm/fpmacros.c
@@ -15,8 +15,8 @@
**
** Change History (most recent first):
**
-** 07 Jul 01 ram First created from fpfloatfunc.c, fp.c,
-** classify.c and sign.c in MathLib v3 Mac OS9.
+** 07 Jul 01 ram First created from fpfloatfunc.c, fp.c,
+** classify.c and sign.c in MathLib v3 Mac OS9.
**
***********************************************************************/
@@ -148,7 +148,7 @@ long int __isnorma ( double x )
Calls: none
***********************************************************************/
-long int __isfinitef ( float x )
+long int __finitef ( float x )
{
union {
unsigned long int lval;
@@ -159,13 +159,56 @@ long int __isfinitef ( float x )
return ((z.lval & FEXP_MASK) != FEXP_MASK);
}
-long int __isfinite ( double x )
+long int __finite ( double x )
{
return ( __fpclassify ( x ) >= FP_ZERO );
}
/***********************************************************************
+ long int __signbitf(float x) returns nonzero if and only if the sign
+ bit of x is set and zero otherwise.
+
+ Exceptions: INVALID is raised if x is a signaling NaN.
+
+ Calls: none
+***********************************************************************/
+
+long int __signbitf ( float x )
+{
+ union {
+ unsigned long int lval;
+ float fval;
+ } z;
+
+ z.fval = x;
+ return ((z.lval & SIGN_MASK) != 0);
+}
+
+
+/***********************************************************************
+ Function sign of a double.
+ Implementation of sign bit for the PowerPC.
+
+ Calls: none
+***********************************************************************/
+
+long int __signbit ( double arg )
+{
+ union
+ {
+ dHexParts hex;
+ double dbl;
+ } x;
+ long int sign;
+
+ x.dbl = arg;
+ sign = ( ( x.hex.high & dSgnMask ) == dSgnMask ) ? 1 : 0;
+ return sign;
+}
+
+
+/***********************************************************************
* long int __isinff(float x) returns -1 if value represents negative
* infinity, 1 if value represents positive infinity,
* and 0 otherwise.
@@ -190,6 +233,17 @@ long int __isinf ( double x )
return 0;
}
+#if 0
+long int __isinfl ( long double x )
+{
+ long int class = __fpclassify(x);
+ if ( class == FP_INFINITE ) {
+ return ( (__signbit(x)) ? -1 : 1);
+ }
+ return 0;
+}
+#endif
+
/***********************************************************************
long int __isnanf(float x) returns nonzero if and only if x is a
NaN and zero otherwise.
@@ -217,47 +271,11 @@ long int __isnan ( double x )
return ( ( class == FP_SNAN ) || ( class == FP_QNAN ) );
}
-
-/***********************************************************************
- long int __signbitf(float x) returns nonzero if and only if the sign
- bit of x is set and zero otherwise.
-
- Exceptions: INVALID is raised if x is a signaling NaN.
-
- Calls: none
-***********************************************************************/
-
-long int __signbitf ( float x )
-{
- union {
- unsigned long int lval;
- float fval;
- } z;
-
- z.fval = x;
- return ((z.lval & SIGN_MASK) != 0);
-}
-
-
-/***********************************************************************
- Function sign of a double.
- Implementation of sign bit for the PowerPC.
-
- Calls: none
-***********************************************************************/
-
-long int __signbit ( double arg )
+#if 0
+long int __isnanl ( long double x )
{
- union
- {
- dHexParts hex;
- double dbl;
- } x;
- long int sign;
-
- x.dbl = arg;
- sign = ( ( x.hex.high & dSgnMask ) == dSgnMask ) ? 1 : 0;
- return sign;
+ long int class = __fpclassify(x);
+ return ( ( class == FP_SNAN ) || ( class == FP_QNAN ) );
}
-
+#endif