Fixed a few more of the intrinsic functions

This commit is contained in:
Neil Brown 2009-01-25 22:30:07 +00:00
parent 062b47bad9
commit 0802d79d6c
2 changed files with 16 additions and 5 deletions

View File

@ -290,6 +290,13 @@ int main(int argc, char** argv)
testf(occam_ABS(INFINITY,""));
testf(occam_DABS(INFINITY,""));
testf(occam_SQRT(NAN,""));
testf(occam_DSQRT(NAN,""));
testf(occam_SQRT(INFINITY,""));
testf(occam_DSQRT(INFINITY,""));
testf(occam_SQRT(-1,""));
testf(occam_DSQRT(-1,""));
testf(occam_SCALEB(NAN,1,""));
testf(occam_DSCALEB(NAN,1,""));
testf(occam_SCALEB(INFINITY,1,""));

View File

@ -50,7 +50,7 @@ static inline REAL ADD_PREFIX(ABS) (REAL X, const char* pos) {
if (isfinite(X)) {
return F(fabs)(X);
} else {
occam_stop(pos,2,"Called ABS on non-finite value: %f",X);
occam_stop(pos,2,"Called (D)ABS on non-finite value: %f",X);
}
}
static inline REAL ADD_PREFIX(COPYSIGN) (REAL, REAL, const char*) occam_unused;
@ -62,7 +62,7 @@ static inline REAL ADD_PREFIX(DIVBY2) (REAL X, const char* pos) {
if (isfinite(X)) {
return F(scalbln)(X,-1);
} else {
occam_stop(pos,2,"Called DIVBY2 on non-finite value: %f", X);
occam_stop(pos,2,"Called (D)DIVBY2 on non-finite value: %f", X);
}
}
static inline INT ADD_PREFIX(FLOATING_UNPACK) (REAL, REAL*, const char*) occam_unused;
@ -90,7 +90,7 @@ static inline REAL ADD_PREFIX(MULBY2) (REAL X, const char* pos) {
if (isfinite(X)) {
return F(scalbln)(X,1);
} else {
occam_stop(pos,2,"Called MULBY2 on non-finite value: %f", X);
occam_stop(pos,2,"Called (D)MULBY2 on non-finite value: %f", X);
}
}
static inline REAL ADD_PREFIX(NEXTAFTER) (REAL, REAL, const char*) occam_unused;
@ -110,11 +110,15 @@ static inline REAL ADD_PREFIX(SCALEB) (REAL X, INT n, const char* pos) {
if (isfinite(X)) {
return F(scalbln)(X,n);
} else {
occam_stop(pos,2,"Called SCALEB on non-finite value: %f", X);
occam_stop(pos,2,"Called (D)SCALEB on non-finite value: %f", X);
}
}
static inline REAL ADD_PREFIX(SQRT) (REAL, const char*) occam_unused;
static inline REAL ADD_PREFIX(SQRT) (REAL X, const char* pos) {
return F(sqrt)(X);
if (isfinite(X) && X >= 0) {
return F(sqrt)(X);
} else {
occam_stop(pos,2,"Called (D)SQRT on invalid input: %f", X);
}
}