Re: Divide by Zero

Richard <[email protected]> Tue, 26 Feb 2008 10:41:05 -0000
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
The .Net CLR *promises* that the floating point format will be the IEEE
floating point standard.  That is where the behavior comes from.

The Intel FPU may well have implemented that standard too.

Cheers,

- Richard

[email protected]
www.dynamisys.co.uk
Land line +44 1793 731225
Mobile +44 7732 971786

-----Original Message-----
From: Discussion of development on the .NET platform using any managed
language [mailto:[email protected]] On Behalf Of Kevin Jones
Sent: 26 February 2008 10:18
To: [email protected]
Subject: Re: [DOTNET-CLR] Divide by Zero

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 DevelopMentorR  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