473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

HELP: Floating point overflow (possible OT)

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
2 2212
"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Vinny | last post by:
I have a few floating point questions/issues I wish to ask. An answer or discussion would be nice too :) Any links discussion the subject would be nice too.. 1. How do I generate an underflow...
12
by: Dave Rahardja | last post by:
Does the C++ standard specify the behavior of floating point numbers during "exceptional" (exceptional with respect to floating point numbers, not exceptions) conditions? For example: double...
3
by: C. Sengstock | last post by:
Hi, i´ve got an iteration with random generated floating point numbers. During the iteration process sometimes the programm stops with the error: "floating point error: overflow" Is the...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
21
by: Allin Cottrell | last post by:
OK, I realize that what I am asking here is not likely to have a answer within the C standard. Nonetheless, it is not specific to any particular platform, so I'll hazard the question anyway. A...
3
by: Mark L Pappin | last post by:
<puts on Compiler Vendor hat> I've recently discovered that our compilers don't make any attempt to handle floating point overflow in add/subtract/ multiply/divide, with the result that...
4
by: jacob navia | last post by:
Hi people I continue to work in the tutorial for lcc-win32, and started to try to explain the floating point flags. Here is the relevant part of the tutorial. Since it is a difficult part, I...
15
by: arnuld | last post by:
Next month I will start to work on a C++ based Software named CAT++ which is going to provide FORTRAN like arrays in C++ and will be used within Scientific Community and hence will heavily depend...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.