Ad
  • Custom User Avatar

    This behaviour is by design. Int wraps. ( Int might be 64 bits, but will always be bounded. )

  • Custom User Avatar

    signum and abs is not tested.

    But in case you are wondering, the math answer for diff signum should be:

    diff signum 0 = undefined
    diff signum _ = 0
    
  • Custom User Avatar

    What is the expected return of

    diff signum 0
    
  • Custom User Avatar

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

  • Custom User Avatar

    Indeed, there is a bug in haskell translation:
    For very large int, (read x) will give an wrong result: (Int is not a big int, it allows only 2^32 at most)

     (read "12379868686876789689697869868969857344444444444444777777777777777777777777777777777774345945496969" :: Int)
     -8728886484601258615
    

    I think the read function is not important, as it always returns Int

    However, the test do not respect the big int. Because I am new to codewars, I am not sure how to contribute to the kata test.