sqrt.c
tan.c
tanh.c
+isnan.c
hugeval.c
frexp.e
modf.e
+isnan.c
clean:
rm -f asin.o atan2.o atan.o ceil.o fabs.o pow.o log10.o \
log.o sin.o sinh.o sqrt.o tan.o tanh.o exp.o ldexp.o \
- fmod.o floor.o hugeval.o frexp.o modf.o OLIST
+ fmod.o floor.o hugeval.o frexp.o modf.o isnan.o OLIST
1.0
};
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
+
if (negative) {
x = -x;
}
#include <float.h>
#include <math.h>
+#include <errno.h>
#include "localmath.h"
double
int n;
double g;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (neg) {
x = -x;
}
int n;
int negative = x < 0;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (x < M_LN_MIN_D) {
errno = ERANGE;
return 0.0;
int sign = 1;
int currexp;
+ if (__IsNan(fl)) {
+ errno = EDOM;
+ return fl;
+ }
if (fl == 0.0) return 0.0;
if (fl<0) {
fl = -fl;
sign = -1;
}
+ if (fl > DBL_MAX) { /* for infinity */
+ errno = ERANGE;
+ return sign * fl;
+ }
fl = frexp(fl,&currexp);
exp += currexp;
if (exp > 0) {
/* $Header$ */
#include <math.h>
+#include <float.h>
#include <errno.h>
#include "localmath.h"
double znum, zden, z, w;
int exponent;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (x < 0) {
errno = EDOM;
return -HUGE_VAL;
return -HUGE_VAL;
}
+ if (x <= DBL_MAX) {
+ }
+ else return x; /* for infinity and Nan */
x = frexp(x, &exponent);
if (x > M_1_SQRT2) {
znum = (x - 0.5) - 0.5;
double
log10(double x)
{
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (x < 0) {
errno = EDOM;
return -HUGE_VAL;
/* $Header$ */
#include <math.h>
+#include <float.h>
+#include <errno.h>
#include "localmath.h"
static double
double xsqr;
double y;
- int neg = 0;
+ int neg = 1;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (x < 0) {
x = -x;
- neg = 1;
+ neg = -1;
}
if (cos_flag) {
- neg = 0;
+ neg = 1;
y = M_PI_2 + x;
}
else y = x;
y = y * M_1_PI + 0.5;
+ if (y >= DBL_MAX/M_PI) return 0.0;
+
/* Use extended precision to calculate reduced argument.
Here we used 12 bits of the mantissa for a1.
Also split x in integer part x1 and fraction part x2.
double x1, x2;
modf(y, &y);
- if (modf(0.5*y, &x1)) neg = !neg;
+ if (modf(0.5*y, &x1)) neg = -neg;
if (cos_flag) y -= 0.5;
x2 = modf(x, &x1);
x = x1 - y * A1;
}
if (x < 0) {
- neg = !neg;
+ neg = -neg;
x = -x;
}
y = x * x;
x += x * y * POLYNOM7(y, r);
- return neg ? -x : x;
+ return neg==-1 ? -x : x;
}
double
int negative = x < 0;
double y = negative ? -x : x;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (! cosh_flag && y <= 1.0) {
/* ??? check for underflow ??? */
y = y * y;
/* $Header$ */
#include <math.h>
+#include <float.h>
#include <errno.h>
#define NITER 5
int exponent;
double val;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (x <= 0) {
if (x < 0) errno = EDOM;
return 0;
}
+ if (x > DBL_MAX) return x; /* for infinity */
+
val = frexp(x, &exponent);
if (exponent & 1) {
exponent--;
/* $Header$ */
#include <math.h>
+#include <float.h>
+#include <errno.h>
#include "localmath.h"
double
0.49819433993786512270e-6
};
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (negative) x = -x;
/* ??? avoid loss of significance, error if x is too large ??? */
y = x * M_2_PI + 0.5;
+ if (y >= DBL_MAX/M_PI_2) return 0.0;
+
/* Use extended precision to calculate reduced argument.
Here we used 12 bits of the mantissa for a1.
Also split x in integer part x1 and fraction part x2.
#include <float.h>
#include <math.h>
+#include <errno.h>
#include "localmath.h"
double
};
int negative = x < 0;
+ if (__IsNan(x)) {
+ errno = EDOM;
+ return x;
+ }
if (negative) x = -x;
if (x >= 0.5*M_LN_MAX_D) {