Fix a problem where libm compiled under 5.X would depend on features

that are only in libc.so.5.  This broke some 4.X applications linked
to libm and run under 5.X.

Background:
In C99, isinf() and isnan() cannot be implemented as regular
functions.  We use macros that call libc functions in 5.X, but for
libm-internal use, we need to use the old versions until the next
time libm's major version number is bumped.

Submitted by:	bde
Reported by:	imp, kris
This commit is contained in:
David Schultz 2003-10-27 01:28:07 +00:00
parent 400911ccdc
commit 7a773faadc
2 changed files with 8 additions and 2 deletions

View File

@ -23,6 +23,9 @@ static char rcsid[] = "$FreeBSD$";
#include "math.h"
#include "math_private.h"
/* XXX lost declaration of this and isinf() in math.h but still have funcs. */
int (isnan)(float x);
#ifdef _SCALB_INT
double
__ieee754_scalb(double x, int fn)
@ -34,7 +37,7 @@ __ieee754_scalb(double x, double fn)
#ifdef _SCALB_INT
return scalbn(x,fn);
#else
if (isnan(x)||isnan(fn)) return x*fn;
if ((isnan)(x)||(isnan)(fn)) return x*fn;
if (!finite(fn)) {
if(fn>0.0) return x*fn;
else return x/(-fn);

View File

@ -20,6 +20,9 @@ static char rcsid[] = "$FreeBSD$";
#include "math.h"
#include "math_private.h"
/* XXX lost declaration of this and isnan() in math.h but still have funcs. */
int (isnanf)(float x);
#ifdef _SCALB_INT
float
__ieee754_scalbf(float x, int fn)
@ -31,7 +34,7 @@ __ieee754_scalbf(float x, float fn)
#ifdef _SCALB_INT
return scalbnf(x,fn);
#else
if (isnanf(x)||isnanf(fn)) return x*fn;
if ((isnanf)(x)||(isnanf)(fn)) return x*fn;
if (!finitef(fn)) {
if(fn>(float)0.0) return x*fn;
else return x/(-fn);