22

C#

Math.Ceiling(-0.4);

>> 0

JavaScript

Math.ceil(-0.4);

>>-0

Comments
  • 9
    Gotta love positive and negative zeros
  • 12
    > javascript you clown
    Not a clown... it's the entire circus.
  • 2
    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
  • 1
    Love Javascript. It doesn't produce any errors, literally you can add "fifteen" to 30 and get a valid result
  • 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?
  • 0
    @skydhash increment last letter on string as it's a rolling value.

    🤔I guess that's a php thing then.
Your Job Suck?
Get a Better Job
Add Comment