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
1
2
3
import System;
 
Console.log(Math.abs(-3)); // 3

Methods

  • abs

    Get the absolute value of a number.

  • acos

    Get the arccosine of a number.

  • acosh

    Get the hyperbolic arccosine of a number.

  • asin

    Get the arcsine of a number.

  • asinh

    Get the hyperbolic arcsine of a number.

  • atan

    Get the arctangent of a number.

  • atan2

    Gets an approximation of the arctangent of the quotient of the specified values.

  • atanh

    Get the hyperbolic arctangent of a number.

  • cbrt

    Get the cube root of a number.

  • ceil

    Rounds a number up.

  • cos

    Get the cosine of a number.

  • cosh

    Get the hyperbolic cosine of a number.

  • E

    Represents the base of the natural logarithm.

  • exp

    Raises Euler's number to a power. (e^x)

  • expm1

    Raises Euler's number to a power and subtracts 1. (e^x - 1)

  • floor

    Rounds a number down.

  • hypot

    Returns the square root of all the arguments individually squared and then added together.

  • LN10

    Represents the natural logarithm of ten (10).

  • LN2

    Represents the natural logarithm of two (2).

  • log

    Returns the natural logarithm (with base e) for a value.

  • log10

    Returns the base 10 logarithm for the specified value.

  • LOG10E

    Represents the base 10 logarithm of e.

  • log1p

    Returns the natural logarithm (with base e) for one (1) plus the specified value.

  • log2

    Returns the base 2 logarithm for the specified value.

  • LOG2E

    Represents the base 2 logarithm of e.

  • Math (Constructor)

    The System.Math class constructor is private and the System.Math class cannot be instantiated.

  • max

    Returns the highest number from the specified range of values.

  • min

    Returns the lowest number from the specified range of values.

  • PI

    Represents PI (π).

  • pow

    Raises a number (base) to the specified power (exponent).

  • powerOf2

    Tests 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.

  • random

    Generates a random number.

  • round

    Rounds a value to the nearest whole number.

  • signum

    Returns a value indicating the sign for a number.

  • sin

    Get the sine of a number.

  • sinh

    Get the hyperbolic sine of a number.

  • sqrt

    Returns the square root of a number.

  • SQRT1_2

    Represents the square root of ½.

  • SQRT2

    Represents the square root of two (2).

  • tan

    Get the tangent of a number.

  • tanh

    Get the hyperbolic tangent of a number.

  • truncate

    Removes decimal digits and returns the integral part of a number.

Share

HTML | BBCode | Direct Link