From owner-freebsd-hackers Sun Nov 5 13:47:39 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id NAA16071 for hackers-outgoing; Sun, 5 Nov 1995 13:47:39 -0800 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id NAA16066 for ; Sun, 5 Nov 1995 13:47:31 -0800 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id IAA15439; Mon, 6 Nov 1995 08:44:48 +1100 Date: Mon, 6 Nov 1995 08:44:48 +1100 From: Bruce Evans Message-Id: <199511052144.IAA15439@godzilla.zeta.org.au> To: freebsd-hackers@freebsd.org, markd@grizzly.com Subject: Re: NPX still broken in 2.1.0-951104-SNAP... Sender: owner-hackers@freebsd.org Precedence: bulk >It appears (from looking at the code) that the floating point exception >register is still broken in the latest SNAP. I bug reported this eons ago >against 2.0, it generated a bit of discussion and I believe I got a response >to the bug report saying it was fixed. This breaks pretty much any program Scheduled to be fixed. In 2.2 :-(. >that wants to get a status back from the floating point math functions instead >of a core dump. Tcl is most notable, but it breaks several other packages as >well. The tcl port has a patch to set the exception mask to ~0. >This program should not core dump: >#include >#include >main () >{ > printf ("acos (2.0) = %g\n", acos (2.0)); >} >Please fix this before releasing, its a big pain for us portable >software maintainers. This patch fixed it for me: >*** sys/i386/include/npx.h.ORG Tue Jan 17 21:51:47 1995 >--- sys/i386/include/npx.h Sat Jan 21 12:56:44 1995 >*************** >*** 133,139 **** > #define __INITIAL_NPXCW__ __iBCS_NPXCW__ > #endif > #else >! #define __INITIAL_NPXCW__ __BDE_NPXCW__ > #endif > > #ifdef KERNEL >--- 133,139 ---- > #define __INITIAL_NPXCW__ __iBCS_NPXCW__ > #endif > #else >! #define __INITIAL_NPXCW__ __BETTER_BDE_NPXCW__ > #endif > > #ifdef KERNEL This still fails for more-portable software that sets errno to 0 before calling every math function and checks for errno being ERANGE or EDOM after the call (this is the only error reporting mechanism guaranteed in ANSI C). You can fix this by changing CFLAGS in libc/msun/Makefile to the POSIX/ANSI setting recommended there (-D_POSIX_MODE), but then acos(2.0) will return a stupid value (0 instead of NaN). Bruce