paul womack twisted the bytes to say:


 paul> Bart.van.Andel wrote:
 >> Although I'm not really into this code, shouldn't a divide by zero
 >> result in NAN instead of INF?

 paul> According to this:

 paul> http://en.wikipedia.org/wiki/Division_by_zero

 paul> It's well defined, and works as you would hope:

Yes, try this:

----------------------------------------------------------------------
#include <stdio.h>
#include <math.h>
#include <assert.h>

int main(void)
{
  
  double x = 0;

  double y;

  y = 1/x;
  printf("hello world [%f]\n", y);
  assert(isinf(y));
  assert(isnan(y));
}
----------------------------------------------------------------------
 paul> IEEE floating-point standard, supported by almost all modern
 paul> processors, specifies that every floating point arithmetic
 paul> operation, including division by zero, has a well-defined
 paul> result. In IEEE 754 arithmetic, a รท 0 is positive infinity when
 paul> a is positive, negative infinity when a is negative, and NaN
 paul> (not a number) when a = 0. The infinity signs change when
 paul> dividing by -0 instead. This is possible because in IEEE 754
 paul> there are two zero values, plus zero and minus zero, and thus
 paul> no ambiguity.

   BugBear

 paul> 

-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

--
Daniel M. German                  "I'm crazy, but I'm not stupid"
                                   Jackie Chan
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to 
hugin-ptx-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---

Reply via email to