Date: Mon, 4 Sep 2000 08:09:15 -0400 (EDT) From: aa8vb@nc.rr.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/21024: pow() ERANGE bug Message-ID: <200009041209.IAA01191@rr.com>
next in thread | raw e-mail | index | archive | help
>Number: 21024 >Category: bin >Synopsis: pow() ERANGE bug >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 04 05:10:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Randall Hopper >Release: FreeBSD 3.4-RELEASE i386 >Organization: self >Environment: Stock 3.4-RELEASE. >Description: 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 ... However, pow() does not set errno to ERANGE on overflow. >How-To-Repeat: Example: The attached code generates: Inf 0 The output should be: Inf 34 (34 is ERANGE) #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 ); } >Fix: Please update the pow() function to set errno on overflow. Might also check other likely suspects such as exp() and expm1(). --Thanks. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009041209.IAA01191>