libm/math: Don't modify __ieee754_pow return values in pow

The __ieee754 functions already return the right value in exception
cases, so don't modify those. Setting the library to _POSIX_/_IEEE_
mode now only affects whether errno is modified.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard via Newlib 2020-08-04 15:22:23 -07:00 committed by Corinna Vinschen
parent 98a4f8de47
commit e108d04432
2 changed files with 2 additions and 26 deletions

View File

@ -68,14 +68,6 @@ PORTABILITY
double z;
z=__ieee754_pow(x,y);
if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
if(isnan(x)) {
if(y==0.0) {
/* pow(NaN,0.0) */
/* Not an error. */
return 1.0;
} else
return z;
}
if(x==0.0){
if(y==0.0) {
/* pow(0.0,0.0) */
@ -93,20 +85,16 @@ PORTABILITY
if(isnan(z)) {
/* neg**non-integral */
errno = EDOM;
return 0.0/0.0;
} else {
/* pow(x,y) overflow */
errno = ERANGE;
if(x<0.0&&rint(y)!=y)
return -HUGE_VAL;
return HUGE_VAL;
}
return z;
}
}
if(z==0.0&&finite(x)&&finite(y)) {
/* pow(x,y) underflow */
errno = ERANGE;
return 0.0;
}
return z;
#endif

View File

@ -34,14 +34,6 @@
float z;
z=__ieee754_powf(x,y);
if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
if(isnan(x)) {
if(y==0.0f) {
/* powf(NaN,0.0) */
/* Not an error. */
return 1.0f;
} else
return z;
}
if(x==0.0f){
if(y==0.0f) {
/* powf(0.0,0.0) */
@ -61,20 +53,16 @@
errno = EDOM;
/* Use a float divide, to avoid a soft-float double
divide call on single-float only targets. */
return 0.0f/0.0f;
} else {
/* powf(x,y) overflow */
errno = ERANGE;
if(x<0.0f&&rintf(y)!=y)
return -HUGE_VALF;
return HUGE_VALF;
}
return z;
}
}
if(z==0.0f&&finitef(x)&&finitef(y)) {
/* powf(x,y) underflow */
errno = ERANGE;
return 0.0f;
}
return z;
#endif