Rename log to ln, log1p to ln1p, keep pow only as extension

#KT-4900
This commit is contained in:
Ilya Gorbunov
2017-07-25 08:13:49 +03:00
parent 805d1c90b7
commit 6373ac7ef0
3 changed files with 68 additions and 86 deletions
+31 -33
View File
@@ -150,28 +150,6 @@ public inline fun tanh(a: Double): Double = nativeMath.tanh(a)
@InlineOnly
public inline fun hypot(x: Double, y: Double): Double = nativeMath.hypot(x, y)
/**
* Raises the first argument [a] to the power of the second argument [b].
*
* Special cases:
* - `pow(x, 0.0)` is `1.0`
* - `pow(x, 1.0) == x`
* - `pow(x, NaN)` is `NaN`
* - `pow(NaN, x)` is `NaN` for `x != 0.0`
* - `pow(x, Inf)` is `NaN` for `abs(x) == 1.0`
* - `pow(x, y)` is `NaN` for `x < 0` and `y` is finite and not an integer
*/
@InlineOnly
public inline fun pow(a: Double, b: Double): Double = nativeMath.pow(a, b)
/**
* Raises the first argument [a] to the integer power of the second argument [b].
*
* See the other overload of [pow] for details.
*/
@InlineOnly
public inline fun pow(a: Double, b: Int): Double = nativeMath.pow(a, b.toDouble())
/**
* Computes the positive square root of the value [a].
*
@@ -226,18 +204,18 @@ public fun log(a: Double, base: Double): Double {
* Computes the natural logarithm (base `E`) of the [a] value.
*
* Special cases:
* - `log(NaN)` is `NaN`
* - `log(x)` is `NaN` when `x < 0.0`
* - `log(+Inf)` is `+Inf`
* - `log(0.0)` is `-Inf`
* - `ln(NaN)` is `NaN`
* - `ln(x)` is `NaN` when `x < 0.0`
* - `ln(+Inf)` is `+Inf`
* - `ln(0.0)` is `-Inf`
*/
@InlineOnly
public inline fun log(a: Double): Double = nativeMath.log(a)
public inline fun ln(a: Double): Double = nativeMath.log(a)
/**
* Computes the decimal logarithm (base 10) of the [a] value.
*
* @see [log] function for special cases.
* @see [ln] function for special cases.
*/
@InlineOnly
public inline fun log10(a: Double): Double = nativeMath.log10(a)
@@ -245,7 +223,7 @@ public inline fun log10(a: Double): Double = nativeMath.log10(a)
/**
* Computes the binary logarithm (base 2) of the [a] value.
*
* @see [log] function for special cases.
* @see [ln] function for special cases.
*/
@InlineOnly
public inline fun log2(a: Double): Double = nativeMath.log2(a)
@@ -261,10 +239,11 @@ public inline fun log2(a: Double): Double = nativeMath.log2(a)
* - `log1p(-1.0)` is `-Inf`
* - `log1p(+Inf)` is `+Inf`
*
* @see [log] function.
* @see [ln] function.
* @see [expm1] function
*/
@InlineOnly
public inline fun log1p(a: Double): Double = nativeMath.log1p(a)
public inline fun ln1p(a: Double): Double = nativeMath.log1p(a)
/**
* Rounds the given value [a] to an integer towards positive infinity.
@@ -354,8 +333,27 @@ public inline fun max(a: Double, b: Double): Double = nativeMath.max(a, b)
// extensions
inline fun Double.pow(other: Double): Double = nativeMath.pow(this, other)
inline fun Double.pow(other: Int): Double = nativeMath.pow(this, other.toDouble())
/**
* Raises this value to the power [other].
*
* Special cases:
* - `x.pow(0.0)` is `1.0`
* - `x.pow(1.0) == x`
* - `x.pow(NaN)` is `NaN`
* - `NaN.pow(x)` is `NaN` for `x != 0.0`
* - `x.pow(Inf)` is `NaN` for `abs(x) == 1.0`
* - `x.pow(y)` is `NaN` for `x < 0` and `y` is finite and not an integer
*/
@InlineOnly
public inline fun Double.pow(other: Double): Double = nativeMath.pow(this, other)
/**
* Raises this value to the integer power [other].
*
* See the other overload of [pow] for details.
*/
@InlineOnly
public inline fun Double.pow(other: Int): Double = nativeMath.pow(this, other.toDouble())
/**
* Returns the absolute value of this value.