From owner-freebsd-bugs Mon Sep 4 5:10: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A5C9D37B43F for ; Mon, 4 Sep 2000 05:10:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id FAA22922; Mon, 4 Sep 2000 05:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from rr.com (rdu25-12-060.nc.rr.com [24.25.12.60]) by hub.freebsd.org (Postfix) with ESMTP id 6AFE837B424 for ; Mon, 4 Sep 2000 05:06:19 -0700 (PDT) Received: (from rhh@localhost) by rr.com (8.9.3/8.9.3) id IAA01191; Mon, 4 Sep 2000 08:09:15 -0400 (EDT) (envelope-from rhh) Message-Id: <200009041209.IAA01191@rr.com> Date: Mon, 4 Sep 2000 08:09:15 -0400 (EDT) From: aa8vb@nc.rr.com Reply-To: aa8vb@nc.rr.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/21024: pow() ERANGE bug Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 #include #include #include 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