473,385 Members | 1,766 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,385 software developers and data experts.

IEEE 754 floating-point "exception" -> C++ exception

Greetings,

Using gcc (GCC) 3.3.3 (cygwin special) on Win2K

Does anyone know if there is a convenient mechanism to cause a C++
exception to be thrown whenever a IEEE 754 floating-point "exception"
is raised?

Currently I a check the FPU status word wherever I wish to test for FP
errors and throw a C++ exception accordingly. This is fine; but
(particularly for testing/debugging) it would be useful to be able to
trap FP errors _wherever_ they might ocurr.

The GNU libc documentation
http://www.gnu.org/software/libc/man...xceptions.html
states that it is possible to enable traps for FP exceptions such that
an FP exception generates a SIGFPE signal. One solution then might be
to define a handler for SIGFPE that throws an exception - however, I
suspect signal handlers and C++ exceptions may not play together
nicely... In any case neither the GNU libc documentation (nor gcc
docs) suggest how to enable FP trapping.

Any hints gratefully accepted,

--
Lionel B
Jul 22 '05 #1
0 1561

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Grant Edwards | last post by:
I've read over and over that Python leaves floating point issues up to the underlying platform. This seems to be largely true, but not always. My underlying platform (IA32 Linux) correctly...
0
by: Ahsan | last post by:
Exception Application Block creates a Exception GUID that gets saved in the sink e.g. application log. How do I show this to a user on the web, so the user can use it as a reference when calling...
2
by: Lionel B | last post by:
System: Pentium 4, Win32, gcc 3.3.3 cygwin Does anyone know of a mechanism whereby C library functions can be made to throw a (C++) exception in case a call fails? This would obviate having to...
13
by: Markus Elfring | last post by:
Do you know a class library that can convert the error/return codes that are listed in the standard header file "errno.h" into a well-known exception hierarchy? Did anybody derive it from...
24
by: hjbortol | last post by:
Hi! Is the expression "a >= b" equivalent to "a - b >= 0" in C/C++? Is this equivalence an IEEE/ANSI rule? Or is this machine/compiler dependent? Any references are welcome! Thanks in...
33
by: Nick Maclaren | last post by:
The numerical robustness of Python is very poor - this is not its fault, but that of IEEE 754 and (even more) C99. In particular, erroneous numerical operations often create apparently valid...
2
by: Rainer Queck | last post by:
Hi NG, what happens if a exception in a lock block occures? lock(myObject) { dothis(); dothat(); }
19
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.