kqvanity
kqvanity

Reputation: 100

overflow in javascript arithmetic

i was reading a book , and encountered this

Arithmetic in JavaScript does not raise errors in cases of overflow, underflow, or division by zero. When the result of a numeric operation is larger than the largest representable number (overflow), the result is a special infinity value, Infinity. Similarly, when the absolute value of a negative value becomes larger than the absolute value of the largest representable negative number, the result is negative infinity, - Infinity.

how is it possible that the result of a absolute value of a negative number result in a negative number

Upvotes: -1

Views: 277

Answers (1)

Rune FS
Rune FS

Reputation: 21742

That's not what it says. if |x| > |largest representable negative number| => -infinity so if -10 is the largest representable negative number and x is 11 then the result is -infinity

Upvotes: 1

Related Questions