Math Summary Provides basic mathematical operations. Description The System.Math class cannot be instantiated. All fields and methods of System.Math are static. Examples Absolute Value 123import System; Console.log(Math.abs(-3)); // 3 Methods absGet the absolute value of a number. acosGet the arccosine of a number. acoshGet the hyperbolic arccosine of a number. asinGet the arcsine of a number. asinhGet the hyperbolic arcsine of a number. atanGet the arctangent of a number. atan2Gets an approximation of the arctangent of the quotient of the specified values. atanhGet the hyperbolic arctangent of a number. cbrtGet the cube root of a number. ceilRounds a number up. cosGet the cosine of a number. coshGet the hyperbolic cosine of a number. ERepresents the base of the natural logarithm. expRaises Euler's number to a power. (e^x) expm1Raises Euler's number to a power and subtracts 1. (e^x - 1) floorRounds a number down. hypotReturns the square root of all the arguments individually squared and then added together. LN10Represents the natural logarithm of ten (10). LN2Represents the natural logarithm of two (2). logReturns the natural logarithm (with base e) for a value. log10Returns the base 10 logarithm for the specified value. LOG10ERepresents the base 10 logarithm of e. log1pReturns the natural logarithm (with base e) for one (1) plus the specified value. log2Returns the base 2 logarithm for the specified value. LOG2ERepresents the base 2 logarithm of e. Math (Constructor)The System.Math class constructor is private and the System.Math class cannot be instantiated. maxReturns the highest number from the specified range of values. minReturns the lowest number from the specified range of values. PIRepresents PI (π). powRaises a number (base) to the specified power (exponent). powerOf2Tests if a number is would be the result of any exponentiation 2n where n is an integer and the number 2 (two) is the base. randomGenerates a random number. roundRounds a value to the nearest whole number. signumReturns a value indicating the sign for a number. sinGet the sine of a number. sinhGet the hyperbolic sine of a number. sqrtReturns the square root of a number. SQRT1_2Represents the square root of ½. SQRT2Represents the square root of two (2). tanGet the tangent of a number. tanhGet the hyperbolic tangent of a number. truncateRemoves decimal digits and returns the integral part of a number. Share HTML | BBCode | Direct Link