26

C#

Math.Ceiling(-0.4);

>> 0

JavaScript

Math.ceil(-0.4);

>>-0

Comments
  • 8
    Gotta love positive and negative zeros
  • 10
    > javascript you clown
    Not a clown... it's the entire circus.
  • 3
    PHP has the same issues when working with floats.

    I don't know if Js has a bcscale counterpart to solve that.
  • 3
    To be fair that's just IEEE 754 fuckery
  • 2
    @dudeking my favourite is

    let x = "ABC123-A"
    x++

    Somehow I've had a legitimate use case to do this before 😣
  • 0
    @C0D4 it does not work

    I wonder how come you need to increment a string?
  • 1
    @skydhash increment last letter on string as it's a rolling value.

    🤔I guess that's a php thing then.
  • 0
    I am sorry. Which one is correct? 🤭
Add Comment