>  VAL1 = "43008E-112"
>  VAL2 = "43008E-108"
>  IF (VAL1 = VAL2) THEN
>     CRT "THIS IS STRANGE"
>  END
>
> It returns THIS IS STRANGE. Does anybody know why?

Easy!  UniVerse has a delightful feature called "wide zero" which says that
when you compare two floating point numbers, they will be treated as equal
if they are very close. The default value of this tolerance is about
2.91E-11 but it can be adjusted using the WIDE0 configuration parameter
(which opens a whole new topic as it is set as the first 32 bits of an IEEE
floating point value in hexadecimal!).

Wide zero is actually very useful as it simplifies some operations where
rounding errors may result in odd things way down the decimal places.


Martin Phillips
Ladybridge Systems
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB
+44-(0)1604-709200
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to