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

1 thought on “overflow in javascript arithmetic”

  1. 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

    Reply

Leave a Comment