Michael
Michael

Reputation: 187

Too large negative exponential number returns 0 but not -Infinity. Can someone explain this?

This is a strange behaviour.

1e-325
=> 0

but

1e+325
=> Infinity

and

-100...(decimal 1e-325 value)
=> -Infinity

Upvotes: 0

Views: 113

Answers (1)

Pointy
Pointy

Reputation: 413720

The value 1e-325 is a positive number. It's very, very close to zero. It's equal to 1 / 1e+325 (well, conceptually equal). The value 1e+325 is positive, and so is 1.

Upvotes: 4

Related Questions