Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 1994 13:08:16 -0800
From:      Mark Diekhans <markd@grizzly.com>
To:        rivers%ponds@ncren.net, feisal@ldc.uwi.tt
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Behavior of sqrt on errors.
Message-ID:  <199412312108.NAA08436@Grizzly.COM>
In-Reply-To: <199412302104.QAA03529@ponds.UUCP> (message from Thomas David Rivers on Fri, 30 Dec 1994 16:04:19 -0500)

next in thread | previous in thread | raw e-mail | index | archive | help
> >> 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 <rivers%ponds@ncren.net> 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 <feisal@ldc.uwi.tt> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199412312108.NAA08436>