Results 1 to 4 of 4

Thread: Division by zero

Hybrid View

  1. #1
    New Member
    Join Date
    Apr 2005
    Posts
    10

    Re: Division by zero

    Not quite sure what you're getting at, but no, you can't get a returned value of 0 when the denominator is 0, because division by 0 is undefined.

    Reasons's easy....

    if n/d = r (r for result)

    then n=d * r

    if d=0

    then n=0 * r

    no value of r, even infinity, will bring you the original n, because 0 * r = 0 for all r

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: Division by zero

    Programatically, it is possible to do this without if statements. Just self-defeatingly long

    ((sgn(d)+1) mod 2) --> returns 0 for positive or negative d, 1 for d=0

    n/(d + (sgn(d)+1) mod 2)*n) - 1 * ((sgn(d)+1) mod 2)

    This means that:

    n/(d+0*n) - 1*0 for positive or negative numbers
    n/(0+1*n) - 1*1 for 0.


    Again, useless, but fun


    I don't know of any way you could do this mathematically, without the odd functions used above. It seems so simple, to remove that odd little thing there, but I can't think of any way of doing it. You might be able to use limits and some odd infinite sums creatively, but still. Oh well
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Re: Division by zero

    There are a few specialized problems for which logic provides a valid answer for zero divisors.

    Example: Calculation of angles using the Atn function. You want to know the angle given (X, Y), formally defined as Atn(Y/X)

    It is valid to compare X & Y
    • X > Y: Result = Atn(Y/X)

      Y > X: Result = pi/2 - Atn(X/Y) /// pi/2 when x = zero.

      X = Y: Result = pi/4
    Divison by zero is avoided. Note that for X = Y = 0, a pure mathematician would object, but assigning pi/4 is not unreasonable.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width