Re: Divide by Zero

Kevin Jones <[email protected]> Tue, 26 Feb 2008 10:18:29 +0000
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
I always understood this to be a feature of Intel processors. In the
old days (writing native code), floating point went to the FPU, which,
in the very old days, was a separate chip. This handled float divide
by zero and returned NaN. While the main CPU which handles integer
division threw an exception.

IIRC you can change this behavior with a setting in the registry,
although it's been about 12 years since I tried it and never on CLR,

Kevin

On Tue, Feb 26, 2008 at 9:28 AM, Per Bolmstedt
<[email protected]> wrote:
> On Tue, 26 Feb 2008 10:35:15 +0100, Frans Bouma <[email protected]> wrote:
>
>  >> In a little more than a nutshell, why does the CLR only throw a divide by
>  >> zero exception for integers?
>  >
>  > I think because, if I recall correctly, a floating point number is
>  > always an approximation, so you can have a floating point value
>  > which seems 0 but actually isn't.
>
>  I disagree. PositiveInfinity, for example, is not an approximation. It's
>  really infinity.
>  http://msdn2.microsoft.com/en-us/library/system.double.positiveinfinity.aspx
>
>  I found this concisely helpful:
>  http://grouper.ieee.org/groups/754/faq.html#exceptions
>
>  Couldn't it be seen as that decimal/integer have been simplified in the CLR
>  (for programmers), whereas single/double retain their complexity (for
>  mathematicians)?
>
>
>
>  ===================================
>  This list is hosted by DevelopMentor(R)  http://www.develop.com
>
>  View archives and manage your subscription(s) at http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com