in reply to Re^3: Why is Zero not 0?
in thread Why is Zero not 0?

I checked out another node referenced in the post replies about -0.00. Oh my!!!! This is just getting to me. Integer math or not. Philosophically or mathematically I understand where you're coming from ... but logically it doesn't make sense. By having negative zero what you have is that the following statement is not truly factual

if($x==0){print "I'm ZERO!\n");

$x could come in as -0.00 or -9.049848394839e-14. We now have problems if your referring to say dollars and cents. I hear what you are saying ... I guess it is what it is.:o(

Replies are listed 'Best First'.
Re^5: Why is Zero not 0?
by Joost (Canon) on Feb 07, 2008 at 01:30 UTC

      Did you get the + and - swapped? Now comp(5, 4.5, 1) is false and comp(5, 4.5, -1) is true.

      Personally I prefer to use the good old standard mathematical way of expressing it:

      if (abs($x - $y) <= $tolerance) { print "$x and $y are 'equal'"; }

      lodin

Re^5: Why is Zero not 0?
by zentara (Cardinal) on Feb 05, 2008 at 11:10 UTC
    $x could come in as -0.00 or -9.049848394839e-14.

    It reminds me of the attempt to detect the soul, by weighing bodies before and after death. What a mess that concept is. :-)


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum