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

space-age: do not force rounding of solutions #960

Merged
merged 2 commits into from
Nov 15, 2017

Conversation

glikson
Copy link
Contributor

@glikson glikson commented Nov 15, 2017

The expected age values are specified (in respective canonical-data.json) with 2-digit precision (e.g., 31.69), while the actual result is a float.
Instead of forcing the solution to perform an arbitrary rounding, the test code verifies the result with certain precision (currently same 2-digit, for compatibility - can be eventually added to canonical-data.json itself).
Aligned with the conclusion of the discussion in exercism/problem-specifications#880

The expected age values are specified (in respective canonical-data.json) with 2-digit precision (e.g., 31.69), while the actual result is a float.
Instead of forcing the solution to perform an arbitrary rounding, the test code verifies the result with certain precision (currently same 2-digit, for compatibility - can be eventually added to canonical-data.json itself).
Aligned with the conclusion of the discussion in exercism/problem-specifications#880
Copy link
Contributor

@ferhatelmas ferhatelmas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never compare floats directly 👍

@ferhatelmas ferhatelmas merged commit 57602aa into exercism:master Nov 15, 2017
@tleen
Copy link
Member

tleen commented Nov 15, 2017

This is funny. I just did the exercise an hour or so ago and was incredibly frustrated about the need to round! Good on you @glikson!

@glikson glikson deleted the patch-1 branch November 15, 2017 22:59
@glikson
Copy link
Contributor Author

glikson commented Nov 15, 2017

@tleen same here - was frustrating enough to actually go and fix it :-)

@ferhatelmas
Copy link
Contributor

@glikson @tleen I think it's a good exercise since there is no round function in standard library. 😄

Btw, coming in 1.10 but not powerful like python's to be very useful in this exercise.

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.

3 participants