[uClibc] hypot returns nan

Brian Gunnison Evolution brian at evolution.com
Fri Sep 19 21:30:56 UTC 2003


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20030919/8368dbce/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Brian R. Gunnison.vcf
Type: text/x-vcard
Size: 226 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20030919/8368dbce/attachment.vcf 


More information about the uClibc mailing list