Floating point exceptions

Tim Rowledge rowledge at interval.com
Fri Mar 19 22:17:09 UTC 1999


I'm having trouble with floating point class initialization. Hopefully somebody
reading this is knowledgable enough to help me solve  the problem.

Float class>initialize creates a bunch of constants like Pi, MaxVal and so on.
No problem there, but attempting to execute things like
	Infinity _ MaxVal * MaxVal
causes a floating point exception and program exit.

On the face of it, I'm not surprised; after all, we've just carefully found the
maximum possible float and now we square it. Of course it overflows! However,
Sq on W95 does not cause an exception, and presumably nor does Mac since I've
heard no complaints from Mac users filing in the recent updates
(B3DExponentTable causes a similar exception).

Is it really the case that the float libraries just ignore errors like
overflow? Is there some switch being set somewhere in the PC/MAc platform code
that I haven't seen? Should Sq code assume that it is ok to square Float
MaxVal? Does ANSI/IEEE allow for this? Do unix VMs have similar trouble?

tim

-- 
Software is mind work.  Having the right frame of mind is essential.
Tim Rowledge:  rowledge at interval.com (w)  +1 (650) 842-6110 (w)
 tim at sumeru.stanford.edu (h)  <http://sumeru.stanford.edu/tim>





More information about the Squeak-dev mailing list