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

Counter not working for decimals #19

Open
kayman-mk opened this issue Oct 18, 2020 · 1 comment
Open

Counter not working for decimals #19

kayman-mk opened this issue Oct 18, 2020 · 1 comment

Comments

@kayman-mk
Copy link

Initial counter: 4105.123
Increment: 0.001

After incrementing the counter 5 times I expect to get the value 4105.128. But instead 4105.128000000001 is reported.
As far as I know implementing the counter as float will cause problems.
Quickfix: Math.round(counter*1000)/1000 would fix this. But the number of decimals has to be calculated to set the correct factor (1000 for 3 decimals).

@dkern
Copy link
Owner

dkern commented Oct 19, 2020

It's a known issue while working with numbers like that in JS. I would not know a good fix, without a setting for desired decimals. But I don#t think I like to add that, because it will confuse most users. So for now, I would say, use it with decimals at your own risk. ;)

A fix for you could also be to add a JS node behind the counter, and do the rounding by yourself.

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

2 participants