Ad
  • Custom User Avatar

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

  • Custom User Avatar

    added to all languages

  • Custom User Avatar

    Changed the note to "Zero (0) is not checked for any specific sign. Negative zeros make no mathematical sense."

    Thanks for the feedback. XD

  • Custom User Avatar

    This Kata is meant to be super easy. I am sorry that the note I originally wrote for the C# version of this Kata doesn't make sense in your fancy JavaScript world.

    Do you want me to just remove the NOTE at the bottom of the description? Or add a "(not for JavaScript)" mini note? I can also make a "(if (name == "ASDFGerte" && language == "JavaScript") { negativeZeroNote.Visible = false; })" if you want.

    But you still haven't supplied me with a code example...

  • Custom User Avatar

    Whoops, made a mistake myself. You will have slightly incostent tests across the different kata versions because not all languages support duck-typing.

    Apart from that, you can forget about all this nonsense about ±0. Technically, numbers in JS are floats, but in reality they are integers, even though they use float division instead of integer division and can't go beyond 2^53 - 1 without "losing precision".

  • Custom User Avatar

    I don't know which languages don't use integers, since I didn't make the translations and don't know most of the programming languages.
    I don't have time right now to go through all of them one at a time.

  • Custom User Avatar

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

  • Custom User Avatar

    Added the extra decimal point test cases for JavaScript. Any feedback on them?

  • Custom User Avatar

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

  • Custom User Avatar

    so why are you then arguing as if they are?

    Because they yield the same value. Even if you keep crying about how +0 and -0 are not identical, they still yield the same value even in binary representation:

    (+0 >>> 0).toString(2)  ===  0
    (-0 >>> 0).toString(2)  ===  0
    

    I expect you know 1/-0 vs 1/0

    Sorry, but this is unrelated here.

    by spec explicitly should not return -0 for an input of 0

    It actually says "Zero can't be negative". Unfortunately, this is not 100% true in JS; fortunately, JS still thinks they are the same. You want to follow the spec so much? Your choice, but don't make a fuss of how "you're correct and others are wrong".

  • Custom User Avatar

    so that people will see the issue

    Interesting statement, may I ask you what is this issue you're talking about? JavaScript is comparing values, not some magical being behind the curtains. If JS thinks that -0 === +0, then maybe -0 and 0 are actually the same value (wow unexpected, such impossible)? Of course, you may not agree that zero equals zero, but in this case are you sure you should be talking about it here?

  • Custom User Avatar

    https://en.wikipedia.org/wiki/IEEE_754
    We are talking about integers, not floating-points or whatever else.
    See also: https://en.wikipedia.org/wiki/Signed_zero

    But yes as FArekkusu said, Test.assertEquals(-0, 0); will result in the test passing.

    Only place this might be an issue is for those weird programming languages that don't have integers.
    I only know of Haskell, but do let me know if there are more in this Kata that need decimal point tests.

  • Custom User Avatar

    The values are checked for equality, not being identical. Yes, -0 and +0 are not identical, and Object.is(-0, +0) gives false as a proof, but they are still equal to the same value - 0. Stop talking nonsense.

  • Custom User Avatar

    Negative zero is a mathematical impossibility. The note in the description is mostly just so people wouldn't ask about it, yet here we are again.

    There is already a test case for zero in Javascript, so I don't know what you are trying to say.

    Test.assertEquals(makeNegative(0), 0);
    
  • Custom User Avatar

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

  • Loading more items...