Skip to content

Counter not working for decimals #19

Description

@kayman-mk

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).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions