"Mikael Svane" <
[hidden email]> wrote in message
news:a3n130$19jp1j$
[hidden email]...
> I am havin trouble using an ActiveX control that generates a floating
point
> exception ("Division by zero of 0.0") when I am calling a certain method.
> The strange thing is that other users of the same control aren't seeing
this
> (in VB or Delphi), or at least haven't reported it to the manufacturer of
> the control. Is it possible to use Process>>fpeMask: to prevent Dolphin
from
> seeing the exception, or doesn't this method work for ActiveX controls? If
> it should work, what is the argument for turning off division by zero
> exceptions?
Hmmm, I have seen this issue before with other floating point exceptions
such as underflow and overflow, which are not enabled by default in most
programming environments, but division by zero is odd, since that normally
is enabled by default. I don't think one would want to suppress it in
general.
Anyway you can mask out various FP exceptions by sending the active process
(that is the one making the calls, since the FP mask is stored on a
per-Process basis) the #fpeMask: message.
e.g (with the CRTConstants pool in scope)
oldMask := Processor activeProcess fpeMask: _EM_ZERODIVIDE | _EM_UNDERFLOW |
_EM_INEXACT | _EM_OVERFLOW | _EM_INVALID.
[(1.0/0.0) @ (0/0.0)] ensure: [Processor activeProcess fpeMask: oldMask]
Regards
Blair