From: br5an AT aol DOT com (Br5an) Newsgroups: comp.os.msdos.djgpp Subject: Re: Floating point => int Date: 10 Oct 1997 22:57:41 GMT Lines: 21 Message-ID: <19971010225701.SAA11869@ladder01.news.aol.com> NNTP-Posting-Host: ladder01.news.aol.com Organization: AOL http://www.aol.com References: <343E7D7B DOT 9CE55810 AT worldonline DOT nl> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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