boostorg / boostorg/accumulators

issue with rolling mean

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
26
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Hi All,
This is reiteration of the old stackoverflow question. Rolling mean seems not working correctly with unsigned integers. My system: Mac OS, High Sierra, the latest brew updates.

// g++ -std=c++11 -o accum_test accum_test.cpp
Sample file is attached.
[accum_test.txt](https://github.com/boostorg/accumulators/files/2469540/accum_test.txt)

OUTPUT:

***** Signed integers *****
9 actualMean: 9.0000000000000000
8 actualMean: 8.5000000000000000
7 actualMean: 8.0000000000000000
5 actualMean: 7.2500000000000000
6 actualMean: 7.0000000000000000
4 actualMean: 6.0000000000000000
3 actualMean: 5.0000000000000000
2 actualMean: 4.0000000000000000
1 actualMean: 3.2000000000000002
0 actualMean: 2.0000000000000000
0 actualMean: 1.2000000000000000
0 actualMean: 0.6000000000000000
0 actualMean: 0.2000000000000000
0 actualMean: -0.0000000000000001
0 actualMean: -0.0000000000000001
0 actualMean: -0.0000000000000001

***** Unsigned integers *****
9 actualMean: 9.0000000000000000
8 actualMean: 8.5000000000000000
7 actualMean: 8.0000000000000000
5 actualMean: 7.2500000000000000
6 actualMean: 7.0000000000000000
4 actualMean: 858993465.2000000476837158
3 actualMean: 1717986923.4000000953674316
2 actualMean: 2576980381.6000003814697266
1 actualMean: 3435973840.0000004768371582
0 actualMean: 4294967298.0000000000000000
0 actualMean: 5153960756.3999996185302734
0 actualMean: 6012954215.0000000000000000
0 actualMean: 6871947673.8000001907348633
0 actualMean: 7730941132.8000001907348633
0 actualMean: 7730941132.8000001907348633
0 actualMean: 7730941132.8000001907348633

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by compiling and running the mentioned accum_test.cpp with the attached accum_test.txt using the shown C++11 command. Compare the signed and unsigned rolling-mean paths, then inspect the relevant Boost.Accumulators implementation to identify why unsigned input produces the displayed values. Done means unsigned rolling means behave consistently with the signed case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.