Hi Mike,
"inclusive" - maybe an "almost mistake" ? (and confusing imo)
----------------------------
Uses "Console"
Sub test(x As Integer) As Single
If (x<>0) And (1/x < 1) Then test=Sqr(x)
End Sub
PrintL test(7)
PrintL test(6)
PrintL test(0)
WaitKey
--------------------------------------
crashes of course -- here the reason is obvious, but it may be (very , very ) well hidden ....
.. and on top of this , logically , we may think .. "but I excluded x=0 , what happened ?? "
in Lisp the forcing into strict evalution may make a (very, very) little sense :
after all, one can include something to catch the exception ...
(when NaN? (print "Sorry, don't know how to handle this") (wait-for-human-help) )
it will not crash .. it's even possible to define things as :
inf + number = inf
inf + inf = inf
inf * inf = inf
inf / inf = NaN (most of the time, there may be a solution -- needs human interaction )
0 * inf = NaN etc ....
after all it's a programmable programming language -- getting O/T oops ,
best Rob
Bookmarks