Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-05-16 10:39:30


 

>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Matthias Schabel
>Sent: 02 May 2007 19:30
>To: boost_at_[hidden]; boost-announce; boost-users
>Subject: [boost] [math toolkit] Review results

>1) Error handling is an issue that arises because this library is at
>the frontier between traditional numerical libraries and a
>(hopefully) new breed of such libraries that utilize modern
>programming techniques and facilities. Jeff Garland suggested that
>the default behavior should be to throw an exception, with errno
>being an option enabled by macro.

Given a macro

#define BOOST_MATH_THROW_ON_ALL_ERRORS

to switch all the macros 'on'

it would seem easy enough to switch to C++ exception handling state.
I am unclear why the default should be one way or the other, and it's a hassle to change it, so I propose to leave as is.

> It would also be nice to have more
>granular control over which instances throw exceptions and which do
>not (so, for example, a user could choose to ignore denormals).

\tools\error_handling.hpp appears to me to provide control, for example, of denormals though BOOST_MATH_THROW_ON_DENORM_ERROR

If BOOST_MATH_THROW_ON_DENORM_ERROR is not defined, then errno is NOT set,
so it is effectively ignored.

We don't have a std exception type for denorming, so underflow_error is used instead.

> It was also suggested that additional, more transparent exceptions be
>provided for cases such as failure to converge rather than reusing
>tools::logic_error.

The standard exception classes seem rather ill-defined (ill-conceived even?) to me and I can't see a standard exception that fits
the bill for 'failed to converge'.

"failed to converge" seems a run-time error, so would std::range_error, be the least unsuitable (neither under nor overflow_error
seem right)?

Or does anyone have a better suggestion?

Paul

---
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS
pbristow_at_[hidden]
 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk