NaN and -Infinity or Infinity

Blitz3D Forums/Blitz3D Programming/NaN and -Infinity or Infinity

LAB[au](Posted 2004) [#1]
Just pure curiosity. I messing up with some algos and sometimes after a few loops Blitz is returning NotaNumber, -Infinity or Infinity as values. Does someone knows exactly what are the conditions which provoke this values?

Thanks


Stevie G(Posted 2004) [#2]
Mainly division by 0 would give you a 'NaN' (Not a Number).


fredborg(Posted 2004) [#3]
Brrrr...Wrong :) Divison by zero gives +/-infinite, taking the square root of a negative number gives Nan.
a# = 0.0
Print  1.0/a
Print -1.0/a
Print  100000000000000000000.0*10000000000000000000.0
Print -100000000000000000000.0*10000000000000000000.0
Print Sqr(-1.0)
WaitKey()
End



Stevie G(Posted 2004) [#4]
Oops - forgot about imaginary numbers! :(


Floyd(Posted 2004) [#5]
In fact, division by zero is the most common reason for NaN.

Typically, the first such division produces an infinite value.
But then continued calculations with this infinite value result in NaN.

Expressions such as (Infinity-Infinity) and (Infinity/Infinity) are NaN.


Billamu(Posted 2004) [#6]
Trying to export from Blender to B3d will give you NaN.