Ad
  • Default User Avatar

    Works now, thanks

  • Custom User Avatar

    I just tried it in Python. After I threw all recursive variants away and used an iterative one, it worked fine. However, I'm not sure whether the integral type in Python over-/underflows in this case, but according to the Python IDLE it changes to ...L automatically. There shouldn't be any "precision" issues in Python.

  • Custom User Avatar

    Whoops, sorry. Seems like I accidentially forgot to change Integer -> Integer to Int -> Integer in the initial solution. Should be fixed. Just change the type of your function to Int -> Integer and you should be fine.

  • Custom User Avatar

    JS now certainly works, but I think a similar issue is on other languages too; consider I was using the Decimal class with 50 decimal digits in Python and got this:

    9479398183114544640861314325734704178452902509291400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000L should equal 9479398183114544640861314325734704178452902509146734338936275702483155470586109600468782416434303102723062665537736846418815435968207663011L

    Even if there is some version of it, fine tuning the right amount of digital precision, it seems to me that this version is harder than the JS version. And I think the same could go for Ruby.

  • Default User Avatar

    Finally it works!
    Thank you for your feedback and for your kata.

    I think my problem where with big integers!

  • Default User Avatar

    Ok!
    Now I pass the -1 to -50 but I fail on the random.

    Thank you I am going to see why!

  • Default User Avatar

    I've changed the tests a bit try now.

  • Default User Avatar

    Using Haskell I can get the tests running, but when submitting, I'm getting the following error:

     /tmp/haskell115713-20-1se0n8t/Codewars/Exercise/Lucas/Test.hs:26:36:
       Couldn't match expected type `Int' with actual type `Integer' In the first argument of `solution',
       namely `i' In the second argument of `shouldBe', namely `solution i' In the expression: lucasnum i `shouldBe` solution i
    
  • Default User Avatar

    Ok bkaes!
    I think I am no stuck, I want to know if the value that gives as a solution -45537549124 is -51, like this test:

    Test.assertEquals(lucasnum(-51), -45537549124)
    

    NaMe613, I pass 57 tests before the first fail.

    The test that fails says:

    Expected: -45537549124, instead got: 28143753123
    

    Thank you for your feedback.

  • Default User Avatar

    My apologies for not having replied yet,could you please clarify how many tests you pass before the error occurs.

  • Custom User Avatar

    Please use three backticks to mark code:

    ```
    your code here
    ```
    

    Otherwise it's kind of hard to read your comments. That being said, the JavaScript tests have been changed lately. Did you try again? Also, if you're completely stuck, you can add your current solution as a spoiler in a comment.

  • Default User Avatar

    Thanks for your answer.
    The test that says failed is this one: Test.assertEquals(lucasnum(-51), -45537549124) ?

    -50 to -1
    Expected: -45537549124, instead got: 28143753123
    Which other number can bring me the -45537549124 if is not the -51 ?

    I try with my own test:
    Test.assertEquals(lucasnum(-51), -45537549124)
    And works...

    Thank you for your feedback

  • Custom User Avatar

    Thanks for the quick resolve and special thanks for this kata :-)

  • Default User Avatar

    The test cases in the javascript translation can be above 1000 so recursion is to slow.

  • Custom User Avatar

    You're right it works fine.

  • Loading more items...