Mail Archives: djgpp/1997/10/12/19:31:31
Reinier Heeres wrote:
> Hi!
>A floating point exception seems to occur sometimes when I convert a
>float to an int.
>I use _control87() to make sure all the floating point exceptions,
>except for the invalid operation exception, are handled internally. If
I
>put the flag for the invalid operation exception on, my program seems
to
>hang...
If the float has a magnitude that is too large to represent
as an int, the exception may occur. One brute force
procedure is to do bounds checking on the float before
the conversion (perhaps this can be worked into the
bounds of a for(), with a bit of forethought, no pun intended).
Unless you want to mask the exception, or write an fp
exception handler, there aren't too many choices...
- Raw text -