Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2671: Calculation overflow for the 4th moment
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-04 17:14:00
#2671: Calculation overflow for the 4th moment
-------------------------------------+--------------------------------------
Reporter: m.de.wever_at_[hidden] | Owner: eric_niebler
Type: Bugs | Status: closed
Milestone: Boost 1.38.0 | Component: accumulator
Version: Boost 1.37.0 | Severity: Showstopper
Resolution: wontfix | Keywords:
-------------------------------------+--------------------------------------
Changes (by eric_niebler):
* status: new => closed
* resolution: => wontfix
Comment:
The moment returns a double even for integral sample types because of the
division at the end. The additions during the accumulation phase are
integral, and so they overflow. Adding overflow checks would slow down the
common case, so I'm disinclined to add it unconditionally. Steven is
right, the easiest solution is for you to use doubles.
The larger issue is how to handle things like overflow, underflow, divide-
by-zero, NaN propagation, etc., throughout the Accumulators library (and
beyond to all the math-related libraries in Boost (and beyond to the
standard library)). One possibility would be to add checked arithmetic as
a policy. Another possibility is to specify the sample type as
checked<int> or something. It's probably worth starting such a discussion
on the Boost list. I'm sure John Maddock would have some useful insights.
I'm resolving this bug as "wontfix" and will open a separate feature
request ticket for better control over error-handling in Accumulators.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2671#comment:3> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC