Skip to content

Commit

Permalink
[std] improve doc formatting for Math.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed Apr 5, 2020
1 parent 1a5a785 commit 6cec274
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions std/Math.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 6cec274

Please sign in to comment.