For task 2 of exercism.org/tracks/clojure/exercises/interest-is-interesting/, my attempt fails due to wrong kind of rounding, but it’s unclear how to do or avoid such rounding with bigints.
in one test, my return value is rounded, and the expected value is not:
lein test :only interest-is-interesting-test/annual-balance-update-huge-positive-balance-test
FAIL in (annual-balance-update-huge-positive-balance-test) (interest_is_interesting_test.clj:57)
expected: (= 920352587.26744292868451875M (interest-is-interesting/annual-balance-update 898124017.826243404425M))
actual: (not (= 920352587.26744292868451875M 920352587.267443M))
in another test, my value isn’t rounded, and the expected value is rounded:
lein test :only interest-is-interesting-test/annual-balance-update-large-positive-balance-test
FAIL in (annual-balance-update-large-positive-balance-test) (interest_is_interesting_test.clj:54)
expected: (= 1016.210101621M (interest-is-interesting/annual-balance-update 1000.0001M))
actual: (not (= 1016.210101621M 1016.2101016209999M))
is it perhaps due to Tests that involve floating-point checks fail on JVM · Issue #847 · exercism/clojure · GitHub?
i get this failure both offline, using lein test, and in the exercism editor.
the instructions are unclear of what level of precision ought to be used, and it seems contradictory to round in two different ways in the tests. (as ever, the chances of this user being in error are also high, but at this point i’m baffled as to how it could be correctly solved.)