Ad
  • Default User Avatar

    So, I mark the issue as resolved. Bye!

  • Default User Avatar

    Yes, I also did that, and my Forth solution passed all tests afterwards. Thank you very much again for your trouble!

  • Default User Avatar

    I changed by one the upper bound of your loop and it passed the tests... The Haskell tests were not tight enough.

  • Default User Avatar

    Ah, thank you so much for checking! That would explain the issue (well, it's still weird that my Haskell solution passes, because it uses the same logic, but still...).
    Right, I saw some debate about this issue in the comments already.
    This is a much more likely explanation of what's going on.

    Thank you for all your trouble!

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Sorry if I wasn't clear. I failed the test. I pasted in "all those values" to trace the current state over the years. I got the exact same trace in my Haskell solution, and my Haskell solution has passed all tests. The trace for that test case also looks correct. It's not a matter of a rounding or an off-by-one error, because according to my trace, the guy runs out of money when the plan is still supposed to run for another eight years. So my solution reports that the banker's plan in that case is incorrect (does not last for 23 years), and the testcase fails me, claiming that it's one of the "good" plans.

    "The testcase seems to be hardcoded" - Oh, I just meant that it wasn't one of the randomly generated tests, but one of the hardcoded ones, those that are run each time. So my Forth solution fails that test each time. It sometimes passes all random tests, sometimes not.

    Hope that makes it clearer.

    So to sum up: I wrote two solutions, one in Forth, one in Haskell. The Haskell one immediately passed all tests. The Forth solution fails the test in question. But both my solutions agree (give the same trace and same result) for that testcase (so that seems to indicate that either the Forth testcase is wrong, or the Haskell testsuite is too lenient), and furthermore, the trace and result look reasonable, not like there might be a rounding error or something like that. I'd be grateful if you could check.

    And allow me to mention the following sanity check: The initial deposit is ca. 11,000,000. Each year, ca. 800,000 go off. Almost 10%. Both interest rate and inflation rate are 1%, so they are negligible in this case: Interest for the deposit is order of magnitude of 100,000, but more than 800,000 go off each year. So it makes intuitive sense that the money is gone after a bit more than ten years - which is exactly what my trace shows. That's what I mean when I said "eyeballing it looks correct".

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution