Re: [Boost-bugs] [Boost C++ Libraries] #2671: Calculation overflow for the 4th moment

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 09:20:56


#2671: Calculation overflow for the 4th moment
-------------------------------------+--------------------------------------
  Reporter: m.de.wever_at_[hidden] | Owner: eric_niebler
      Type: Bugs | Status: new
 Milestone: Boost 1.38.0 | Component: accumulator
   Version: Boost 1.37.0 | Severity: Showstopper
Resolution: | Keywords:
-------------------------------------+--------------------------------------

Comment(by m.de.wever_at_[hidden]):

 I did some more tests and the 4th moment returns a double when I use
 unsigned as template type. So I still consider it a bug.

 This example, from the library documentation, also leads me to believe the
 result type is a floating point type and it's save to use integer types.
 {{{
 accumulator_set<int, stats<tag::moment<2> > > acc1;

 acc1(2); // 4
 acc1(4); // 16
 acc1(5); // + 25
          // = 45 / 3 = 15

 BOOST_CHECK_CLOSE(15., moment<2>(acc1), 1e-5);
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2671#comment:2>
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