6

According to what I've read, all numbers in JavaScript are saved as floats except array indexes and the operands of bitwise operations.

Because all floats have a sign bit -0 === 0 should evaluate to false. However it evaluates to true.

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
arc.slate .0
  • 428
  • 3
  • 8

1 Answers1

6

Because JS uses the IEEE 754 standard for floating point numbers, which states that -0 and +0 should "compare as equal with the usual (numerical) comparison operators." (source)

ssube
  • 47,010
  • 7
  • 103
  • 140