From owner-freebsd-stable Sat Sep 2 10:32:40 2000 Delivered-To: freebsd-stable@freebsd.org Received: from rr.com (rdu25-12-060.nc.rr.com [24.25.12.60]) by hub.freebsd.org (Postfix) with ESMTP id 8274937B423 for ; Sat, 2 Sep 2000 10:32:36 -0700 (PDT) Received: (from rhh@localhost) by rr.com (8.9.3/8.9.3) id NAA18330; Sat, 2 Sep 2000 13:35:27 -0400 (EDT) (envelope-from aa8vb@nc.rr.com) Date: Sat, 2 Sep 2000 13:35:27 -0400 From: Randall Hopper To: stable@freebsd.org Subject: pow() ERANGE bug Message-ID: <20000902133527.A18306@nc.rr.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline User-Agent: Mutt/1.2i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --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 #include #include #include 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