By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,130 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,130 IT Pros & Developers. It's quick & easy.

Graceful error recovery with arithmetic

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.