473,795 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Graceful error recovery with arithmetic

Hi there,
I'm having trouble making some code do a "graceful" recovery for
mathematical operations. Certain functions e.g. log10, will call
"matherr" and provides an avenue for intervention in a result.

How can I do the same in a portable fashion for arithmetic operations?
For example, catching dividing by zero using scalars (int's,doubles
etc.)?

Is there a standard way of getting C++ to throw some kind of
std::exception when a math-error results? Is there any standard
implementations for this somewhere?

Thanks,
Martin

Aug 4 '05 #1
1 1345
mmacrobert wrote:
I'm having trouble making some code do a "graceful" recovery for
mathematical operations. Certain functions e.g. log10, will call
"matherr" and provides an avenue for intervention in a result.

How can I do the same in a portable fashion for arithmetic operations?
You can't. The only portable way is to _prevent_ it instead of _dealing_
with it when it's happened.
[..]

Aug 4 '05 #2

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

Similar topics

3
1444
by: Jacob H | last post by:
Hello all, I'm nearing the completion of my first graphical console game and my thoughts have turned to the subject of gracefully handling runtime errors. During development I like to not handle exceptions, so that program execution will halt and I can immediately read the traceback to see what's up. Once the bugs are more or less worked out, I have a system ready wherein any exceptions are caught and an attempt is made to write the...
5
5498
by: Udy | last post by:
Hi, We have a custom application used by a customer on DB2 8.1.5 AIX 5.1, we have tested it with 8.1.0 AIX 5.1 and everything works fine. But with 8.1.5 we get the above error. The other applications connecting to other instances of the database works fine. lsattr -E -l sys0 | grep maxuproc gave the output maxuproc 4096
5
3886
by: NG | last post by:
Hi, We are having DB2-V7.2 DB on AIX 5.2 machine. Recently we upgraded our system to fixpack 13 and activated activate AIX asynchronous IO function. Our DB is going to crash recovery with this error 0xFFFFF707. I have attached the related details. Any suggestions is much appreciated.
74
7488
by: lovecreatesbeauty | last post by:
My small function works, but I have some questions. And I want to listen to you on How it is implemented? 1. The function does not check if parameter x is larger or smaller than parameter y. 2. Is it better to use unsigned int or unsigned long as the type of parameters x and y? This change may remove the if statement. More comments are still welcome.
6
9637
by: p175 | last post by:
2006-08-14-17.46.13.656000-240 I1472H436 LEVEL: Warning PID : 1452 TID : 336 PROC : db2syscs.exe INSTANCE: DB2 NODE : 000 DB : SQ4V6 APPHDL : 0-9 APPID: *LOCAL.DB2.060814214011 AUTHID : DB2ADMIN FUNCTION: DB2 UDB, Self tuning memory manager, stmmEnforceMinSizeConstraints, probe:2089 MESSAGE : Unable to find donor to satisfy minSize constraint Does...
3
11193
by: danceli | last post by:
"The log file for database is full. Back up the transaction log for the database to free up some log space." Now I only know this way to deal with that manually, Step1. in option , chance Recovery model from FULL to Simple. Step2: go to task to manually shrink the log file Step3: Change recovery model back from simple to FULL. But by this way, I could get same problem again, the log file is fill,
3
10746
by: jer006 | last post by:
Hi I am writing a select statement that has an arithmetic function inside a case statement that uses logic to decide whether to divide or multiply and when I run the arithmetic statements outside the case statement they work fine, but blow up with an overflow error in the case statement. The select looks like: SELECT a.acct_cd, a.crrncy_cd, a.mkt_val, c.rate,
0
3800
by: pavankumarveera | last post by:
how to unblock the CF below error what was the solution. GES: Potential blocker (pid=282) on resource CF-00000000-00000000; enqueue info in file /exlibris/app/oracle/admin/meta4/bdump/meta4_arc0_22455.trc Killing enqueue blocker (pid=282) on resource CF-00000000-00000000 by killing session 189.549GES: Potential blocker (pid=8833) on resource CF-00000000-00000000;
0
2071
by: Winder | last post by:
Computer Data Recovery Help 24/7 Data recovering tools and services is our focus. We will recover your data in a cost effective and efficient manner. We recover all operating systems and media. Call for a free consultation. http://a.uuload.com/Computer-Data-Recovery.htm LiveVault's Online Recovery Service Protect vital data with LiveVault's offsite backup and data storage. http://a.uuload.com/Computer-Data-Recovery.htm
0
9522
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10448
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10167
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9046
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7544
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2922
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.