Ad
  • Custom User Avatar

    Not an issue

  • Custom User Avatar

    OMG, I've found that I have not read description to the end.

  • Default User Avatar

    Dividing numbers is taught at primary school. The only harder thing is detecting the case when there's no "cycle" but it's written in the description.
    OK, maybe not at primary school when it comes to decimal fractions, but still at school.

  • Custom User Avatar

    I really liked this kata, because it shows how important is to use as many instruction as you can.

  • Custom User Avatar

    Thanks!

  • Default User Avatar

    Maybe this part of the description is not clear enough:

    otherwise (n and 10 not coprimes) return -1

    In other words I wanted to say that the cycles have no interest for the kata if n and 10 are coprimes (Cycles must begin just after the decimal dot). Would it be better to modify the description?

  • Default User Avatar

    5 doesn't divide 12 and 22.
    1/22 has a 2-long cycle beginning at second decimal.
    1/12 has a 1-long cycle beginning at third decimal.

    1/12 and 1/22 are not terminating decimals - they can't be written as 1/ (2^m 5^n). They do have a cycle.

  • Default User Avatar

    12 and 22 have 2 as common divisor.

  • Custom User Avatar

    ;-)

  • Default User Avatar

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

  • Default User Avatar

    oscar, what you've written is a floating point approximation to 1/69, which is not the decimal expansion of 1/69. This approach can only show cycles of length smaller that size of float.

  • Custom User Avatar

    I get ""0144927536231884059730878888672123139258474111557006835937500000000000" result for 1/69 and I can't see cycle length 22, whats wrong?.

  • Custom User Avatar

    I get it, then the master should say that you can not use eval string, for example you can use array :(. make it simple as much as you can.
    Thank you for you intelligent answer.

  • Custom User Avatar

    Hey body, you should do more than eval string for 4kyu kata level, what do you think? Lol))

  • Custom User Avatar

    I am getting this error using Ruby:

    evaluate': undefined method eval' for #Calculator:0x0000e32b8aaed0 (NoMethodError)
    from block in <main>' from each'
    from `'

    Does not this kata work anymore?

  • Loading more items...