HELP: Floating point overflow (possible OT)

H

Hamish Dean

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
 
D

David Fisher

Hamish Dean said:
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
 
M

Marc Rohloff

Hamish Dean said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top