Date: Sat, 2 Sep 2000 13:35:27 -0400 From: Randall Hopper <aa8vb@nc.rr.com> To: stable@freebsd.org Subject: pow() ERANGE bug Message-ID: <20000902133527.A18306@nc.rr.com>
index | next in thread | raw e-mail
[-- Attachment #1 --]
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
aa8vb@nc.rr.com
[-- Attachment #2 --]
#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 );
}
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000902133527.A18306>
