Mail Archives: djgpp/1997/10/12/13:46:41
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...
>How can I solve this problem??? Should I use another way to convert my
>float to an int?
>Or should I check my float isn't equal to some value?
Reinier,
Sorry if I'm not quite understanding the problem. Here's
how I'd convert a float to an int in most cases.... iMyint = (int)fMyFloat;
or iMyint = (int)(fMyFloat + .5); if I wanted rounding. Hope that's
somewhat helpfull.
Br5an AT aol DOT com
- Raw text -