Math

package js.lib

Available on js

Math is a built-in object that has properties and methods for mathematical constants and functions. Not a function object.

Documentation Math by Mozilla Contributors, licensed under CC-BY-SA 2.5.

Static variables

staticread onlyE:Float

Euler's constant and the base of natural logarithms, approximately 2.718.

staticread onlyLN10:Float

Natural logarithm of 10, approximately 2.303.

staticread onlyLN2:Float

Natural logarithm of 2, approximately 0.693.

staticread onlyLOG10E:Float

Base 10 logarithm of E, approximately 0.434.

staticread onlyLOG2E:Float

Base 2 logarithm of E, approximately 1.443.

staticread onlyPI:Float

Ratio of the circumference of a circle to its diameter, approximately 3.14159.

staticread onlySQRT1_2:Float

Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.

staticread onlySQRT2:Float

Square root of 2, approximately 1.414.

Static methods

staticabs(x:Int):Int

staticabs(x:Float):Float

Returns the absolute value of a number.

staticacos(x:Float):Float

Returns the arccosine of a number.

staticacosh(x:Float):Float

Returns the hyperbolic arccosine of a number.

staticasin(x:Float):Float

Returns the arcsine of a number.

staticasinh(x:Float):Float

Returns the hyperbolic arcsine of a number.

staticatan(x:Float):Float

Returns the arctangent of a number.

staticatan2(y:Float, x:Float):Float

Returns the arctangent of the quotient of its arguments.

staticatanh(x:Float):Float

Returns the hyperbolic arctangent of a number.

staticcbrt(x:Float):Float

Returns the cube root of a number.

staticceil(x:Float):Int

Returns the smallest integer greater than or equal to a number.

staticclz32(x:Int):Int

Returns the number of leading zeroes of a 32-bit integer.

staticcos(x:Float):Float

Returns the cosine of a number.

staticcosh(x:Float):Float

Returns the hyperbolic cosine of a number.

staticexp(x:Float):Float

Returns Ex, where x is the argument, and E is Euler's constant (2.718…), the base of the natural logarithm.

staticexpm1(x:Float):Float

Returns subtracting 1 from exp(x).

staticfloor(x:Float):Int

Returns the largest integer less than or equal to a number.

staticfround(x:Float):Float

Returns the nearest single precision float representation of a number.

statichypot(args:Rest<Float>):Float

Returns the square root of the sum of squares of its arguments.

staticimul(x:Int, y:Int):Int

Returns the result of a 32-bit integer multiplication.

staticlog(x:Float):Float

Returns the natural logarithm (loge, also ln) of a number.

staticlog10(x:Float):Float

Returns the base 10 logarithm of a number.

staticlog1p(x:Float):Float

Returns the natural logarithm (loge, also ln) of 1 + x for a number x.

staticlog2(x:Float):Float

Returns the base 2 logarithm of a number.

staticmax(args:Rest<Int>):Int

staticmax(args:Rest<Float>):Float

Returns the largest of zero or more numbers.

staticmin(args:Rest<Int>):Int

staticmin(args:Rest<Float>):Float

Returns the smallest of zero or more numbers.

staticpow(x:Float, y:Float):Float

Returns base to the exponent power, that is, baseexponent.

staticrandom():Float

Returns a pseudo-random number between 0 and 1.

staticround(x:Float):Int

Returns the value of a number rounded to the nearest integer.

staticsign(x:Float):Int

Returns the sign of the x, indicating whether x is positive, negative or zero.

staticsin(x:Float):Float

Returns the sine of a number.

staticsinh(x:Float):Float

Returns the hyperbolic sine of a number.

staticsqrt(x:Float):Float

Returns the positive square root of a number.

statictan(x:Float):Float

Returns the tangent of a number.

statictanh(x:Float):Float

Returns the hyperbolic tangent of a number.

statictrunc(x:Float):Int

Returns the integer part of the number x, removing any fractional digits.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/lib/Math.html