当前位置:网站首页>JS summary of math functions in math objects

JS summary of math functions in math objects

2022-06-11 02:16:00 KjPrime

The absolute value (abs)

Math.abs(x) 

PI(π)

Math.PI(x) 

square root (√)

Math.sqrt(x) 

Maximum ( You can take the maximum value of multiple numbers max)

Math.max(...x)

minimum value ( You can take the minimum value of multiple numbers min)

Math.min(...x)  

Exponentiation (pow)

Math.pow(x, y)

Take random values ( Greater than 0 Less than 1, Include 0 barring 1 random)

Math.random()

take 32 The number of leading zeros in a binary number (clz32)

Math.clz32(x) //  return  x  Of  32  The number of leading zeros in a bit binary representation 

Natural number (e)

Math.E

Symbolic function (sign)

Math.sign(x) //  Greater than 0  return  1; Less than 0  return  -1; be equal to 0  return  0

Take the floating-point function

Math.fround(x) //  Returns the closest of the numbers (32  Bit single precision ) Floating point table 

Integral function

Rounding up ( > x)

Math.ceil(x)

Rounding down ( < x)

Math.floor(x)

Round to the nearest whole

Math.round(x)

integer ( Take the integer part of the number )

Math.trunc(x)

Exponential function

Natural number e Of x Power (exp)

Math.exp(x)

Natural number e Of x The power minus 1(exp - 1)

Math.expm1(x)

power function

Math.pow(x, y) // x Of y Power 

square root

√1/2(1/2 The square root of )

Math.SQRT1_2

√2(2 The square root of )

Math.SQRT2

Root of the third power

Math.cbrt(x)

Trigonometric functions ( Of the following methods x, In radians )

Positive trigonometric function

cosine (cos)

Math.cos(x) 

sine (sin)

Math.sin(x) 

tangent (tan)

Math.tan(x) 

Anti trigonometric function

Arccosine (arccos)

Math.acos(x) 

Anti sine (arcsin)

Math.asin(x) 

Anyway (arcsin)

Math.atan(x)

Hyperbolic trigonometric functions

Hyperbolic cosine

Math.cosh(x) 

Hyperbolic sine

Math.sinh(x) 

Hyperbolic tangent

Math.tanh(x) 

Hyperbolic inverse trigonometric function

Hyperbolic arccosine

Math.acosh(x) 

Hyperbolic anti sine

Math.asinh(x) 

Hyperbolic arctangent

Math.atanh(x) 

Logarithmic function

2 Bottom (log2)

Math.log2(x)

log2(e)

Math.LOG2E 

Natural number e Bottom (ln)

Math.log(x) 

1+x The natural logarithm of

Math.log1p(x) 

ln2

Math.LN2 

ln10

Math.LN10 

10 Bottom (log10)

Math.log10(x) 

log10(e)

Math.LOG10E 

reference

原网站

版权声明
本文为[KjPrime]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020615478867.html

随机推荐