This seems to be a bug.  According to the man page:

   The functions exp(), expm1(), pow() detect if the computed value will
   overflow, set the global variable errno to ERANGE, and ...


But it doesn't set errno to ERANGE on overflow.

I'll wait for a day on the PR in case someone knows better.

Example:  The attached code generates:  Inf  0

The output should be:  Inf 34    (34 is ERANGE)

Randall

-- 
Randall Hopper
[EMAIL PROTECTED]
#include <math.h>
#include <stdio.h>
#include <errno.h>
#include <ieeefp.h>

main()
{
   fpsetmask(0);
   printf( "%g\n", pow(1e300,2) );
   pow(1e300,2);
   printf( "%d\n", errno );
}

Reply via email to