Floating point exceptions
Tim Olson
tim at jumpnet.com
Fri Mar 19 23:30:21 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.
What platform are you running on?
This shouldn't happen, at least under an ANSI-C / IEEE-754 compliant
system. The standard specifies that the default action for floating
point operation is to return the default results (rounding to nearest)
without raising exceptions. In the case of overflow above, it should
return Infinity (which is why the assignment is written that way in the
first place).
You (or some "helpful" system library) would have to specifically enable
exceptions in the VM to get the results you are seeing.
-- tim
More information about the Squeak-dev
mailing list
|