nan 代表不是一个数字(not a number), inf代表无穷大(infinity)
IEEE 754 的一些规定：
This exception is raised if the given operands are invalid for the operation to be performed. Examples are (see IEEE 754, section 7):
Addition or subtraction: ∞ - ∞. (But ∞ + ∞ = ∞).
Multiplication: 0 · ∞.
Division: 0/0 or ∞/∞.
Remainder: x REM y, where y is zero or x is infinite.
Square root if the operand is less than zero. More generally, any mathematical function evaluated outside its domain produces this exception.
Conversion of a floating-point number to an integer or decimal string, when the number cannot be represented in the target format (due to overflow, infinity, or NaN).
Conversion of an unrecognizable input string.
Comparison via predicates involving < or >, when one or other of the operands is NaN. You can prevent this exception by using the unordered comparison functions instead; see FP Comparison Functions.
If the exception does not trap, the result of the operation is NaN.
‘Division by Zero’
This exception is raised when a finite nonzero number is divided by zero. If no trap occurs the result is either +∞ or -∞, depending on the signs of the operands.
This exception is raised whenever the result cannot be represented as a finite value in the precision format of the destination. If no trap occurs the result depends on the sign of the intermediate result and the current rounding mode (IEEE 754, section 7.3):
Round to nearest carries all overflows to ∞ with the sign of the intermediate result.
Round toward 0 carries all overflows to the largest representable finite number with the sign of the intermediate result.
Round toward -∞ carries positive overflows to the largest representable finite number and negative overflows to -∞.
Round toward ∞ carries negative overflows to the most negative representable finite number and positive overflows to ∞.
Whenever the overflow exception is raised, the inexact exception is also raised.
The underflow exception is raised when an intermediate result is too small to be calculated accurately, or if the operation’s result rounded to the destination precision is too small to be normalized.
When no trap is installed for the underflow exception, underflow is signaled (via the underflow flag) only when both tininess and loss of accuracy have been detected. If no trap handler is installed the operation continues with an imprecise small value, or zero if the destination precision cannot hold the small exact result.
This exception is signalled if a rounded result is not exact (such as when calculating the square root of two) or a result overflows without an overflow trap.
n + inf = inf; // 任意数 + 无穷大 = 无穷大
n / inf = 0; // 任意数 / 无穷大 = 0
atan(inf) = π // 对无穷大取反正切，结果为π