Fix error in powf for (-1.0, NaN) input

Message ID 20200302144023.1911-1-fabian.schriever@gtd-gmbh.de
State Accepted
Commit cef36220f247e02847ee4f39790b7debcc50a36b
Headers show
Series
  • Fix error in powf for (-1.0, NaN) input
Related show

Commit Message

Fabian Schriever March 2, 2020, 2:40 p.m.
Prevent confusion between -1.0 and 1.0 in powf. The corresponding
similar error was previously fixed for pow (see commit bb25dd1b)
---
 newlib/libm/math/ef_pow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.24.1.windows.2

Comments

Corinna Vinschen March 2, 2020, 3:46 p.m. | #1
On Mar  2 15:40, Fabian Schriever wrote:
> Prevent confusion between -1.0 and 1.0 in powf. The corresponding

> similar error was previously fixed for pow (see commit bb25dd1b)

> ---

>  newlib/libm/math/ef_pow.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/newlib/libm/math/ef_pow.c b/newlib/libm/math/ef_pow.c

> index 524e3f9b0..d9e85a95e 100644

> --- a/newlib/libm/math/ef_pow.c

> +++ b/newlib/libm/math/ef_pow.c

> @@ -79,7 +79,7 @@ ivln2_l  =  7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/

>      /* x|y==NaN return NaN unless x==1 then return 1 */

>  	if(FLT_UWORD_IS_NAN(ix) ||

>  	   FLT_UWORD_IS_NAN(iy)) {

> -	    if(ix==0x3f800000) return one;

> +	    if(hx==0x3f800000) return one;

>  	    else return nanf("");

>  	}

>  

> -- 

> 2.24.1.windows.2


Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Patch

diff --git a/newlib/libm/math/ef_pow.c b/newlib/libm/math/ef_pow.c
index 524e3f9b0..d9e85a95e 100644
--- a/newlib/libm/math/ef_pow.c
+++ b/newlib/libm/math/ef_pow.c
@@ -79,7 +79,7 @@  ivln2_l  =  7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
     /* x|y==NaN return NaN unless x==1 then return 1 */
 	if(FLT_UWORD_IS_NAN(ix) ||
 	   FLT_UWORD_IS_NAN(iy)) {
-	    if(ix==0x3f800000) return one;
+	    if(hx==0x3f800000) return one;
 	    else return nanf("");
 	}