I cannot seem to pass 4 tests despite of using the functions bigdec and int in my calculations. I have already placed such functions and included also double in some parts, which means, I tried different combinations. Some make less test to pass. My best try has given me 4 fail tests only:

annual-balance-update-small-negative-balance-test

annual-balance-update-large-negative-balance-test

amount-to-donate-large-positive-balance-test

amount-to-donate-huge-positive-balance-test

Of course the reason are minimal differences in decimals. For example, for the first test the expected value is -0.12695199M and I got -0.11904801M but every other test is passing.

Although I have to say the problem instructions are a bit weird, saying that the interest is negative for a negative balance. Banks usually don’t have negative interest rates on their loans. :)