From owner-freebsd-questions Sat Dec 31 13:25:51 1994 Return-Path: questions-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id NAA23097 for questions-outgoing; Sat, 31 Dec 1994 13:25:51 -0800 Received: from cats.ucsc.edu (root@cats-po-1.UCSC.EDU [128.114.129.22]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id NAA23091 for ; Sat, 31 Dec 1994 13:25:50 -0800 Received: from scruz.ucsc.edu by cats.ucsc.edu with SMTP id NAA00928; Sat, 31 Dec 1994 13:25:39 -0800 Received: from osprey by scruz.ucsc.edu id aa03737; 31 Dec 94 14:21 PST Received: (from markd@localhost) by Grizzly.COM (8.6.9/8.6.9) id NAA08436; Sat, 31 Dec 1994 13:08:16 -0800 Date: Sat, 31 Dec 1994 13:08:16 -0800 From: Mark Diekhans Message-Id: <199412312108.NAA08436@Grizzly.COM> To: rivers%ponds@ncren.net, feisal@ldc.uwi.tt In-reply-to: <199412302104.QAA03529@ponds.UUCP> (message from Thomas David Rivers on Fri, 30 Dec 1994 16:04:19 -0500) Cc: freebsd-questions@freebsd.org Subject: Re: Behavior of sqrt on errors. Sender: questions-owner@freebsd.org Precedence: bulk > >> On FreeBSD, > >> > >> sqrt (-3.0); > >> > >> generates a SIGFPE. On all other systems I have encountered, it calls > >> matherr with a DOMAIN error. Can anyone more knowledgeable about the > >> ANSI standard comment if this correct ANSI behavior or a bug? .... >Thomas David Rivers writes: > Hmm.. I wonder what Tcl does under BSD on the VAX? The man page would >imply that either it hasn't been ported there, or doesn't work. I havn't seen a vax in years, so I can't try it. > I would change Tcl to catch the SIGFPE and check errno. Yea, thats one solution I have thought of, but eventually the library should probably be fixed. Its a fairly painful compatibility problem. > Also, I wonder what the Sun libm does... it may act differently than >the BSD version. If so, you could link Tcl with that libm instead. Which library is this? From a quick look at the source, the libm on the system comes from the usr/src/lib/msun directory, and it has the problem. There is also a usr/src/lib/libm directory, from glancing at the source, it prechecks arguments before executing the floating point instructions. However, its doesn't appear to be built as part of FreeBSD 2.0. >Feisal Mohammed writes: > >I use RLaB (a Matlab-like prog) under SunOS and also FreeBSD. The >differences of the implementation causes the floating pt. errors >to be handled less cleanly, e.g. 0/0 returns NAN on SunOS and >a floating exception on FreeBSD, same for sqrt(). Clearly the >better way is through the use of matherr as in SunOS. This also breaks the Elk Scheme interpreter... Thanks for the information, Mark