[uClibc] hypot returns nan

Jeffrey Baitis baitisj at evolution.com
Mon Sep 22 18:29:34 UTC 2003


Note that these results were with version 0.9.19

-Jeff

On Fri, 2003-09-19 at 14:26, Brian Gunnison wrote:
> Hi,
>  
> We are attempting an amazing amount of 3D math with uclibc,
> Algorithmics float emulation and a MIPSel target. 
>  
> One problem:
>  
> I found a bug in uclibc hypot(double x, double y). 
>  
>  
> double theta = hypot ( 0.0 , 0.0 );    //returns nan! uclibc error
>  
>  
> Given:
>  
>     double i[3];
>     i[0] = 0.0;
>     i[1] = 0.0;
>     i[2] = 0.0;
> 
> I tried to replace:
>  
>     double theta = hypot (hypot (i[0], i[1]), i[2]);    //returns nan!
> uclibc error
>  
> with
>  
>     double itheta1 = (i[0] * i[0]) + (i[1] * i[1]);
>     double theta1 = sqrt((itheta1 * itheta1) + (i[2] * i[2]));
>  
> the above generates a 
>  
> User defined Signal 1
> synchronously in the middle of a fprintf, but regardless of which one.
>  
> I replaced the above with a 
>  
>   double itheta = (i[0] * i[0]) + (i[1] * i[1]) + (i[2] * i[2]);
>   double theta = sqrt(itheta);
>  
> This has run successfully.
>  
> Strange!
>  
> The app is a single thread that logs results to a file. 
>  
> Brian
>  
>  
>  
> 
> ______________________________________________________________________
> 
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://uclibc.org/mailman/listinfo/uclibc
-- 
Jeffrey Baitis <baitisj at evolution.com>



More information about the uClibc mailing list