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>
next in thread | raw e-mail | index | archive | help
--0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="tst.c" #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 ); } --0OAP2g/MAC+5xKAE-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000902133527.A18306>