Re: Division by zero



Hi Patricia,

I can't think of any specific algorithm, but there are definitely
situations where an external library supplies a / x but we need a
instead. So we have to multiply by x first. But when x is zero the
external library would return NaN and we can never retrieve a. The
exception being thrown or continuing to work with NaN can result in an
application crash...

If the hardware didn't set the result to NaN for dividing by zero, but
instead kept the value of a and set the Q exponent field to -1, we can
get a back after multiplying by zero. In other words (a / x) * x = a
for any value of x, including zero. This avoids the division by zero
exception and the result is not NaN. Note that a*Q^-1 is NaN, just like
the imaginary i is meaningless in the physical world. But just like i^2
does have a real value, a*Q^-1 becomes a real value again after
multiplying by zero.

Like I've said before, it's arguable that it's the programmer's
responsability to supply a when a is needed, and not a / x. But
mistakes are hard to completely eliminate, and it might be more
efficient to work with a / x most of the time. Testing and correcting
for x = 0 in software is possible, but slow.

Kind regards,

Nicolas


Patricia Shanahan wrote:
Nicolas.Capens@xxxxxxxxx wrote:
Hi all,

I have a theory to work with division by zero, and it might have some
use in computer science.

I got inspired by Dr. Anderson's 'nullity' number:
http://www.bookofparagon.com/News/News_00012.htm. But as far as I know
it doesn't solve any real problem. At the best he proves that by
allowing a nullity number off the real number line, 0^0 = 0 / 0, in
other words NaN = NaN unlike IEEE 754. I don't think that really helps
us. My proposal does solve actual division by zero problems.
...
One problem is that addition of numbers with different Q exponent can't
be defined in a useful way. Powers and roots are definable, but then
the Q exponents are no longer integers. For example the square root of
-4 / 0 is 2*i*Q^-0.5. This illustrates that i and Q are orthogonal,
thus defining a three-dimensional space. In this space 0^0 is still
undefined though.

Any thoughts about this?
...

If I remember correctly, the NaN and Infinity treatment in IEEE754 was
inspired not just by theory, but by real algorithms that had simpler,
more efficient representations with the extended numbers.

In the same spirit, can you identify some algorithms that would be
simplified by your Q numbers, given the restrictions?

Patricia

.



Relevant Pages

  • Re: Newbie to Forums, SIMD question
    ... Both of these converse most rapidly when x is near zero. ... mov ebx,ecx ... So far we've ignored zeros, denormals, infinities and NaNs. ... infinity or NaN, nor will it work for a negative x. ...
    (comp.lang.asm.x86)
  • Re: reading what you write
    ... I use a '*' format. ... The reader takes the err branch to 998. ... Normally zero was written out as 0.000000000. ... Some output was 'NaN'. ...
    (comp.lang.fortran)
  • Re: Im always a winner
    ... Divide by zero in any equation and you get ... so you can't just check it against a NaN you happen to have ... True, but then infinity isn't a number either, ...
    (alt.usage.english)
  • Re: Im always a winner
    ... If black is not a color then zero is not a number. ... Divide by zero in any equation and you get ... NaN is that it isn't equal to anything, including itself, so you can't ... opposite signs or subtract an infinite value from another with the ...
    (alt.usage.english)
  • Re: sparse matrices and eigenvalue computation
    ... Algorithms that use matrix-vector multiplications can ... easily take advantage of "sparsity" because of the reduced operation ... count when zero products are neglected. ...
    (sci.math.num-analysis)