473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1581

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

Similar topics

11
2149
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 handles 1.0/0.0 and 0.0/0.0 according to the IEEE 754 standard, but Python goes out of its way to do the wrong thing. 1/0 is defined by the standard...
0
1220
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 in for support. Regards Ahsan
2
1507
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 check the results of function calls individually at the point of call. I would also be nice to be able to specify that (some) floating point IEEE...
13
3867
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 "std:runtime_error"? Regards, Markus
24
3590
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 advance, Humberto.
33
2424
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 numbers, and the NaN state can be lost without an exception being raised. For example, try int(float("nan")). Don't even ASK about complex, unless...
2
6459
by: Rainer Queck | last post by:
Hi NG, what happens if a exception in a lock block occures? lock(myObject) { dothis(); dothat(); }
19
3586
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 starting a new one] I'd still like to finish this rounding mess. As a startup lemma we can take that VK is the worst programmer of all times and...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.