Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with rolling mean #16

Open
ghost opened this issue Oct 11, 2018 · 0 comments
Open

issue with rolling mean #16

ghost opened this issue Oct 11, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2018

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants