Skip to content

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

Merged
ferhatelmas merged 2 commits intoexercism:masterfrom
glikson:patch-1
Nov 15, 2017
Merged

space-age: do not force rounding of solutions#960
ferhatelmas merged 2 commits intoexercism:masterfrom
glikson:patch-1

Conversation

@glikson
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

glikson commented Nov 15, 2017

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

@ferhatelmas
Copy link
Copy Markdown
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