From 6cec2747ea01d41024bbba7bce33edc4bcdca9f5 Mon Sep 17 00:00:00 2001 From: Jens Fischer Date: Mon, 6 Apr 2020 01:01:01 +0200 Subject: [PATCH] [std] improve doc formatting for Math.hx --- std/Math.hx | 58 ++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/std/Math.hx b/std/Math.hx index d5d3cd25a06..82e32d80808 100644 --- a/std/Math.hx +++ b/std/Math.hx @@ -32,14 +32,14 @@ extern class Math { /** Represents the ratio of the circumference of a circle to its diameter, - specified by the constant, π. `PI` is approximately 3.141592653589793. + specified by the constant, π. `PI` is approximately `3.141592653589793`. **/ static var PI(default, null):Float; /** A special `Float` constant which denotes negative infinity. - For example, this is the result of -1.0 / 0.0. + 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`. @@ -52,7 +52,7 @@ extern class Math { /** A special `Float` constant which denotes positive infinity. - For example, this is the result of 1.0 / 0.0. + 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`. @@ -65,9 +65,9 @@ extern class Math { /** A special `Float` constant which denotes an invalid number. - NaN stands for "Not a Number". It occurs when a mathematically incorrect + `NaN` stands for "Not a Number". It occurs when a mathematically incorrect operation is executed, such as taking the square root of a negative - number: Math.sqrt(-1). + number: `Math.sqrt(-1)`. All further operations with `NaN` as an operand will result in `NaN`. @@ -81,31 +81,27 @@ extern class Math { /** Returns the absolute value of `v`. - 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 - `POSITIVE_INFINITY`. - - If `v` is `NaN`, the result is `NaN`. + - 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 `POSITIVE_INFINITY`. + - If `v` is `NaN`, the result is `NaN`. **/ static function abs(v:Float):Float; /** Returns the smaller of values `a` and `b`. - If `a` or `b` are `NaN`, the result is `NaN`. - If `a` or `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. - If `a` and `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `a` or `b` are `NaN`, the result is `NaN`. + - If `a` or `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. + - If `a` and `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. **/ static function min(a:Float, b:Float):Float; /** Returns the greater of values `a` and `b`. - If `a` or `b` are `NaN`, the result is `NaN`. - If `a` or `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. - If `a` and `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. + - If `a` or `b` are `NaN`, the result is `NaN`. + - If `a` or `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `a` and `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. **/ static function max(a:Float, b:Float):Float; @@ -165,11 +161,11 @@ extern class Math { /** Returns Euler's number, raised to the power of `v`. - exp(1.0) is approximately 2.718281828459. + `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`. + - 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`. **/ static function exp(v:Float):Float; @@ -179,10 +175,9 @@ extern class Math { 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 - is `NaN`. - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. - If `v` is `0.0`, the result is `NEGATIVE_INFINITY`. + - 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`. **/ static function log(v:Float):Float; @@ -194,10 +189,9 @@ extern class Math { /** Returns the square root of `v`. - 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`. + - 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`. **/ static function sqrt(v:Float):Float; @@ -228,8 +222,8 @@ extern class Math { static function ceil(v:Float):Int; /** - Returns a pseudo-random number which is greater than or equal to 0.0, - and less than 1.0. + Returns a pseudo-random number which is greater than or equal to `0.0`, + and less than `1.0`. **/ static function random():Float;