exercism / 8th

Exercism exercises in 8th.
https://exercism.org/tracks/8th
MIT License
4 stars 12 forks source link

Add `space-age` exercise #156

Closed ErikSchierboom closed 6 months ago

ErikSchierboom commented 6 months ago

Currently, the tests fail:

age on Mars  ... FAIL
    Actual:    «35.88»
    Expected:  «35.88»

age on Jupiter  ... FAIL
    Actual:    «2.41»
    Expected:  «2.41»

Clearly this floating point comparison shenanigans.

I can fix this is test by changing the number check to:

number? if 0.01 n:~= ;then

However, I'd rather not hardcode it. Should we add a new assertion? And if so, what would we name it?

glennj commented 6 months ago

Now about eps_equal? or approx_equal?

"age on Mars"
    ( 2129871239 "Mars" >age )
    35.88
    0.01 approx_equal?
ErikSchierboom commented 6 months ago

I've opened a PR to add an approx_equal? word.