Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2000 22:56:21 +0100
From:      Martin Cracauer <cracauer@cons.org>
To:        Jeroen Ruigrok van der Werven <asmodai@bart.nl>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Alfred Perlstein <bright@wintelcom.net>, Doug Rabson <dfr@nlsystems.com>, Martin Cracauer <cracauer@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/i386/include npx.h
Message-ID:  <20000310225621.C20522@cons.org>
In-Reply-To: <20000310224053.B4626@lucifer.bart.nl>; from asmodai@bart.nl on Fri, Mar 10, 2000 at 10:40:53PM %2B0100
References:  <200003101756.JAA90710@freefall.freebsd.org> <Pine.BSF.4.21.0003102057080.79394-100000@salmon.nlsystems.com> <20000310133936.B14279@fw.wintelcom.net> <200003102122.QAA18594@khavrinen.lcs.mit.edu> <20000310224053.B4626@lucifer.bart.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
In <20000310224053.B4626@lucifer.bart.nl>, Jeroen Ruigrok van der Werven wrote: 
> -On [20000310 22:30], Garrett Wollman (wollman@khavrinen.lcs.mit.edu) wrote:
> ><<On Fri, 10 Mar 2000 13:39:36 -0800, Alfred Perlstein <bright@wintelcom.net> said:
> >
> >> Is there any reason for doing this other than so we can emulate
> >> linux's bog^H^H^H nifty ability to divide by zero?
> >
> >The fact that the IEEE standard says this is the default state.
> 
> My, does the IEEE encourage bad coding practices then.  If I understood
> the commit correctly.

The only good coding is to set the mask explicitly to what you need.
The default one is only for those applications that don't care.

If you know what you do, using the exceptional values is not "bad". It
can be faster (no checking), save space (no additonal status
indicators attached to FP values) and is very well defined by IEEE.
The only problem are bugs in gcc, math libraries and maybe the FPU, so
the real paranoid one should still prefer to test themself. For
generations of market researchers and scientists the behaviour of the
existing tools is good enough.
 
> Just for the less kernelsavvy types under us,
> 
> this commit make sures that my app won't segfault due to a division by
> zero, right?

Yes, plus underflow, overflow, illegal operations. Unfortunatly, some
serious errors (i.e. conversion to integer when the source FP value is
too big) are now also masked because the i387 FPU doesn't allow
the programmer to control them seperatly from "real" FP operations
that are caught softly due to the IEEE standard.

Do not ever convert a double/float to integer without a range check. 

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/
  Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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