Skip to content

Conversation

pcriadoperez
Copy link
Collaborator

@pcriadoperez pcriadoperez commented Dec 9, 2024

Ran tests with old code and new code and gave the same result.
There was one exception where old code if step size was 1.0 would round like a step size of 1 while current implementations step size 1.0 rounds like 0.1

Fix #1496

@coveralls
Copy link

Coverage Status

coverage: 67.986%. remained the same
when pulling 2e27c2a on pcriadoperez:round-step-size
into 10f3986 on sammchardy:master.

@christophlins
Copy link

Please note that accepting float might lead to undesired results:

round_step_size(0.09999999999999999, 0.1)
Out[11]: 0.0

round_step_size(0.09999999999999999999, 0.1)
Out[12]: 0.1

If the type of the argument is float, add an eps (machine precision) prior to rounding.

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

Successfully merging this pull request may close these issues.

round_step_size
4 participants