|
@@ -26,7 +26,7 @@
|
|
|
extern class Math
|
|
|
{
|
|
|
/**
|
|
|
- Represents the ratio of the circumference of a circle to its diameter,
|
|
|
+ Represents the ratio of the circumference of a circle to its diameter,
|
|
|
specified by the constant, π. `PI` is approximately 3.141592653589793.
|
|
|
**/
|
|
|
static var PI(default,null) : Float;
|
|
@@ -37,7 +37,7 @@ extern class Math
|
|
|
For example, this is the result of -1.0 / 0.0.
|
|
|
|
|
|
Operations with NEGATIVE_INFINITY as an operand may result in
|
|
|
- NEGATIVE_INFINITY, POSITIVE_INFINITY or NaN.
|
|
|
+ NEGATIVE_INFINITY, POSITIVE_INFINITY or NaN.
|
|
|
|
|
|
If this constant is converted to an Int, e.g. through Std.int(), the
|
|
|
result is unspecified.
|
|
@@ -50,7 +50,7 @@ extern class Math
|
|
|
For example, this is the result of 1.0 / 0.0.
|
|
|
|
|
|
Operations with POSITIVE_INFINITY as an operand may result in
|
|
|
- NEGATIVE_INFINITY, POSITIVE_INFINITY or NaN.
|
|
|
+ NEGATIVE_INFINITY, POSITIVE_INFINITY or NaN.
|
|
|
|
|
|
If this constant is converted to an Int, e.g. through Std.int(), the
|
|
|
result is unspecified.
|
|
@@ -72,7 +72,7 @@ extern class Math
|
|
|
In order to test if a value is NaN, you should use Math.isNaN() function.
|
|
|
|
|
|
@php In PHP versions prior to 5.3.1 VC 9 there may be unexpected
|
|
|
- results when performing arithmetic operations with NaN on Windows,
|
|
|
+ results when performing arithmetic operations with NaN on Windows,
|
|
|
see [https://bugs.php.net/bug.php?id=42143]
|
|
|
**/
|
|
|
static var NaN(default, null) : Float;
|
|
@@ -80,12 +80,12 @@ extern class Math
|
|
|
/**
|
|
|
Returns the absolute value of `v`.
|
|
|
|
|
|
- If `v` is positive or 0, the result is unchanged. Otherwise the result
|
|
|
+ If `v` is positive or 0, the result is unchanged. Otherwise the result
|
|
|
is -`v`.
|
|
|
-
|
|
|
- If `v` is NEGATIVE_INFINITY or POSITIVE_INFINITY, the result is
|
|
|
+
|
|
|
+ If `v` is NEGATIVE_INFINITY or POSITIVE_INFINITY, the result is
|
|
|
POSITIVE_INFINITY.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN, the result is NaN.
|
|
|
**/
|
|
|
static function abs(v:Float):Float;
|
|
@@ -110,62 +110,62 @@ extern class Math
|
|
|
|
|
|
/**
|
|
|
Returns the trigonometric sine of the specified angle `v`, in radians.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN or infinite, the result is NaN.
|
|
|
**/
|
|
|
static function sin(v:Float):Float;
|
|
|
|
|
|
/**
|
|
|
Returns the trigonometric cosine of the specified angle `v`, in radians.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN or infinite, the result is NaN.
|
|
|
**/
|
|
|
static function cos(v:Float):Float;
|
|
|
|
|
|
/**
|
|
|
Returns the trigonometric tangent of the specified angle `v`, in radians.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN or infinite, the result is NaN.
|
|
|
**/
|
|
|
static function tan(v:Float):Float;
|
|
|
|
|
|
/**
|
|
|
Returns the trigonometric arc of the specified angle `v`, in radians.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN or infinite, the result is NaN.
|
|
|
**/
|
|
|
static function asin(v:Float):Float;
|
|
|
|
|
|
/**
|
|
|
- Returns the trigonometric arc cosine of the specified angle `v`,
|
|
|
+ Returns the trigonometric arc cosine of the specified angle `v`,
|
|
|
in radians.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN or infinite, the result is NaN.
|
|
|
**/
|
|
|
static function acos(v:Float):Float;
|
|
|
|
|
|
/**
|
|
|
- Returns the trigonometric arc tangent of the specified angle `v`,
|
|
|
+ Returns the trigonometric arc tangent of the specified angle `v`,
|
|
|
in radians.
|
|
|
-
|
|
|
+
|
|
|
If `v` is NaN or infinite, the result is NaN.
|
|
|
**/
|
|
|
static function atan(v:Float):Float;
|
|
|
|
|
|
/**
|
|
|
- Returns the trigonometric arc tangent whose tangent is the quotient of
|
|
|
+ Returns the trigonometric arc tangent whose tangent is the quotient of
|
|
|
two specified numbers, in radians.
|
|
|
-
|
|
|
- If parameter `x` or `y` is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
+
|
|
|
+ If parameter `x` or `y` is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
the result is NaN.
|
|
|
**/
|
|
|
static function atan2(y:Float, x:Float):Float;
|
|
|
|
|
|
/**
|
|
|
Returns Euler's number, raised to the power of `v`.
|
|
|
-
|
|
|
+
|
|
|
exp(1.0) is approximately 2.718281828459.
|
|
|
-
|
|
|
+
|
|
|
If `v` is POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
|
|
|
If `v` is NEGATIVE_INFINITY, the result is 0.0.
|
|
|
If `v` is NaN, the result is NaN.
|
|
@@ -174,11 +174,11 @@ extern class Math
|
|
|
|
|
|
/**
|
|
|
Returns the natural logarithm of `v`.
|
|
|
-
|
|
|
- This is the mathematical inverse operation of exp,
|
|
|
+
|
|
|
+ This is the mathematical inverse operation of exp,
|
|
|
i.e. `log(exp(v)) == v` always holds.
|
|
|
-
|
|
|
- If `v` is negative (including NEGATIVE_INFINITY) or NaN, the result
|
|
|
+
|
|
|
+ If `v` is negative (including NEGATIVE_INFINITY) or NaN, the result
|
|
|
is NaN.
|
|
|
If `v` is POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
|
|
|
If `v` is 0.0, the result is NEGATIVE_INFINITY.
|
|
@@ -192,8 +192,8 @@ extern class Math
|
|
|
|
|
|
/**
|
|
|
Returns the square root of `v`.
|
|
|
-
|
|
|
- If `v` is negative (including NEGATIVE_INFINITY) or NaN, the result
|
|
|
+
|
|
|
+ If `v` is negative (including NEGATIVE_INFINITY) or NaN, the result
|
|
|
is NaN.
|
|
|
If `v` is POSITIVE_INFINITY, the result is POSITIVE_INFINITY.
|
|
|
If `v` is 0.0, the result is 0.0.
|
|
@@ -202,8 +202,8 @@ extern class Math
|
|
|
|
|
|
/**
|
|
|
Rounds `v` to the nearest integer value.
|
|
|
-
|
|
|
- If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
|
|
|
+
|
|
|
+ If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
|
|
|
or POSITIVE_INFINITY, the result is unspecified.
|
|
|
**/
|
|
|
static function round(v:Float):Int;
|
|
@@ -211,7 +211,7 @@ extern class Math
|
|
|
/**
|
|
|
Returns the largest integer value that is not greater than `v`.
|
|
|
|
|
|
- If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
|
|
|
+ If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
|
|
|
or POSITIVE_INFINITY, the result is unspecified.
|
|
|
**/
|
|
|
static function floor(v:Float):Int;
|
|
@@ -219,13 +219,13 @@ extern class Math
|
|
|
/**
|
|
|
Returns the smallest integer value that is not less than `v`.
|
|
|
|
|
|
- If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
|
|
|
+ If `v` is outside of the signed Int32 range, or is NaN, NEGATIVE_INFINITY
|
|
|
or POSITIVE_INFINITY, the result is unspecified.
|
|
|
**/
|
|
|
static function ceil(v:Float):Int;
|
|
|
|
|
|
/**
|
|
|
- Returns a pseudo-random number which is greater than or equal to 0.0,
|
|
|
+ Returns a pseudo-random number which is greater than or equal to 0.0,
|
|
|
and less than 1.0.
|
|
|
**/
|
|
|
static function random() : Float;
|
|
@@ -234,7 +234,7 @@ extern class Math
|
|
|
/**
|
|
|
Returns the largest integer value that is not greater than `v`, as a Float.
|
|
|
|
|
|
- If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
+ If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
the result is unspecified.
|
|
|
**/
|
|
|
static function ffloor( v : Float ) : Float;
|
|
@@ -242,7 +242,7 @@ extern class Math
|
|
|
/**
|
|
|
Returns the smallest integer value that is not less than `v`, as a Float.
|
|
|
|
|
|
- If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
+ If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
the result is unspecified.
|
|
|
**/
|
|
|
static function fceil( v : Float ) : Float;
|
|
@@ -250,7 +250,7 @@ extern class Math
|
|
|
/**
|
|
|
Rounds `v` to the nearest integer value, as a Float.
|
|
|
|
|
|
- If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
+ If `v` is is NaN, NEGATIVE_INFINITY or POSITIVE_INFINITY,
|
|
|
the result is unspecified.
|
|
|
**/
|
|
|
static function fround( v : Float ) : Float;
|
|
@@ -275,7 +275,7 @@ extern class Math
|
|
|
/**
|
|
|
Tells if `f` is a finite number.
|
|
|
|
|
|
- If `f` is POSITIVE_INFINITY, NEGATIVE_INFINITY or NaN, the result
|
|
|
+ If `f` is POSITIVE_INFINITY, NEGATIVE_INFINITY or NaN, the result
|
|
|
is false, otherwise the result is true.
|
|
|
**/
|
|
|
static function isFinite( f : Float ) : Bool;
|
|
@@ -283,7 +283,7 @@ extern class Math
|
|
|
/**
|
|
|
Tells if `f` is not a valid number.
|
|
|
|
|
|
- If `f` is NaN, the result is true, otherwise the result is false.
|
|
|
+ If `f` is NaN, the result is true, otherwise the result is false.
|
|
|
In particular, both POSITIVE_INFINITY and NEGATIVE_INFINITY are
|
|
|
not considered NaN.
|
|
|
**/
|
|
@@ -295,15 +295,10 @@ extern class Math
|
|
|
NEGATIVE_INFINITY = __global__["Number"].NEGATIVE_INFINITY;
|
|
|
POSITIVE_INFINITY = __global__["Number"].POSITIVE_INFINITY;
|
|
|
#else
|
|
|
- #if !js // genjs.ml will insert this only if necessary.
|
|
|
- Math.__name__ = ["Math"];
|
|
|
- #end
|
|
|
+ Math.__name__ = ["Math"];
|
|
|
Math.NaN = Number["NaN"];
|
|
|
Math.NEGATIVE_INFINITY = Number["NEGATIVE_INFINITY"];
|
|
|
Math.POSITIVE_INFINITY = Number["POSITIVE_INFINITY"];
|
|
|
- #end
|
|
|
- #if js
|
|
|
- __feature__("Type.resolveClass",$hxClasses['Math'] = Math);
|
|
|
#end
|
|
|
Math.isFinite = function(i) {
|
|
|
return
|
|
@@ -311,8 +306,6 @@ extern class Math
|
|
|
__global__["isFinite"](i);
|
|
|
#elseif flash
|
|
|
_global["isFinite"](i);
|
|
|
- #elseif js
|
|
|
- __js__("isFinite")(i);
|
|
|
#else
|
|
|
false;
|
|
|
#end
|
|
@@ -323,8 +316,6 @@ extern class Math
|
|
|
__global__["isNaN"](i);
|
|
|
#elseif flash
|
|
|
_global["isNaN"](i);
|
|
|
- #elseif js
|
|
|
- __js__("isNaN")(i);
|
|
|
#else
|
|
|
false;
|
|
|
#end
|