By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

HELP: Floating point overflow (possible OT)

P: n/a
Hi. To explain this, i'll list some relevant info:

Prog1: A c++ dll, written by me.
Prog2: A c++ dll, written by a 3rd party.
Prog3: A c++ application, written by me.
Prog4: A delphi 7 application, written by me.
Prog5: A delphi 4 application, written by someone else.

Prog1 calls a function from Prog2:

try{
DoSomething() /*call to Prog2*/
}
catch(...){};
Prog3,4,5 all call the same function from Prog1, with the same input
variables.

Prog3,4 both run successfully, no issues.

Prog5 says "Floating point overflow". This occurs somewhere in the
DoSomething function, which I obtained from a 3rd party.

Is this not an exception?? how come catch(...){} does not handle this?

I am stumped as to how to fix this. Any advice appreciated.

Hamish


I've written a .dll in c++ (ProgA). At some point, ProgA
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Hamish Dean" <h.****@xtra.co.nz> wrote:
Prog5 says "Floating point overflow". This occurs somewhere in the
DoSomething function, which I obtained from a 3rd party.

Is this not an exception?? how come catch(...){} does not handle this?

I am stumped as to how to fix this. Any advice appreciated.


Sounds like a hardware exception as opposed to a "C++ Exception" ...

Under UNIX you can catch them with signal(). I think Windows has a special
form of try / catch ("__try" ?) - look up "Structured Exception Handling"
(SEH) ...

David F
Jul 22 '05 #2

P: n/a
"Hamish Dean" <h.****@xtra.co.nz> wrote in message news:<Fa********************@news.xtra.co.nz>...
Prog5 says "Floating point overflow". This occurs somewhere in the
DoSomething function, which I obtained from a 3rd party.

Is this not an exception?? how come catch(...){} does not handle this?

I am stumped as to how to fix this. Any advice appreciated.


Hamish,

The first thing is that exception handlng doesn't work well across DLL
calls. So a try / catch doesn't usually help.

Your problem looks like it might have something to do with the
configuration of the 8087 (floating point processor) control word.

You can use a function like:

function Get8087CW: word;
asm
FStCW [Result]
end;

To retrieve the control word and check its value under each situation.
It is a bit mask so you may want to convert it to hex.

If you have problems post the results here.

Marc
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.