1、Math.expm1()
Math.expm1(x)返回 ex - 1,即Math.exp(x) - 1。
Math.expm1(-1) // -0.6321205588285577
Math.expm1(0) // 0
Math.expm1(1) // 1.718281828459045
2、Math.log1p()
Math.log1p(x)方法返回1 + x的自然對數,即Math.log(1 + x)。如果x小於-1,返回NaN。
Math.log1p(1) // 0.6931471805599453
Math.log1p(0) // 0
Math.log1p(-1) // -Infinity
Math.log1p(-2) // NaN
應用場景:
Math.log(0)的場景,因為Math.log(0) 返回-Infinity(log的底數大於1時)。
