here are some test i made to check a float/double zero division. It seems that ? and AsString() causes the app to hang. There´s also a situation where floats and doubles behave different.
Code: Select all
FUNCTION Start() A VOID
LOCAL x := 3.00 AS FLOAT // -3.00
LOCAL y := 0.00 AS FLOAT
LOCAL divResult AS FLOAT
/*
LOCAL x := 3.00 AS double // -3.00
LOCAL y := 0.00 AS double
LOCAL divResult AS double
*/
? "Start"
?
divResult := x / y
?
// ? divResult // the app hangs
// ? AsString ( divResult ) // the app hangs
// VAR c := AsString ( divResult ) // the app hangs
Console.WriteLine ( divResult ) // ok, +unendlich
// ? AsString ( x / y ) // the app hangs
// ? double.PositiveInfinity // the app hangs
? double.PositiveInfinity:ToString() // this works
?
Console.WriteLine ( double.PositiveInfinity ) // ok, +unendlich
// the comparison gives - correctly - true if a double is used,
// but false with a float.
IF divResult == double.PositiveInfinity
? "PositiveInfinity"
?
ENDIF
// ok , true - no matter if floats or doubles are used
// Seems to be the only way to detect infinity if floats are used.
IF Double.IsInfinity( divResult )
divResult := 9.99
ENDIF
? divResult // ok 9.99
?
RETURN
Karl-Heinz