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

sum in waterfall chart is not calculated correctly #4954

Closed
iddofontijn opened this issue Jan 25, 2016 · 2 comments
Closed

sum in waterfall chart is not calculated correctly #4954

iddofontijn opened this issue Jan 25, 2016 · 2 comments
Assignees

Comments

@iddofontijn
Copy link

See this jsfiddle.

Somehow 0.0000000000002 is added to the sum. I've also seen a case where this amount is extracted from the sum.

@pawelfus
Copy link
Contributor

This is issue with floating point numbers in JS, for example run in the console:

 0.4 - 0.3

It will return:

0.10000000000000003

@TorsteinHonsi
Copy link
Collaborator

@jon-a-nygaard We have an internal function called correctFloat for this purpose. Check out how we have used it in the past, then apply it for example on the waterfall sum. Check out intermediateSum also.

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

No branches or pull requests

4 participants