Weird numerical behavior regarding zero

From: matthias_k (nospam_at_digitalraid.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 17:23:19 +0100

Hi,

I am currently implementing a solver for linear optimization problems
using the revised simplex method and I stumbled accross some strange
behavior regarding the treatment of the number 0.
I am not sure whether this is compiler or language related though.

The first problem is, that there are two representations of zero, namely
+0 and -0. Does IEEE for floating points allow this? Maybe I didn't
activate IEEE floating point numbers?
Anyway, this does have some very annoying consequences, since this
expression:
    x / -0 yields -inf (x is positive).

Which brings me to my second question. Shouldn't division by zero make
my computer go up in flames or so? Because, on my system (Arch Linux 0.7
i686) with my compiler (g++ 3.4.3), dividing by zero is allowed.
In fact, it yields +inf when dividing by +0 and -inf when dividing by
-0, given that the nominator (is that the english term for "Zähler"?) is
positive of course.

Any comments/ideas?

Regards,
Matthias



Relevant Pages

  • RE: access.query.overflow
    ... it turns out i was dividing by zero in some cases. ... You can set the field output size and type by using the various ... > type conversion functions though. ...
    (microsoft.public.access.queries)
  • RE: I am receiving an #Error in my query even after using Nz funct
    ... I seem to only be having the problem when I am dividing by zero. ... "Jerry Whittle" wrote: ... I have used an IIf statement, the Nz function, and even ran another query ...
    (microsoft.public.access.queries)
  • RE: I am receiving an #Error in my query even after using Nz funct
    ... I seem to only have the problem when I am dividing by zero. ... "Jerry Whittle" wrote: ... I have used an IIf statement, the Nz function, and even ran another query ...
    (microsoft.public.access.queries)
  • Re: Division by zero. Go ahead and laugh.
    ... >>like your systems to be consistent then forget about dividing by zero. ... Bob Kolker ...
    (sci.math)
  • Re: Weird numerical behavior regarding zero
    ... > I am currently implementing a solver for linear optimization problems ... > using the revised simplex method and I stumbled accross some strange ... > activate IEEE floating point numbers? ... Shouldn't division by zero make ...
    (comp.lang.cpp)

Loading