diff --git a/js/js.libraries/src/core/math.kt b/js/js.libraries/src/core/math.kt index 623939e6b8d..068aa54824a 100644 --- a/js/js.libraries/src/core/math.kt +++ b/js/js.libraries/src/core/math.kt @@ -31,57 +31,57 @@ public const val E: Double = 2.718281828459045 // ================ Double Math ======================================== -/** Computes the sine of the angle [a] given in radians. +/** Computes the sine of the angle [x] given in radians. * * Special cases: * - `sin(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sin(a: Double): Double = nativeMath.sin(a) +public inline fun sin(x: Double): Double = nativeMath.sin(x) -/** Computes the cosine of the angle [a] given in radians. +/** Computes the cosine of the angle [x] given in radians. * * Special cases: * - `cos(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun cos(a: Double): Double = nativeMath.cos(a) +public inline fun cos(x: Double): Double = nativeMath.cos(x) -/** Computes the tangent of the angle [a] given in radians. +/** Computes the tangent of the angle [x] given in radians. * * Special cases: * - `tan(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun tan(a: Double): Double = nativeMath.tan(a) +public inline fun tan(x: Double): Double = nativeMath.tan(x) /** - * Computes the arc sine of the value [a]; + * Computes the arc sine of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: - * - `asin(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun asin(a: Double): Double = nativeMath.asin(a) +public inline fun asin(x: Double): Double = nativeMath.asin(x) /** - * Computes the arc cosine of the value [a]; + * Computes the arc cosine of the value [x]; * the returned value is an angle in the range from `0.0` to `PI` radians. * * Special cases: - * - `acos(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun acos(a: Double): Double = nativeMath.acos(a) +public inline fun acos(x: Double): Double = nativeMath.acos(x) /** - * Computes the arc tangent of the value [a]; + * Computes the arc tangent of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: @@ -89,7 +89,7 @@ public inline fun acos(a: Double): Double = nativeMath.acos(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun atan(a: Double): Double = nativeMath.atan(a) +public inline fun atan(x: Double): Double = nativeMath.atan(x) /** * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond @@ -112,7 +112,7 @@ public inline fun atan(a: Double): Double = nativeMath.atan(a) public inline fun atan2(y: Double, x: Double): Double = nativeMath.atan2(y, x) /** - * Computes the hyperbolic sine of the value [a]. + * Computes the hyperbolic sine of the value [x]. * * Special cases: * - `sinh(NaN)` is `NaN` @@ -121,10 +121,10 @@ public inline fun atan2(y: Double, x: Double): Double = nativeMath.atan2(y, x) */ @SinceKotlin("1.2") @InlineOnly -public inline fun sinh(a: Double): Double = nativeMath.sinh(a) +public inline fun sinh(x: Double): Double = nativeMath.sinh(x) /** - * Computes the hyperbolic cosine of the value [a]. + * Computes the hyperbolic cosine of the value [x]. * * Special cases: * - `cosh(NaN)` is `NaN` @@ -132,10 +132,10 @@ public inline fun sinh(a: Double): Double = nativeMath.sinh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun cosh(a: Double): Double = nativeMath.cosh(a) +public inline fun cosh(x: Double): Double = nativeMath.cosh(x) /** - * Computes the hyperbolic tangent of the value [a]. + * Computes the hyperbolic tangent of the value [x]. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -144,12 +144,12 @@ public inline fun cosh(a: Double): Double = nativeMath.cosh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun tanh(a: Double): Double = nativeMath.tanh(a) +public inline fun tanh(x: Double): Double = nativeMath.tanh(x) /** - * Computes the inverse hyperbolic sine of the value [a]. + * Computes the inverse hyperbolic sine of the value [x]. * - * The returned value is `x` such that `sinh(x) == a`. + * The returned value is `y` such that `sinh(y) == x`. * * Special cases: * - `asinh(NaN)` is `NaN` @@ -158,12 +158,12 @@ public inline fun tanh(a: Double): Double = nativeMath.tanh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun asinh(a: Double): Double = nativeMath.asinh(a) +public inline fun asinh(x: Double): Double = nativeMath.asinh(x) /** - * Computes the inverse hyperbolic cosine of the value [a]. + * Computes the inverse hyperbolic cosine of the value [x]. * - * The returned value is positive `x` such that `cosh(x) == a`. + * The returned value is positive `y` such that `cosh(y) == x`. * * Special cases: * - `acosh(NaN)` is `NaN` @@ -172,12 +172,12 @@ public inline fun asinh(a: Double): Double = nativeMath.asinh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun acosh(a: Double): Double = nativeMath.acosh(a) +public inline fun acosh(x: Double): Double = nativeMath.acosh(x) /** - * Computes the inverse hyperbolic tangent of the value [a]. + * Computes the inverse hyperbolic tangent of the value [x]. * - * The returned value is `x` such that `tanh(x) == a`. + * The returned value is `y` such that `tanh(y) == x`. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -187,7 +187,7 @@ public inline fun acosh(a: Double): Double = nativeMath.acosh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun atanh(a: Double): Double = nativeMath.atanh(a) +public inline fun atanh(x: Double): Double = nativeMath.atanh(x) /** * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow. @@ -201,17 +201,17 @@ public inline fun atanh(a: Double): Double = nativeMath.atanh(a) public inline fun hypot(x: Double, y: Double): Double = nativeMath.hypot(x, y) /** - * Computes the positive square root of the value [a]. + * Computes the positive square root of the value [x]. * * Special cases: * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sqrt(a: Double): Double = nativeMath.sqrt(a) +public inline fun sqrt(x: Double): Double = nativeMath.sqrt(x) /** - * Computes Euler's number `e` raised to the power of the value [a]. + * Computes Euler's number `e` raised to the power of the value [x]. * * Special cases: * - `exp(NaN)` is `NaN` @@ -220,12 +220,12 @@ public inline fun sqrt(a: Double): Double = nativeMath.sqrt(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun exp(a: Double): Double = nativeMath.exp(a) +public inline fun exp(x: Double): Double = nativeMath.exp(x) /** - * Computes `exp(a) - 1`. + * Computes `exp(x) - 1`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `expm1(NaN)` is `NaN` @@ -236,14 +236,14 @@ public inline fun exp(a: Double): Double = nativeMath.exp(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun expm1(a: Double): Double = nativeMath.expm1(a) +public inline fun expm1(x: Double): Double = nativeMath.expm1(x) /** - * Computes the logarithm of the value [a] to the given [base]. + * Computes the logarithm of the value [x] to the given [base]. * * Special cases: - * - `log(a, b)` is `NaN` if either `a` or `b` are `NaN` - * - `log(a, b)` is `NaN` when `a < 0` or `b <= 0` or `b == 1.0` + * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN` + * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0` * - `log(+Inf, +Inf)` is `NaN` * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1` * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1` @@ -251,13 +251,13 @@ public inline fun expm1(a: Double): Double = nativeMath.expm1(a) * See also logarithm functions for common fixed bases: [ln], [log10] and [log2]. */ @SinceKotlin("1.2") -public fun log(a: Double, base: Double): Double { +public fun log(x: Double, base: Double): Double { if (base <= 0.0 || base == 1.0) return Double.NaN - return nativeMath.log(a) / nativeMath.log(base) + return nativeMath.log(x) / nativeMath.log(base) } /** - * Computes the natural logarithm (base `E`) of the value [a]. + * Computes the natural logarithm (base `E`) of the value [x]. * * Special cases: * - `ln(NaN)` is `NaN` @@ -267,30 +267,30 @@ public fun log(a: Double, base: Double): Double { */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln(a: Double): Double = nativeMath.log(a) +public inline fun ln(x: Double): Double = nativeMath.log(x) /** - * Computes the common logarithm (base 10) of the value [a]. + * Computes the common logarithm (base 10) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") @InlineOnly -public inline fun log10(a: Double): Double = nativeMath.log10(a) +public inline fun log10(x: Double): Double = nativeMath.log10(x) /** - * Computes the binary logarithm (base 2) of the value [a]. + * Computes the binary logarithm (base 2) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") @InlineOnly -public inline fun log2(a: Double): Double = nativeMath.log2(a) +public inline fun log2(x: Double): Double = nativeMath.log2(x) /** - * Computes `ln(a + 1)`. + * Computes `ln(x + 1)`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `ln1p(NaN)` is `NaN` @@ -303,61 +303,61 @@ public inline fun log2(a: Double): Double = nativeMath.log2(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln1p(a: Double): Double = nativeMath.log1p(a) +public inline fun ln1p(x: Double): Double = nativeMath.log1p(x) /** - * Rounds the given value [a] to an integer towards positive infinity. + * Rounds the given value [x] to an integer towards positive infinity. - * @return the smallest double value that is greater than the given value [a] and is a mathematical integer. + * @return the smallest double value that is greater than the given value [x] and is a mathematical integer. * * Special cases: * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun ceil(a: Double): Double = nativeMath.ceil(a).unsafeCast() // TODO: Remove unsafe cast after removing public js.math +public inline fun ceil(x: Double): Double = nativeMath.ceil(x).unsafeCast() // TODO: Remove unsafe cast after removing public js.math /** - * Rounds the given value [a] to an integer towards negative infinity. + * Rounds the given value [x] to an integer towards negative infinity. - * @return the largest double value that is smaller than the given value [a] and is a mathematical integer. + * @return the largest double value that is smaller than the given value [x] and is a mathematical integer. * * Special cases: * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun floor(a: Double): Double = nativeMath.floor(a).unsafeCast() +public inline fun floor(x: Double): Double = nativeMath.floor(x).unsafeCast() /** - * Rounds the given value [a] to an integer towards zero. + * Rounds the given value [x] to an integer towards zero. * - * @return the value [a] having its fractional part truncated. + * @return the value [x] having its fractional part truncated. * * Special cases: * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun truncate(a: Double): Double = nativeMath.trunc(a) +public inline fun truncate(x: Double): Double = nativeMath.trunc(x) /** - * Rounds the given value [a] towards the closest integer with ties rounded towards even integer. + * Rounds the given value [x] towards the closest integer with ties rounded towards even integer. * * Special cases: * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public fun round(a: Double): Double { - if (a % 0.5 != 0.0) { - return nativeMath.round(a).unsafeCast() +public fun round(x: Double): Double { + if (x % 0.5 != 0.0) { + return nativeMath.round(x).unsafeCast() } - val floor = floor(a) - return if (floor % 2 == 0.0) floor else ceil(a) + val floor = floor(x) + return if (floor % 2 == 0.0) floor else ceil(x) } /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [x]. * * Special cases: * - `abs(NaN)` is `NaN` @@ -366,10 +366,10 @@ public fun round(a: Double): Double { */ @SinceKotlin("1.2") @InlineOnly -public inline fun abs(a: Double): Double = nativeMath.abs(a) +public inline fun abs(x: Double): Double = nativeMath.abs(x) /** - * Returns the sign of the given value [a]: + * Returns the sign of the given value [x]: * - `-1.0` if the value is negative, * - zero if the value is zero, * - `1.0` if the value is positive @@ -379,7 +379,7 @@ public inline fun abs(a: Double): Double = nativeMath.abs(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun sign(a: Double): Double = nativeMath.sign(a) +public inline fun sign(x: Double): Double = nativeMath.sign(x) /** @@ -402,28 +402,28 @@ public inline fun max(a: Double, b: Double): Double = nativeMath.max(a, b) // extensions /** - * Raises this value to the power [other]. + * Raises this value to the power [x]. * * Special cases: - * - `x.pow(0.0)` is `1.0` - * - `x.pow(1.0) == x` - * - `x.pow(NaN)` is `NaN` + * - `b.pow(0.0)` is `1.0` + * - `b.pow(1.0) == b` + * - `b.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 + * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0` + * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer */ @SinceKotlin("1.2") @InlineOnly -public inline fun Double.pow(other: Double): Double = nativeMath.pow(this, other) +public inline fun Double.pow(x: Double): Double = nativeMath.pow(this, x) /** - * Raises this value to the integer power [other]. + * Raises this value to the integer power [n]. * * See the other overload of [pow] for details. */ @SinceKotlin("1.2") @InlineOnly -public inline fun Double.pow(other: Int): Double = nativeMath.pow(this, other.toDouble()) +public inline fun Double.pow(n: Int): Double = nativeMath.pow(this, n.toDouble()) /** * Returns the absolute value of this value. @@ -566,57 +566,57 @@ public fun Double.roundToLong(): Long = when { // ================ Float Math ======================================== -/** Computes the sine of the angle [a] given in radians. +/** Computes the sine of the angle [x] given in radians. * * Special cases: * - `sin(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sin(a: Float): Float = nativeMath.sin(a.toDouble()).toFloat() +public inline fun sin(x: Float): Float = nativeMath.sin(x.toDouble()).toFloat() -/** Computes the cosine of the angle [a] given in radians. +/** Computes the cosine of the angle [x] given in radians. * * Special cases: * - `cos(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun cos(a: Float): Float = nativeMath.cos(a.toDouble()).toFloat() +public inline fun cos(x: Float): Float = nativeMath.cos(x.toDouble()).toFloat() -/** Computes the tangent of the angle [a] given in radians. +/** Computes the tangent of the angle [x] given in radians. * * Special cases: * - `tan(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun tan(a: Float): Float = nativeMath.tan(a.toDouble()).toFloat() +public inline fun tan(x: Float): Float = nativeMath.tan(x.toDouble()).toFloat() /** - * Computes the arc sine of the value [a]; + * Computes the arc sine of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: - * - `asin(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun asin(a: Float): Float = nativeMath.asin(a.toDouble()).toFloat() +public inline fun asin(x: Float): Float = nativeMath.asin(x.toDouble()).toFloat() /** - * Computes the arc cosine of the value [a]; + * Computes the arc cosine of the value [x]; * the returned value is an angle in the range from `0.0` to `PI` radians. * * Special cases: - * - `acos(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun acos(a: Float): Float = nativeMath.acos(a.toDouble()).toFloat() +public inline fun acos(x: Float): Float = nativeMath.acos(x.toDouble()).toFloat() /** - * Computes the arc tangent of the value [a]; + * Computes the arc tangent of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: @@ -624,7 +624,7 @@ public inline fun acos(a: Float): Float = nativeMath.acos(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun atan(a: Float): Float = nativeMath.atan(a.toDouble()).toFloat() +public inline fun atan(x: Float): Float = nativeMath.atan(x.toDouble()).toFloat() /** * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond @@ -647,7 +647,7 @@ public inline fun atan(a: Float): Float = nativeMath.atan(a.toDouble()).toFloat( public inline fun atan2(y: Float, x: Float): Float = nativeMath.atan2(y.toDouble(), x.toDouble()).toFloat() /** - * Computes the hyperbolic sine of the value [a]. + * Computes the hyperbolic sine of the value [x]. * * Special cases: * - `sinh(NaN)` is `NaN` @@ -656,10 +656,10 @@ public inline fun atan2(y: Float, x: Float): Float = nativeMath.atan2(y.toDouble */ @SinceKotlin("1.2") @InlineOnly -public inline fun sinh(a: Float): Float = nativeMath.sinh(a.toDouble()).toFloat() +public inline fun sinh(x: Float): Float = nativeMath.sinh(x.toDouble()).toFloat() /** - * Computes the hyperbolic cosine of the value [a]. + * Computes the hyperbolic cosine of the value [x]. * * Special cases: * - `cosh(NaN)` is `NaN` @@ -667,10 +667,10 @@ public inline fun sinh(a: Float): Float = nativeMath.sinh(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun cosh(a: Float): Float = nativeMath.cosh(a.toDouble()).toFloat() +public inline fun cosh(x: Float): Float = nativeMath.cosh(x.toDouble()).toFloat() /** - * Computes the hyperbolic tangent of the value [a]. + * Computes the hyperbolic tangent of the value [x]. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -679,12 +679,12 @@ public inline fun cosh(a: Float): Float = nativeMath.cosh(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun tanh(a: Float): Float = nativeMath.tanh(a.toDouble()).toFloat() +public inline fun tanh(x: Float): Float = nativeMath.tanh(x.toDouble()).toFloat() /** - * Computes the inverse hyperbolic sine of the value [a]. + * Computes the inverse hyperbolic sine of the value [x]. * - * The returned value is `x` such that `sinh(x) == a`. + * The returned value is `y` such that `sinh(y) == x`. * * Special cases: * - `asinh(NaN)` is `NaN` @@ -693,12 +693,12 @@ public inline fun tanh(a: Float): Float = nativeMath.tanh(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun asinh(a: Float): Float = nativeMath.asinh(a.toDouble()).toFloat() +public inline fun asinh(x: Float): Float = nativeMath.asinh(x.toDouble()).toFloat() /** - * Computes the inverse hyperbolic cosine of the value [a]. + * Computes the inverse hyperbolic cosine of the value [x]. * - * The returned value is positive `x` such that `cosh(x) == a`. + * The returned value is positive `y` such that `cosh(y) == x`. * * Special cases: * - `acosh(NaN)` is `NaN` @@ -707,12 +707,12 @@ public inline fun asinh(a: Float): Float = nativeMath.asinh(a.toDouble()).toFloa */ @SinceKotlin("1.2") @InlineOnly -public inline fun acosh(a: Float): Float = nativeMath.acosh(a.toDouble()).toFloat() +public inline fun acosh(x: Float): Float = nativeMath.acosh(x.toDouble()).toFloat() /** - * Computes the inverse hyperbolic tangent of the value [a]. + * Computes the inverse hyperbolic tangent of the value [x]. * - * The returned value is `x` such that `tanh(x) == a`. + * The returned value is `y` such that `tanh(y) == x`. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -722,7 +722,7 @@ public inline fun acosh(a: Float): Float = nativeMath.acosh(a.toDouble()).toFloa */ @SinceKotlin("1.2") @InlineOnly -public inline fun atanh(a: Float): Float = nativeMath.atanh(a.toDouble()).toFloat() +public inline fun atanh(x: Float): Float = nativeMath.atanh(x.toDouble()).toFloat() /** * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow. @@ -736,17 +736,17 @@ public inline fun atanh(a: Float): Float = nativeMath.atanh(a.toDouble()).toFloa public inline fun hypot(x: Float, y: Float): Float = nativeMath.hypot(x.toDouble(), y.toDouble()).toFloat() /** - * Computes the positive square root of the value [a]. + * Computes the positive square root of the value [x]. * * Special cases: * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sqrt(a: Float): Float = nativeMath.sqrt(a.toDouble()).toFloat() +public inline fun sqrt(x: Float): Float = nativeMath.sqrt(x.toDouble()).toFloat() /** - * Computes Euler's number `e` raised to the power of the value [a]. + * Computes Euler's number `e` raised to the power of the value [x]. * * Special cases: * - `exp(NaN)` is `NaN` @@ -755,12 +755,12 @@ public inline fun sqrt(a: Float): Float = nativeMath.sqrt(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun exp(a: Float): Float = nativeMath.exp(a.toDouble()).toFloat() +public inline fun exp(x: Float): Float = nativeMath.exp(x.toDouble()).toFloat() /** - * Computes `exp(a) - 1`. + * Computes `exp(x) - 1`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `expm1(NaN)` is `NaN` @@ -771,14 +771,14 @@ public inline fun exp(a: Float): Float = nativeMath.exp(a.toDouble()).toFloat() */ @SinceKotlin("1.2") @InlineOnly -public inline fun expm1(a: Float): Float = nativeMath.expm1(a.toDouble()).toFloat() +public inline fun expm1(x: Float): Float = nativeMath.expm1(x.toDouble()).toFloat() /** - * Computes the logarithm of the value [a] to the given [base]. + * Computes the logarithm of the value [x] to the given [base]. * * Special cases: - * - `log(a, b)` is `NaN` if either `a` or `b` are `NaN` - * - `log(a, b)` is `NaN` when `a < 0` or `b <= 0` or `b == 1.0` + * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN` + * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0` * - `log(+Inf, +Inf)` is `NaN` * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1` * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1` @@ -787,10 +787,10 @@ public inline fun expm1(a: Float): Float = nativeMath.expm1(a.toDouble()).toFloa */ @SinceKotlin("1.2") @InlineOnly -public inline fun log(a: Float, base: Float): Float = log(a.toDouble(), base.toDouble()).toFloat() +public inline fun log(x: Float, base: Float): Float = log(x.toDouble(), base.toDouble()).toFloat() /** - * Computes the natural logarithm (base `E`) of the value [a]. + * Computes the natural logarithm (base `E`) of the value [x]. * * Special cases: * - `ln(NaN)` is `NaN` @@ -800,30 +800,30 @@ public inline fun log(a: Float, base: Float): Float = log(a.toDouble(), base.toD */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln(a: Float): Float = nativeMath.log(a.toDouble()).toFloat() +public inline fun ln(x: Float): Float = nativeMath.log(x.toDouble()).toFloat() /** - * Computes the common logarithm (base 10) of the value [a]. + * Computes the common logarithm (base 10) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") @InlineOnly -public inline fun log10(a: Float): Float = nativeMath.log10(a.toDouble()).toFloat() +public inline fun log10(x: Float): Float = nativeMath.log10(x.toDouble()).toFloat() /** - * Computes the binary logarithm (base 2) of the value [a]. + * Computes the binary logarithm (base 2) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") @InlineOnly -public inline fun log2(a: Float): Float = nativeMath.log2(a.toDouble()).toFloat() +public inline fun log2(x: Float): Float = nativeMath.log2(x.toDouble()).toFloat() /** * Computes `ln(a + 1)`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `ln1p(NaN)` is `NaN` @@ -836,57 +836,57 @@ public inline fun log2(a: Float): Float = nativeMath.log2(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln1p(a: Float): Float = nativeMath.log1p(a.toDouble()).toFloat() +public inline fun ln1p(x: Float): Float = nativeMath.log1p(x.toDouble()).toFloat() /** - * Rounds the given value [a] to an integer towards positive infinity. + * Rounds the given value [x] to an integer towards positive infinity. - * @return the smallest Float value that is greater than the given value [a] and is a mathematical integer. + * @return the smallest Float value that is greater than the given value [x] and is a mathematical integer. * * Special cases: * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun ceil(a: Float): Float = nativeMath.ceil(a.toDouble()).toFloat() +public inline fun ceil(x: Float): Float = nativeMath.ceil(x.toDouble()).toFloat() /** - * Rounds the given value [a] to an integer towards negative infinity. + * Rounds the given value [x] to an integer towards negative infinity. - * @return the largest Float value that is smaller than the given value [a] and is a mathematical integer. + * @return the largest Float value that is smaller than the given value [x] and is a mathematical integer. * * Special cases: * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun floor(a: Float): Float = nativeMath.floor(a.toDouble()).toFloat() +public inline fun floor(x: Float): Float = nativeMath.floor(x.toDouble()).toFloat() /** - * Rounds the given value [a] to an integer towards zero. + * Rounds the given value [x] to an integer towards zero. * - * @return the value [a] having its fractional part truncated. + * @return the value [x] having its fractional part truncated. * * Special cases: * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun truncate(a: Float): Float = truncate(a.toDouble()).toFloat() +public inline fun truncate(x: Float): Float = truncate(x.toDouble()).toFloat() /** - * Rounds the given value [a] towards the closest integer with ties rounded towards even integer. + * Rounds the given value [x] towards the closest integer with ties rounded towards even integer. * * Special cases: * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun round(a: Float): Float = round(a.toDouble()).toFloat() +public inline fun round(x: Float): Float = round(x.toDouble()).toFloat() /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [x]. * * Special cases: * - `abs(NaN)` is `NaN` @@ -895,10 +895,10 @@ public inline fun round(a: Float): Float = round(a.toDouble()).toFloat() */ @SinceKotlin("1.2") @InlineOnly -public inline fun abs(a: Float): Float = nativeMath.abs(a.toDouble()).toFloat() +public inline fun abs(x: Float): Float = nativeMath.abs(x.toDouble()).toFloat() /** - * Returns the sign of the given value [a]: + * Returns the sign of the given value [x]: * - `-1.0` if the value is negative, * - zero if the value is zero, * - `1.0` if the value is positive @@ -908,7 +908,7 @@ public inline fun abs(a: Float): Float = nativeMath.abs(a.toDouble()).toFloat() */ @SinceKotlin("1.2") @InlineOnly -public inline fun sign(a: Float): Float = nativeMath.sign(a.toDouble()).toFloat() +public inline fun sign(x: Float): Float = nativeMath.sign(x.toDouble()).toFloat() @@ -933,28 +933,28 @@ public inline fun max(a: Float, b: Float): Float = nativeMath.max(a, b) /** - * Raises this value to the power [other]. + * Raises this value to the power [x]. * * Special cases: - * - `x.pow(0.0)` is `1.0` - * - `x.pow(1.0) == x` - * - `x.pow(NaN)` is `NaN` + * - `b.pow(0.0)` is `1.0` + * - `b.pow(1.0) == b` + * - `b.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 + * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0` + * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer */ @SinceKotlin("1.2") @InlineOnly -public inline fun Float.pow(other: Float): Float = nativeMath.pow(this.toDouble(), other.toDouble()).toFloat() +public inline fun Float.pow(x: Float): Float = nativeMath.pow(this.toDouble(), x.toDouble()).toFloat() /** - * Raises this value to the integer power [other]. + * Raises this value to the integer power [n]. * * See the other overload of [pow] for details. */ @SinceKotlin("1.2") @InlineOnly -public inline fun Float.pow(other: Int): Float = nativeMath.pow(this.toDouble(), other.toDouble()).toFloat() +public inline fun Float.pow(n: Int): Float = nativeMath.pow(this.toDouble(), n.toDouble()).toFloat() /** * Returns the absolute value of this value. @@ -1029,7 +1029,7 @@ public inline fun Float.roundToLong(): Long = toDouble().roundToLong() /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [n]. * * Special cases: * - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow @@ -1038,7 +1038,7 @@ public inline fun Float.roundToLong(): Long = toDouble().roundToLong() */ // TODO: remove manual 'or' when KT-19290 is fixed @SinceKotlin("1.2") -public fun abs(a: Int): Int = if (a < 0) (-a or 0) else a +public fun abs(n: Int): Int = if (n < 0) (-n or 0) else n /** * Returns the smaller of two values. @@ -1082,7 +1082,7 @@ public val Int.sign: Int get() = when { /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [n]. * * Special cases: * - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow @@ -1090,7 +1090,7 @@ public val Int.sign: Int get() = when { * @see absoluteValue extension property for [Long] */ @SinceKotlin("1.2") -public fun abs(a: Long): Long = if (a < 0) -a else a +public fun abs(n: Long): Long = if (n < 0) -n else n /** * Returns the smaller of two values. diff --git a/libraries/stdlib/common/src/kotlin/MathH.kt b/libraries/stdlib/common/src/kotlin/MathH.kt index 3e4fc38407c..a957faa94e3 100644 --- a/libraries/stdlib/common/src/kotlin/MathH.kt +++ b/libraries/stdlib/common/src/kotlin/MathH.kt @@ -29,59 +29,59 @@ public const val E: Double = 2.718281828459045 // ================ Double Math ======================================== -/** Computes the sine of the angle [a] given in radians. +/** Computes the sine of the angle [x] given in radians. * * Special cases: * - `sin(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") -public expect fun sin(a: Double): Double +public expect fun sin(x: Double): Double -/** Computes the cosine of the angle [a] given in radians. +/** Computes the cosine of the angle [x] given in radians. * * Special cases: * - `cos(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") -public expect fun cos(a: Double): Double +public expect fun cos(x: Double): Double -/** Computes the tangent of the angle [a] given in radians. +/** Computes the tangent of the angle [x] given in radians. * * Special cases: * - `tan(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") -public expect fun tan(a: Double): Double +public expect fun tan(x: Double): Double /** - * Computes the arc sine of the value [a]; + * Computes the arc sine of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: - * - `asin(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") -public expect fun asin(a: Double): Double +public expect fun asin(x: Double): Double /** - * Computes the arc cosine of the value [a]; + * Computes the arc cosine of the value [x]; * the returned value is an angle in the range from `0.0` to `PI` radians. * * Special cases: - * - `acos(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") -public expect fun acos(a: Double): Double +public expect fun acos(x: Double): Double /** - * Computes the arc tangent of the value [a]; + * Computes the arc tangent of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: * - `atan(NaN)` is `NaN` */ @SinceKotlin("1.2") -public expect fun atan(a: Double): Double +public expect fun atan(x: Double): Double /** * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond @@ -103,7 +103,7 @@ public expect fun atan(a: Double): Double public expect fun atan2(y: Double, x: Double): Double /** - * Computes the hyperbolic sine of the value [a]. + * Computes the hyperbolic sine of the value [x]. * * Special cases: * - `sinh(NaN)` is `NaN` @@ -111,20 +111,20 @@ public expect fun atan2(y: Double, x: Double): Double * - `sinh(-Inf)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun sinh(a: Double): Double +public expect fun sinh(x: Double): Double /** - * Computes the hyperbolic cosine of the value [a]. + * Computes the hyperbolic cosine of the value [x]. * * Special cases: * - `cosh(NaN)` is `NaN` * - `cosh(+Inf|-Inf)` is `+Inf` */ @SinceKotlin("1.2") -public expect fun cosh(a: Double): Double +public expect fun cosh(x: Double): Double /** - * Computes the hyperbolic tangent of the value [a]. + * Computes the hyperbolic tangent of the value [x]. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -132,12 +132,12 @@ public expect fun cosh(a: Double): Double * - `tanh(-Inf)` is `-1.0` */ @SinceKotlin("1.2") -public expect fun tanh(a: Double): Double +public expect fun tanh(x: Double): Double /** - * Computes the inverse hyperbolic sine of the value [a]. + * Computes the inverse hyperbolic sine of the value [x]. * - * The returned value is `x` such that `sinh(x) == a`. + * The returned value is `y` such that `sinh(y) == x`. * * Special cases: * - `asinh(NaN)` is `NaN` @@ -145,12 +145,12 @@ public expect fun tanh(a: Double): Double * - `asinh(-Inf)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun asinh(a: Double): Double +public expect fun asinh(x: Double): Double /** - * Computes the inverse hyperbolic cosine of the value [a]. + * Computes the inverse hyperbolic cosine of the value [x]. * - * The returned value is positive `x` such that `cosh(x) == a`. + * The returned value is positive `y` such that `cosh(y) == x`. * * Special cases: * - `acosh(NaN)` is `NaN` @@ -158,12 +158,12 @@ public expect fun asinh(a: Double): Double * - `acosh(+Inf)` is `+Inf` */ @SinceKotlin("1.2") -public expect fun acosh(a: Double): Double +public expect fun acosh(x: Double): Double /** - * Computes the inverse hyperbolic tangent of the value [a]. + * Computes the inverse hyperbolic tangent of the value [x]. * - * The returned value is `x` such that `tanh(x) == a`. + * The returned value is `y` such that `tanh(y) == x`. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -172,7 +172,7 @@ public expect fun acosh(a: Double): Double * - `tanh(-1.0)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun atanh(a: Double): Double +public expect fun atanh(x: Double): Double /** * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow. @@ -185,16 +185,16 @@ public expect fun atanh(a: Double): Double public expect fun hypot(x: Double, y: Double): Double /** - * Computes the positive square root of the value [a]. + * Computes the positive square root of the value [x]. * * Special cases: * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN` */ @SinceKotlin("1.2") -public expect fun sqrt(a: Double): Double +public expect fun sqrt(x: Double): Double /** - * Computes Euler's number `e` raised to the power of the value [a]. + * Computes Euler's number `e` raised to the power of the value [x]. * * Special cases: * - `exp(NaN)` is `NaN` @@ -202,12 +202,12 @@ public expect fun sqrt(a: Double): Double * - `exp(-Inf)` is `0.0` */ @SinceKotlin("1.2") -public expect fun exp(a: Double): Double +public expect fun exp(x: Double): Double /** - * Computes `exp(a) - 1`. + * Computes `exp(x) - 1`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `expm1(NaN)` is `NaN` @@ -217,14 +217,14 @@ public expect fun exp(a: Double): Double * @see [exp] function. */ @SinceKotlin("1.2") -public expect fun expm1(a: Double): Double +public expect fun expm1(x: Double): Double /** - * Computes the logarithm of the value [a] to the given [base]. + * Computes the logarithm of the value [x] to the given [base]. * * Special cases: - * - `log(a, b)` is `NaN` if either `a` or `b` are `NaN` - * - `log(a, b)` is `NaN` when `a < 0` or `b <= 0` or `b == 1.0` + * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN` + * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0` * - `log(+Inf, +Inf)` is `NaN` * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1` * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1` @@ -232,10 +232,10 @@ public expect fun expm1(a: Double): Double * See also logarithm functions for common fixed bases: [ln], [log10] and [log2]. */ @SinceKotlin("1.2") -public expect fun log(a: Double, base: Double): Double +public expect fun log(x: Double, base: Double): Double /** - * Computes the natural logarithm (base `E`) of the value [a]. + * Computes the natural logarithm (base `E`) of the value [x]. * * Special cases: * - `ln(NaN)` is `NaN` @@ -244,28 +244,28 @@ public expect fun log(a: Double, base: Double): Double * - `ln(0.0)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun ln(a: Double): Double +public expect fun ln(x: Double): Double /** - * Computes the common logarithm (base 10) of the value [a]. + * Computes the common logarithm (base 10) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") -public expect fun log10(a: Double): Double +public expect fun log10(x: Double): Double /** - * Computes the binary logarithm (base 2) of the value [a]. + * Computes the binary logarithm (base 2) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") -public expect fun log2(a: Double): Double +public expect fun log2(x: Double): Double /** - * Computes `ln(a + 1)`. + * Computes `ln(x + 1)`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `ln1p(NaN)` is `NaN` @@ -277,52 +277,52 @@ public expect fun log2(a: Double): Double * @see [expm1] function */ @SinceKotlin("1.2") -public expect fun ln1p(a: Double): Double +public expect fun ln1p(x: Double): Double /** - * Rounds the given value [a] to an integer towards positive infinity. + * Rounds the given value [x] to an integer towards positive infinity. - * @return the smallest double value that is greater than the given value [a] and is a mathematical integer. + * @return the smallest double value that is greater than the given value [x] and is a mathematical integer. * * Special cases: * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun ceil(a: Double): Double +public expect fun ceil(x: Double): Double /** - * Rounds the given value [a] to an integer towards negative infinity. + * Rounds the given value [x] to an integer towards negative infinity. - * @return the largest double value that is smaller than the given value [a] and is a mathematical integer. + * @return the largest double value that is smaller than the given value [x] and is a mathematical integer. * * Special cases: * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun floor(a: Double): Double +public expect fun floor(x: Double): Double /** - * Rounds the given value [a] to an integer towards zero. + * Rounds the given value [x] to an integer towards zero. * - * @return the value [a] having its fractional part truncated. + * @return the value [x] having its fractional part truncated. * * Special cases: * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun truncate(a: Double): Double +public expect fun truncate(x: Double): Double /** - * Rounds the given value [a] towards the closest integer with ties rounded towards even integer. + * Rounds the given value [x] towards the closest integer with ties rounded towards even integer. * * Special cases: * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun round(a: Double): Double +public expect fun round(x: Double): Double /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [x]. * * Special cases: * - `abs(NaN)` is `NaN` @@ -330,10 +330,10 @@ public expect fun round(a: Double): Double * @see absoluteValue extension property for [Double] */ @SinceKotlin("1.2") -public expect fun abs(a: Double): Double +public expect fun abs(x: Double): Double /** - * Returns the sign of the given value [a]: + * Returns the sign of the given value [x]: * - `-1.0` if the value is negative, * - zero if the value is zero, * - `1.0` if the value is positive @@ -342,7 +342,7 @@ public expect fun abs(a: Double): Double * - `sign(NaN)` is `NaN` */ @SinceKotlin("1.2") -public expect fun sign(a: Double): Double +public expect fun sign(x: Double): Double /** @@ -363,26 +363,26 @@ public expect fun max(a: Double, b: Double): Double // extensions /** - * Raises this value to the power [other]. + * Raises this value to the power [x]. * * Special cases: - * - `x.pow(0.0)` is `1.0` - * - `x.pow(1.0) == x` - * - `x.pow(NaN)` is `NaN` + * - `b.pow(0.0)` is `1.0` + * - `b.pow(1.0) == b` + * - `b.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 + * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0` + * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer */ @SinceKotlin("1.2") -public expect fun Double.pow(other: Double): Double +public expect fun Double.pow(x: Double): Double /** - * Raises this value to the integer power [other]. + * Raises this value to the integer power [n]. * * See the other overload of [pow] for details. */ @SinceKotlin("1.2") -public expect fun Double.pow(other: Int): Double +public expect fun Double.pow(n: Int): Double /** * Returns the absolute value of this value. @@ -487,59 +487,59 @@ public expect fun Double.roundToLong(): Long // ================ Float Math ======================================== -/** Computes the sine of the angle [a] given in radians. +/** Computes the sine of the angle [x] given in radians. * * Special cases: * - `sin(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") -public expect fun sin(a: Float): Float +public expect fun sin(x: Float): Float -/** Computes the cosine of the angle [a] given in radians. +/** Computes the cosine of the angle [x] given in radians. * * Special cases: * - `cos(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") -public expect fun cos(a: Float): Float +public expect fun cos(x: Float): Float -/** Computes the tangent of the angle [a] given in radians. +/** Computes the tangent of the angle [x] given in radians. * * Special cases: * - `tan(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") -public expect fun tan(a: Float): Float +public expect fun tan(x: Float): Float /** - * Computes the arc sine of the value [a]; + * Computes the arc sine of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: - * - `asin(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") -public expect fun asin(a: Float): Float +public expect fun asin(x: Float): Float /** - * Computes the arc cosine of the value [a]; + * Computes the arc cosine of the value [x]; * the returned value is an angle in the range from `0.0` to `PI` radians. * * Special cases: - * - `acos(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") -public expect fun acos(a: Float): Float +public expect fun acos(x: Float): Float /** - * Computes the arc tangent of the value [a]; + * Computes the arc tangent of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: * - `atan(NaN)` is `NaN` */ @SinceKotlin("1.2") -public expect fun atan(a: Float): Float +public expect fun atan(x: Float): Float /** * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond @@ -561,7 +561,7 @@ public expect fun atan(a: Float): Float public expect fun atan2(y: Float, x: Float): Float /** - * Computes the hyperbolic sine of the value [a]. + * Computes the hyperbolic sine of the value [x]. * * Special cases: * - `sinh(NaN)` is `NaN` @@ -569,20 +569,20 @@ public expect fun atan2(y: Float, x: Float): Float * - `sinh(-Inf)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun sinh(a: Float): Float +public expect fun sinh(x: Float): Float /** - * Computes the hyperbolic cosine of the value [a]. + * Computes the hyperbolic cosine of the value [x]. * * Special cases: * - `cosh(NaN)` is `NaN` * - `cosh(+Inf|-Inf)` is `+Inf` */ @SinceKotlin("1.2") -public expect fun cosh(a: Float): Float +public expect fun cosh(x: Float): Float /** - * Computes the hyperbolic tangent of the value [a]. + * Computes the hyperbolic tangent of the value [x]. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -590,12 +590,12 @@ public expect fun cosh(a: Float): Float * - `tanh(-Inf)` is `-1.0` */ @SinceKotlin("1.2") -public expect fun tanh(a: Float): Float +public expect fun tanh(x: Float): Float /** - * Computes the inverse hyperbolic sine of the value [a]. + * Computes the inverse hyperbolic sine of the value [x]. * - * The returned value is `x` such that `sinh(x) == a`. + * The returned value is `y` such that `sinh(y) == x`. * * Special cases: * - `asinh(NaN)` is `NaN` @@ -603,12 +603,12 @@ public expect fun tanh(a: Float): Float * - `asinh(-Inf)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun asinh(a: Float): Float +public expect fun asinh(x: Float): Float /** - * Computes the inverse hyperbolic cosine of the value [a]. + * Computes the inverse hyperbolic cosine of the value [x]. * - * The returned value is positive `x` such that `cosh(x) == a`. + * The returned value is positive `y` such that `cosh(y) == x`. * * Special cases: * - `acosh(NaN)` is `NaN` @@ -616,12 +616,12 @@ public expect fun asinh(a: Float): Float * - `acosh(+Inf)` is `+Inf` */ @SinceKotlin("1.2") -public expect fun acosh(a: Float): Float +public expect fun acosh(x: Float): Float /** - * Computes the inverse hyperbolic tangent of the value [a]. + * Computes the inverse hyperbolic tangent of the value [x]. * - * The returned value is `x` such that `tanh(x) == a`. + * The returned value is `y` such that `tanh(y) == x`. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -630,7 +630,7 @@ public expect fun acosh(a: Float): Float * - `tanh(-1.0)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun atanh(a: Float): Float +public expect fun atanh(x: Float): Float /** * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow. @@ -643,16 +643,16 @@ public expect fun atanh(a: Float): Float public expect fun hypot(x: Float, y: Float): Float /** - * Computes the positive square root of the value [a]. + * Computes the positive square root of the value [x]. * * Special cases: * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN` */ @SinceKotlin("1.2") -public expect fun sqrt(a: Float): Float +public expect fun sqrt(x: Float): Float /** - * Computes Euler's number `e` raised to the power of the value [a]. + * Computes Euler's number `e` raised to the power of the value [x]. * * Special cases: * - `exp(NaN)` is `NaN` @@ -660,12 +660,12 @@ public expect fun sqrt(a: Float): Float * - `exp(-Inf)` is `0.0` */ @SinceKotlin("1.2") -public expect fun exp(a: Float): Float +public expect fun exp(x: Float): Float /** - * Computes `exp(a) - 1`. + * Computes `exp(x) - 1`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `expm1(NaN)` is `NaN` @@ -675,14 +675,14 @@ public expect fun exp(a: Float): Float * @see [exp] function. */ @SinceKotlin("1.2") -public expect fun expm1(a: Float): Float +public expect fun expm1(x: Float): Float /** - * Computes the logarithm of the value [a] to the given [base]. + * Computes the logarithm of the value [x] to the given [base]. * * Special cases: - * - `log(a, b)` is `NaN` if either `a` or `b` are `NaN` - * - `log(a, b)` is `NaN` when `a < 0` or `b <= 0` or `b == 1.0` + * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN` + * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0` * - `log(+Inf, +Inf)` is `NaN` * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1` * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1` @@ -690,10 +690,10 @@ public expect fun expm1(a: Float): Float * See also logarithm functions for common fixed bases: [ln], [log10] and [log2]. */ @SinceKotlin("1.2") -public expect fun log(a: Float, base: Float): Float +public expect fun log(x: Float, base: Float): Float /** - * Computes the natural logarithm (base `E`) of the value [a]. + * Computes the natural logarithm (base `E`) of the value [x]. * * Special cases: * - `ln(NaN)` is `NaN` @@ -702,28 +702,28 @@ public expect fun log(a: Float, base: Float): Float * - `ln(0.0)` is `-Inf` */ @SinceKotlin("1.2") -public expect fun ln(a: Float): Float +public expect fun ln(x: Float): Float /** - * Computes the common logarithm (base 10) of the value [a]. + * Computes the common logarithm (base 10) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") -public expect fun log10(a: Float): Float +public expect fun log10(x: Float): Float /** - * Computes the binary logarithm (base 2) of the value [a]. + * Computes the binary logarithm (base 2) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") -public expect fun log2(a: Float): Float +public expect fun log2(x: Float): Float /** * Computes `ln(a + 1)`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `ln1p(NaN)` is `NaN` @@ -735,53 +735,53 @@ public expect fun log2(a: Float): Float * @see [expm1] function */ @SinceKotlin("1.2") -public expect fun ln1p(a: Float): Float +public expect fun ln1p(x: Float): Float /** - * Rounds the given value [a] to an integer towards positive infinity. + * Rounds the given value [x] to an integer towards positive infinity. - * @return the smallest Float value that is greater than the given value [a] and is a mathematical integer. + * @return the smallest Float value that is greater than the given value [x] and is a mathematical integer. * * Special cases: * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun ceil(a: Float): Float +public expect fun ceil(x: Float): Float /** - * Rounds the given value [a] to an integer towards negative infinity. + * Rounds the given value [x] to an integer towards negative infinity. - * @return the largest Float value that is smaller than the given value [a] and is a mathematical integer. + * @return the largest Float value that is smaller than the given value [x] and is a mathematical integer. * * Special cases: * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun floor(a: Float): Float +public expect fun floor(x: Float): Float /** - * Rounds the given value [a] to an integer towards zero. + * Rounds the given value [x] to an integer towards zero. * - * @return the value [a] having its fractional part truncated. + * @return the value [x] having its fractional part truncated. * * Special cases: * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun truncate(a: Float): Float +public expect fun truncate(x: Float): Float /** - * Rounds the given value [a] towards the closest integer with ties rounded towards even integer. + * Rounds the given value [x] towards the closest integer with ties rounded towards even integer. * * Special cases: * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public expect fun round(a: Float): Float +public expect fun round(x: Float): Float /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [x]. * * Special cases: * - `abs(NaN)` is `NaN` @@ -789,10 +789,10 @@ public expect fun round(a: Float): Float * @see absoluteValue extension property for [Float] */ @SinceKotlin("1.2") -public expect fun abs(a: Float): Float +public expect fun abs(x: Float): Float /** - * Returns the sign of the given value [a]: + * Returns the sign of the given value [x]: * - `-1.0` if the value is negative, * - zero if the value is zero, * - `1.0` if the value is positive @@ -801,7 +801,7 @@ public expect fun abs(a: Float): Float * - `sign(NaN)` is `NaN` */ @SinceKotlin("1.2") -public expect fun sign(a: Float): Float +public expect fun sign(x: Float): Float @@ -824,26 +824,26 @@ public expect fun max(a: Float, b: Float): Float /** - * Raises this value to the power [other]. + * Raises this value to the power [x]. * * Special cases: - * - `x.pow(0.0)` is `1.0` - * - `x.pow(1.0) == x` - * - `x.pow(NaN)` is `NaN` + * - `b.pow(0.0)` is `1.0` + * - `b.pow(1.0) == b` + * - `b.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 + * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0` + * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer */ @SinceKotlin("1.2") -public expect fun Float.pow(other: Float): Float +public expect fun Float.pow(x: Float): Float /** - * Raises this value to the integer power [other]. + * Raises this value to the integer power [n]. * * See the other overload of [pow] for details. */ @SinceKotlin("1.2") -public expect fun Float.pow(other: Int): Float +public expect fun Float.pow(n: Int): Float /** * Returns the absolute value of this value. @@ -912,7 +912,7 @@ public expect fun Float.roundToLong(): Long /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [n]. * * Special cases: * - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow @@ -920,7 +920,7 @@ public expect fun Float.roundToLong(): Long * @see absoluteValue extension property for [Int] */ @SinceKotlin("1.2") -public expect fun abs(a: Int): Int +public expect fun abs(n: Int): Int /** * Returns the smaller of two values. @@ -957,7 +957,7 @@ public expect val Int.sign: Int /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [n]. * * Special cases: * - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow @@ -965,7 +965,7 @@ public expect val Int.sign: Int * @see absoluteValue extension property for [Long] */ @SinceKotlin("1.2") -public expect fun abs(a: Long): Long +public expect fun abs(n: Long): Long /** * Returns the smaller of two values. diff --git a/libraries/stdlib/src/kotlin/util/MathJVM.kt b/libraries/stdlib/src/kotlin/util/MathJVM.kt index ddf59ab85dc..e44516ac829 100644 --- a/libraries/stdlib/src/kotlin/util/MathJVM.kt +++ b/libraries/stdlib/src/kotlin/util/MathJVM.kt @@ -40,57 +40,57 @@ private val upper_taylor_n_bound = 1 / taylor_n_bound // ================ Double Math ======================================== -/** Computes the sine of the angle [a] given in radians. +/** Computes the sine of the angle [x] given in radians. * * Special cases: * - `sin(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sin(a: Double): Double = nativeMath.sin(a) +public inline fun sin(x: Double): Double = nativeMath.sin(x) -/** Computes the cosine of the angle [a] given in radians. +/** Computes the cosine of the angle [x] given in radians. * * Special cases: * - `cos(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun cos(a: Double): Double = nativeMath.cos(a) +public inline fun cos(x: Double): Double = nativeMath.cos(x) -/** Computes the tangent of the angle [a] given in radians. +/** Computes the tangent of the angle [x] given in radians. * * Special cases: * - `tan(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun tan(a: Double): Double = nativeMath.tan(a) +public inline fun tan(x: Double): Double = nativeMath.tan(x) /** - * Computes the arc sine of the value [a]; + * Computes the arc sine of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: - * - `asin(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun asin(a: Double): Double = nativeMath.asin(a) +public inline fun asin(x: Double): Double = nativeMath.asin(x) /** - * Computes the arc cosine of the value [a]; + * Computes the arc cosine of the value [x]; * the returned value is an angle in the range from `0.0` to `PI` radians. * * Special cases: - * - `acos(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun acos(a: Double): Double = nativeMath.acos(a) +public inline fun acos(x: Double): Double = nativeMath.acos(x) /** - * Computes the arc tangent of the value [a]; + * Computes the arc tangent of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: @@ -98,7 +98,7 @@ public inline fun acos(a: Double): Double = nativeMath.acos(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun atan(a: Double): Double = nativeMath.atan(a) +public inline fun atan(x: Double): Double = nativeMath.atan(x) /** * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond @@ -121,7 +121,7 @@ public inline fun atan(a: Double): Double = nativeMath.atan(a) public inline fun atan2(y: Double, x: Double): Double = nativeMath.atan2(y, x) /** - * Computes the hyperbolic sine of the value [a]. + * Computes the hyperbolic sine of the value [x]. * * Special cases: * - `sinh(NaN)` is `NaN` @@ -130,10 +130,10 @@ public inline fun atan2(y: Double, x: Double): Double = nativeMath.atan2(y, x) */ @SinceKotlin("1.2") @InlineOnly -public inline fun sinh(a: Double): Double = nativeMath.sinh(a) +public inline fun sinh(x: Double): Double = nativeMath.sinh(x) /** - * Computes the hyperbolic cosine of the value [a]. + * Computes the hyperbolic cosine of the value [x]. * * Special cases: * - `cosh(NaN)` is `NaN` @@ -141,10 +141,10 @@ public inline fun sinh(a: Double): Double = nativeMath.sinh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun cosh(a: Double): Double = nativeMath.cosh(a) +public inline fun cosh(x: Double): Double = nativeMath.cosh(x) /** - * Computes the hyperbolic tangent of the value [a]. + * Computes the hyperbolic tangent of the value [x]. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -153,16 +153,16 @@ public inline fun cosh(a: Double): Double = nativeMath.cosh(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun tanh(a: Double): Double = nativeMath.tanh(a) +public inline fun tanh(x: Double): Double = nativeMath.tanh(x) // Inverse hyperbolic function implementations derived from boost special math functions, // Copyright Eric Ford & Hubert Holin 2001. /** - * Computes the inverse hyperbolic sine of the value [a]. + * Computes the inverse hyperbolic sine of the value [x]. * - * The returned value is `x` such that `sinh(x) == a`. + * The returned value is `y` such that `sinh(y) == x`. * * Special cases: * - `asinh(NaN)` is `NaN` @@ -170,27 +170,27 @@ public inline fun tanh(a: Double): Double = nativeMath.tanh(a) * - `asinh(-Inf)` is `-Inf` */ @SinceKotlin("1.2") -public fun asinh(a: Double): Double = +public fun asinh(x: Double): Double = when { - a >= +taylor_n_bound -> - if (a > upper_taylor_n_bound) { - if (a > upper_taylor_2_bound) { + x >= +taylor_n_bound -> + if (x > upper_taylor_n_bound) { + if (x > upper_taylor_2_bound) { // approximation by laurent series in 1/x at 0+ order from -1 to 0 - nativeMath.log(a) + LN2 + nativeMath.log(x) + LN2 } else { // approximation by laurent series in 1/x at 0+ order from -1 to 1 - nativeMath.log(a * 2 + (1 / (a * 2))) + nativeMath.log(x * 2 + (1 / (x * 2))) } } else { - nativeMath.log(a + nativeMath.sqrt(a * a + 1)) + nativeMath.log(x + nativeMath.sqrt(x * x + 1)) } - a <= -taylor_n_bound -> -asinh(-a) + x <= -taylor_n_bound -> -asinh(-x) else -> { // approximation by taylor series in x at 0 up to order 2 - var result = a; - if (nativeMath.abs(a) >= taylor_2_bound) { + var result = x; + if (nativeMath.abs(x) >= taylor_2_bound) { // approximation by taylor series in x at 0 up to order 4 - result -= (a * a * a) / 6 + result -= (x * x * x) / 6 } result } @@ -198,9 +198,9 @@ public fun asinh(a: Double): Double = /** - * Computes the inverse hyperbolic cosine of the value [a]. + * Computes the inverse hyperbolic cosine of the value [x]. * - * The returned value is positive `x` such that `cosh(x) == a`. + * The returned value is positive `y` such that `cosh(y) == x`. * * Special cases: * - `acosh(NaN)` is `NaN` @@ -208,19 +208,19 @@ public fun asinh(a: Double): Double = * - `acosh(+Inf)` is `+Inf` */ @SinceKotlin("1.2") -public fun acosh(a: Double): Double = +public fun acosh(x: Double): Double = when { - a < 1 -> Double.NaN + x < 1 -> Double.NaN - a > upper_taylor_2_bound -> + x > upper_taylor_2_bound -> // approximation by laurent series in 1/x at 0+ order from -1 to 0 - nativeMath.log(a) + LN2 + nativeMath.log(x) + LN2 - a - 1 >= taylor_n_bound -> - nativeMath.log(a + nativeMath.sqrt(a * a - 1)) + x - 1 >= taylor_n_bound -> + nativeMath.log(x + nativeMath.sqrt(x * x - 1)) else -> { - val y = nativeMath.sqrt(a - 1) + val y = nativeMath.sqrt(x - 1) // approximation by taylor series in y at 0 up to order 2 var result = y if (y >= taylor_2_bound) { @@ -233,9 +233,9 @@ public fun acosh(a: Double): Double = } /** - * Computes the inverse hyperbolic tangent of the value [a]. + * Computes the inverse hyperbolic tangent of the value [x]. * - * The returned value is `x` such that `tanh(x) == a`. + * The returned value is `y` such that `tanh(y) == x`. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -267,17 +267,17 @@ public fun atanh(x: Double): Double { public inline fun hypot(x: Double, y: Double): Double = nativeMath.hypot(x, y) /** - * Computes the positive square root of the value [a]. + * Computes the positive square root of the value [x]. * * Special cases: * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sqrt(a: Double): Double = nativeMath.sqrt(a) +public inline fun sqrt(x: Double): Double = nativeMath.sqrt(x) /** - * Computes Euler's number `e` raised to the power of the value [a]. + * Computes Euler's number `e` raised to the power of the value [x]. * * Special cases: * - `exp(NaN)` is `NaN` @@ -286,12 +286,12 @@ public inline fun sqrt(a: Double): Double = nativeMath.sqrt(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun exp(a: Double): Double = nativeMath.exp(a) +public inline fun exp(x: Double): Double = nativeMath.exp(x) /** - * Computes `exp(a) - 1`. + * Computes `exp(x) - 1`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `expm1(NaN)` is `NaN` @@ -302,14 +302,14 @@ public inline fun exp(a: Double): Double = nativeMath.exp(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun expm1(a: Double): Double = nativeMath.expm1(a) +public inline fun expm1(x: Double): Double = nativeMath.expm1(x) /** - * Computes the logarithm of the value [a] to the given [base]. + * Computes the logarithm of the value [x] to the given [base]. * * Special cases: - * - `log(a, b)` is `NaN` if either `a` or `b` are `NaN` - * - `log(a, b)` is `NaN` when `a < 0` or `b <= 0` or `b == 1.0` + * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN` + * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0` * - `log(+Inf, +Inf)` is `NaN` * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1` * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1` @@ -317,13 +317,13 @@ public inline fun expm1(a: Double): Double = nativeMath.expm1(a) * See also logarithm functions for common fixed bases: [ln], [log10] and [log2]. */ @SinceKotlin("1.2") -public fun log(a: Double, base: Double): Double { +public fun log(x: Double, base: Double): Double { if (base <= 0.0 || base == 1.0) return Double.NaN - return nativeMath.log(a) / nativeMath.log(base) + return nativeMath.log(x) / nativeMath.log(base) } /** - * Computes the natural logarithm (base `E`) of the value [a]. + * Computes the natural logarithm (base `E`) of the value [x]. * * Special cases: * - `ln(NaN)` is `NaN` @@ -333,29 +333,29 @@ public fun log(a: Double, base: Double): Double { */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln(a: Double): Double = nativeMath.log(a) +public inline fun ln(x: Double): Double = nativeMath.log(x) /** - * Computes the common logarithm (base 10) of the value [a]. + * Computes the common logarithm (base 10) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") @InlineOnly -public inline fun log10(a: Double): Double = nativeMath.log10(a) +public inline fun log10(x: Double): Double = nativeMath.log10(x) /** - * Computes the binary logarithm (base 2) of the value [a]. + * Computes the binary logarithm (base 2) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") -public fun log2(a: Double): Double = nativeMath.log(a) / LN2 +public fun log2(x: Double): Double = nativeMath.log(x) / LN2 /** - * Computes `ln(a + 1)`. + * Computes `ln(x + 1)`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `ln1p(NaN)` is `NaN` @@ -368,60 +368,60 @@ public fun log2(a: Double): Double = nativeMath.log(a) / LN2 */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln1p(a: Double): Double = nativeMath.log1p(a) +public inline fun ln1p(x: Double): Double = nativeMath.log1p(x) /** - * Rounds the given value [a] to an integer towards positive infinity. + * Rounds the given value [x] to an integer towards positive infinity. - * @return the smallest double value that is greater than the given value [a] and is a mathematical integer. + * @return the smallest double value that is greater than the given value [x] and is a mathematical integer. * * Special cases: * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun ceil(a: Double): Double = nativeMath.ceil(a) +public inline fun ceil(x: Double): Double = nativeMath.ceil(x) /** - * Rounds the given value [a] to an integer towards negative infinity. + * Rounds the given value [x] to an integer towards negative infinity. - * @return the largest double value that is smaller than the given value [a] and is a mathematical integer. + * @return the largest double value that is smaller than the given value [x] and is a mathematical integer. * * Special cases: * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun floor(a: Double): Double = nativeMath.floor(a) +public inline fun floor(x: Double): Double = nativeMath.floor(x) /** - * Rounds the given value [a] to an integer towards zero. + * Rounds the given value [x] to an integer towards zero. * - * @return the value [a] having its fractional part truncated. + * @return the value [x] having its fractional part truncated. * * Special cases: * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public fun truncate(a: Double): Double = when { - a.isNaN() || a.isInfinite() -> a - a > 0 -> floor(a) - else -> ceil(a) +public fun truncate(x: Double): Double = when { + x.isNaN() || x.isInfinite() -> x + x > 0 -> floor(x) + else -> ceil(x) } /** - * Rounds the given value [a] towards the closest integer with ties rounded towards even integer. + * Rounds the given value [x] towards the closest integer with ties rounded towards even integer. * * Special cases: * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun round(a: Double): Double = nativeMath.rint(a) +public inline fun round(x: Double): Double = nativeMath.rint(x) /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [x]. * * Special cases: * - `abs(NaN)` is `NaN` @@ -430,10 +430,10 @@ public inline fun round(a: Double): Double = nativeMath.rint(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun abs(a: Double): Double = nativeMath.abs(a) +public inline fun abs(x: Double): Double = nativeMath.abs(x) /** - * Returns the sign of the given value [a]: + * Returns the sign of the given value [x]: * - `-1.0` if the value is negative, * - zero if the value is zero, * - `1.0` if the value is positive @@ -443,7 +443,7 @@ public inline fun abs(a: Double): Double = nativeMath.abs(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun sign(a: Double): Double = nativeMath.signum(a) +public inline fun sign(x: Double): Double = nativeMath.signum(x) @@ -468,33 +468,33 @@ public inline fun max(a: Double, b: Double): Double = nativeMath.max(a, b) /** - * Raises this value to the power [other]. + * Raises this value to the power [x]. * * Special cases: - * - `x.pow(0.0)` is `1.0` - * - `x.pow(1.0) == x` - * - `x.pow(NaN)` is `NaN` + * - `b.pow(0.0)` is `1.0` + * - `b.pow(1.0) == b` + * - `b.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 + * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0` + * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer */ @SinceKotlin("1.2") @InlineOnly -public inline fun Double.pow(other: Double): Double = nativeMath.pow(this, other) +public inline fun Double.pow(x: Double): Double = nativeMath.pow(this, x) /** - * Raises this value to the integer power [other]. + * Raises this value to the integer power [n]. * * See the other overload of [pow] for details. */ @SinceKotlin("1.2") @InlineOnly -public inline fun Double.pow(other: Int): Double = nativeMath.pow(this, other.toDouble()) +public inline fun Double.pow(n: Int): Double = nativeMath.pow(this, n.toDouble()) /** - * Computes the remainder of division of this value by the [other] value according to the IEEE 754 standard. + * Computes the remainder of division of this value by the [divisor] value according to the IEEE 754 standard. * - * The result is computed as `r = this - (q * other)` where `q` is the quotient of division rounded to the nearest integer, + * The result is computed as `r = this - (q * divisor)` where `q` is the quotient of division rounded to the nearest integer, * `q = round(this / other)`. * * Special cases: @@ -505,7 +505,7 @@ public inline fun Double.pow(other: Int): Double = nativeMath.pow(this, other.to */ @SinceKotlin("1.2") @InlineOnly -public inline fun Double.IEEErem(other: Double): Double = nativeMath.IEEEremainder(this, other) +public inline fun Double.IEEErem(divisor: Double): Double = nativeMath.IEEEremainder(this, divisor) /** * Returns the absolute value of this value. @@ -621,57 +621,57 @@ public fun Double.roundToLong(): Long = if (isNaN()) throw IllegalArgumentExcept // ================ Float Math ======================================== -/** Computes the sine of the angle [a] given in radians. +/** Computes the sine of the angle [x] given in radians. * * Special cases: * - `sin(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sin(a: Float): Float = nativeMath.sin(a.toDouble()).toFloat() +public inline fun sin(x: Float): Float = nativeMath.sin(x.toDouble()).toFloat() -/** Computes the cosine of the angle [a] given in radians. +/** Computes the cosine of the angle [x] given in radians. * * Special cases: * - `cos(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun cos(a: Float): Float = nativeMath.cos(a.toDouble()).toFloat() +public inline fun cos(x: Float): Float = nativeMath.cos(x.toDouble()).toFloat() -/** Computes the tangent of the angle [a] given in radians. +/** Computes the tangent of the angle [x] given in radians. * * Special cases: * - `tan(NaN|+Inf|-Inf)` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun tan(a: Float): Float = nativeMath.tan(a.toDouble()).toFloat() +public inline fun tan(x: Float): Float = nativeMath.tan(x.toDouble()).toFloat() /** - * Computes the arc sine of the value [a]; + * Computes the arc sine of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: - * - `asin(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun asin(a: Float): Float = nativeMath.asin(a.toDouble()).toFloat() +public inline fun asin(x: Float): Float = nativeMath.asin(x.toDouble()).toFloat() /** - * Computes the arc cosine of the value [a]; + * Computes the arc cosine of the value [x]; * the returned value is an angle in the range from `0.0` to `PI` radians. * * Special cases: - * - `acos(v)` is `NaN`, when `abs(v) > 1` or v is `NaN` + * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun acos(a: Float): Float = nativeMath.acos(a.toDouble()).toFloat() +public inline fun acos(x: Float): Float = nativeMath.acos(x.toDouble()).toFloat() /** - * Computes the arc tangent of the value [a]; + * Computes the arc tangent of the value [x]; * the returned value is an angle in the range from `-PI/2` to `PI/2` radians. * * Special cases: @@ -679,7 +679,7 @@ public inline fun acos(a: Float): Float = nativeMath.acos(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun atan(a: Float): Float = nativeMath.atan(a.toDouble()).toFloat() +public inline fun atan(x: Float): Float = nativeMath.atan(x.toDouble()).toFloat() /** * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond @@ -702,7 +702,7 @@ public inline fun atan(a: Float): Float = nativeMath.atan(a.toDouble()).toFloat( public inline fun atan2(y: Float, x: Float): Float = nativeMath.atan2(y.toDouble(), x.toDouble()).toFloat() /** - * Computes the hyperbolic sine of the value [a]. + * Computes the hyperbolic sine of the value [x]. * * Special cases: * - `sinh(NaN)` is `NaN` @@ -711,10 +711,10 @@ public inline fun atan2(y: Float, x: Float): Float = nativeMath.atan2(y.toDouble */ @SinceKotlin("1.2") @InlineOnly -public inline fun sinh(a: Float): Float = nativeMath.sinh(a.toDouble()).toFloat() +public inline fun sinh(x: Float): Float = nativeMath.sinh(x.toDouble()).toFloat() /** - * Computes the hyperbolic cosine of the value [a]. + * Computes the hyperbolic cosine of the value [x]. * * Special cases: * - `cosh(NaN)` is `NaN` @@ -722,10 +722,10 @@ public inline fun sinh(a: Float): Float = nativeMath.sinh(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun cosh(a: Float): Float = nativeMath.cosh(a.toDouble()).toFloat() +public inline fun cosh(x: Float): Float = nativeMath.cosh(x.toDouble()).toFloat() /** - * Computes the hyperbolic tangent of the value [a]. + * Computes the hyperbolic tangent of the value [x]. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -734,12 +734,12 @@ public inline fun cosh(a: Float): Float = nativeMath.cosh(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun tanh(a: Float): Float = nativeMath.tanh(a.toDouble()).toFloat() +public inline fun tanh(x: Float): Float = nativeMath.tanh(x.toDouble()).toFloat() /** - * Computes the inverse hyperbolic sine of the value [a]. + * Computes the inverse hyperbolic sine of the value [x]. * - * The returned value is `x` such that `sinh(x) == a`. + * The returned value is `y` such that `sinh(y) == x`. * * Special cases: * - `asinh(NaN)` is `NaN` @@ -748,12 +748,12 @@ public inline fun tanh(a: Float): Float = nativeMath.tanh(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun asinh(a: Float): Float = asinh(a.toDouble()).toFloat() +public inline fun asinh(x: Float): Float = asinh(x.toDouble()).toFloat() /** - * Computes the inverse hyperbolic cosine of the value [a]. + * Computes the inverse hyperbolic cosine of the value [x]. * - * The returned value is positive `x` such that `cosh(x) == a`. + * The returned value is positive `y` such that `cosh(y) == x`. * * Special cases: * - `acosh(NaN)` is `NaN` @@ -762,12 +762,12 @@ public inline fun asinh(a: Float): Float = asinh(a.toDouble()).toFloat() */ @SinceKotlin("1.2") @InlineOnly -public inline fun acosh(a: Float): Float = acosh(a.toDouble()).toFloat() +public inline fun acosh(x: Float): Float = acosh(x.toDouble()).toFloat() /** - * Computes the inverse hyperbolic tangent of the value [a]. + * Computes the inverse hyperbolic tangent of the value [x]. * - * The returned value is `x` such that `tanh(x) == a`. + * The returned value is `y` such that `tanh(y) == x`. * * Special cases: * - `tanh(NaN)` is `NaN` @@ -777,7 +777,7 @@ public inline fun acosh(a: Float): Float = acosh(a.toDouble()).toFloat() */ @SinceKotlin("1.2") @InlineOnly -public inline fun atanh(a: Float): Float = atanh(a.toDouble()).toFloat() +public inline fun atanh(x: Float): Float = atanh(x.toDouble()).toFloat() /** * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow. @@ -791,17 +791,17 @@ public inline fun atanh(a: Float): Float = atanh(a.toDouble()).toFloat() public inline fun hypot(x: Float, y: Float): Float = nativeMath.hypot(x.toDouble(), y.toDouble()).toFloat() /** - * Computes the positive square root of the value [a]. + * Computes the positive square root of the value [x]. * * Special cases: * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN` */ @SinceKotlin("1.2") @InlineOnly -public inline fun sqrt(a: Float): Float = nativeMath.sqrt(a.toDouble()).toFloat() +public inline fun sqrt(x: Float): Float = nativeMath.sqrt(x.toDouble()).toFloat() /** - * Computes Euler's number `e` raised to the power of the value [a]. + * Computes Euler's number `e` raised to the power of the value [x]. * * Special cases: * - `exp(NaN)` is `NaN` @@ -810,12 +810,12 @@ public inline fun sqrt(a: Float): Float = nativeMath.sqrt(a.toDouble()).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun exp(a: Float): Float = nativeMath.exp(a.toDouble()).toFloat() +public inline fun exp(x: Float): Float = nativeMath.exp(x.toDouble()).toFloat() /** - * Computes `exp(a) - 1`. + * Computes `exp(x) - 1`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `expm1(NaN)` is `NaN` @@ -826,14 +826,14 @@ public inline fun exp(a: Float): Float = nativeMath.exp(a.toDouble()).toFloat() */ @SinceKotlin("1.2") @InlineOnly -public inline fun expm1(a: Float): Float = nativeMath.expm1(a.toDouble()).toFloat() +public inline fun expm1(x: Float): Float = nativeMath.expm1(x.toDouble()).toFloat() /** - * Computes the logarithm of the value [a] to the given [base]. + * Computes the logarithm of the value [x] to the given [base]. * * Special cases: - * - `log(a, b)` is `NaN` if either `a` or `b` are `NaN` - * - `log(a, b)` is `NaN` when `a < 0` or `b <= 0` or `b == 1.0` + * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN` + * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0` * - `log(+Inf, +Inf)` is `NaN` * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1` * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1` @@ -841,13 +841,13 @@ public inline fun expm1(a: Float): Float = nativeMath.expm1(a.toDouble()).toFloa * See also logarithm functions for common fixed bases: [ln], [log10] and [log2]. */ @SinceKotlin("1.2") -public fun log(a: Float, base: Float): Float { +public fun log(x: Float, base: Float): Float { if (base <= 0.0F || base == 1.0F) return Float.NaN - return (nativeMath.log(a.toDouble()) / nativeMath.log(base.toDouble())).toFloat() + return (nativeMath.log(x.toDouble()) / nativeMath.log(base.toDouble())).toFloat() } /** - * Computes the natural logarithm (base `E`) of the value [a]. + * Computes the natural logarithm (base `E`) of the value [x]. * * Special cases: * - `ln(NaN)` is `NaN` @@ -857,29 +857,29 @@ public fun log(a: Float, base: Float): Float { */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln(a: Float): Float = nativeMath.log(a.toDouble()).toFloat() +public inline fun ln(x: Float): Float = nativeMath.log(x.toDouble()).toFloat() /** - * Computes the common logarithm (base 10) of the value [a]. + * Computes the common logarithm (base 10) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") @InlineOnly -public inline fun log10(a: Float): Float = nativeMath.log10(a.toDouble()).toFloat() +public inline fun log10(x: Float): Float = nativeMath.log10(x.toDouble()).toFloat() /** - * Computes the binary logarithm (base 2) of the value [a]. + * Computes the binary logarithm (base 2) of the value [x]. * * @see [ln] function for special cases. */ @SinceKotlin("1.2") -public fun log2(a: Float): Float = (nativeMath.log(a.toDouble()) / LN2).toFloat() +public fun log2(x: Float): Float = (nativeMath.log(x.toDouble()) / LN2).toFloat() /** * Computes `ln(a + 1)`. * - * This function can be implemented to produce more precise result for [a] near zero. + * This function can be implemented to produce more precise result for [x] near zero. * * Special cases: * - `ln1p(NaN)` is `NaN` @@ -892,60 +892,60 @@ public fun log2(a: Float): Float = (nativeMath.log(a.toDouble()) / LN2).toFloat( */ @SinceKotlin("1.2") @InlineOnly -public inline fun ln1p(a: Float): Float = nativeMath.log1p(a.toDouble()).toFloat() +public inline fun ln1p(x: Float): Float = nativeMath.log1p(x.toDouble()).toFloat() /** - * Rounds the given value [a] to an integer towards positive infinity. + * Rounds the given value [x] to an integer towards positive infinity. - * @return the smallest Float value that is greater than the given value [a] and is a mathematical integer. + * @return the smallest Float value that is greater than the given value [x] and is a mathematical integer. * * Special cases: * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun ceil(a: Float): Float = nativeMath.ceil(a.toDouble()).toFloat() +public inline fun ceil(x: Float): Float = nativeMath.ceil(x.toDouble()).toFloat() /** - * Rounds the given value [a] to an integer towards negative infinity. + * Rounds the given value [x] to an integer towards negative infinity. - * @return the largest Float value that is smaller than the given value [a] and is a mathematical integer. + * @return the largest Float value that is smaller than the given value [x] and is a mathematical integer. * * Special cases: * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun floor(a: Float): Float = nativeMath.floor(a.toDouble()).toFloat() +public inline fun floor(x: Float): Float = nativeMath.floor(x.toDouble()).toFloat() /** - * Rounds the given value [a] to an integer towards zero. + * Rounds the given value [x] to an integer towards zero. * - * @return the value [a] having its fractional part truncated. + * @return the value [x] having its fractional part truncated. * * Special cases: * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") -public fun truncate(a: Float): Float = when { - a.isNaN() || a.isInfinite() -> a - a > 0 -> floor(a) - else -> ceil(a) +public fun truncate(x: Float): Float = when { + x.isNaN() || x.isInfinite() -> x + x > 0 -> floor(x) + else -> ceil(x) } /** - * Rounds the given value [a] towards the closest integer with ties rounded towards even integer. + * Rounds the given value [x] towards the closest integer with ties rounded towards even integer. * * Special cases: * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer. */ @SinceKotlin("1.2") @InlineOnly -public inline fun round(a: Float): Float = nativeMath.rint(a.toDouble()).toFloat() +public inline fun round(x: Float): Float = nativeMath.rint(x.toDouble()).toFloat() /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [x]. * * Special cases: * - `abs(NaN)` is `NaN` @@ -954,10 +954,10 @@ public inline fun round(a: Float): Float = nativeMath.rint(a.toDouble()).toFloat */ @SinceKotlin("1.2") @InlineOnly -public inline fun abs(a: Float): Float = nativeMath.abs(a) +public inline fun abs(x: Float): Float = nativeMath.abs(x) /** - * Returns the sign of the given value [a]: + * Returns the sign of the given value [x]: * - `-1.0` if the value is negative, * - zero if the value is zero, * - `1.0` if the value is positive @@ -967,7 +967,7 @@ public inline fun abs(a: Float): Float = nativeMath.abs(a) */ @SinceKotlin("1.2") @InlineOnly -public inline fun sign(a: Float): Float = nativeMath.signum(a) +public inline fun sign(x: Float): Float = nativeMath.signum(x) @@ -992,33 +992,33 @@ public inline fun max(a: Float, b: Float): Float = nativeMath.max(a, b) /** - * Raises this value to the power [other]. + * Raises this value to the power [x]. * * Special cases: - * - `x.pow(0.0)` is `1.0` - * - `x.pow(1.0) == x` - * - `x.pow(NaN)` is `NaN` + * - `b.pow(0.0)` is `1.0` + * - `b.pow(1.0) == b` + * - `b.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 + * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0` + * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer */ @SinceKotlin("1.2") @InlineOnly -public inline fun Float.pow(other: Float): Float = nativeMath.pow(this.toDouble(), other.toDouble()).toFloat() +public inline fun Float.pow(x: Float): Float = nativeMath.pow(this.toDouble(), x.toDouble()).toFloat() /** - * Raises this value to the integer power [other]. + * Raises this value to the integer power [n]. * * See the other overload of [pow] for details. */ @SinceKotlin("1.2") @InlineOnly -public inline fun Float.pow(other: Int): Float = nativeMath.pow(this.toDouble(), other.toDouble()).toFloat() +public inline fun Float.pow(n: Int): Float = nativeMath.pow(this.toDouble(), n.toDouble()).toFloat() /** - * Computes the remainder of division of this value by the [other] value according to the IEEE 754 standard. + * Computes the remainder of division of this value by the [divisor] value according to the IEEE 754 standard. * - * The result is computed as `r = this - (q * other)` where `q` is the quotient of division rounded to the nearest integer, + * The result is computed as `r = this - (q * divisor)` where `q` is the quotient of division rounded to the nearest integer, * `q = round(this / other)`. * * Special cases: @@ -1029,7 +1029,7 @@ public inline fun Float.pow(other: Int): Float = nativeMath.pow(this.toDouble(), */ @SinceKotlin("1.2") @InlineOnly -public inline fun Float.IEEErem(other: Float): Float = nativeMath.IEEEremainder(this.toDouble(), other.toDouble()).toFloat() +public inline fun Float.IEEErem(divisor: Float): Float = nativeMath.IEEEremainder(this.toDouble(), divisor.toDouble()).toFloat() /** * Returns the absolute value of this value. @@ -1141,7 +1141,7 @@ public fun Float.roundToLong(): Long = toDouble().roundToLong() // ================== Integer math functions ===================================== /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [n]. * * Special cases: * - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow @@ -1150,7 +1150,7 @@ public fun Float.roundToLong(): Long = toDouble().roundToLong() */ @SinceKotlin("1.2") @InlineOnly -public inline fun abs(a: Int): Int = nativeMath.abs(a) +public inline fun abs(n: Int): Int = nativeMath.abs(n) /** * Returns the smaller of two values. @@ -1194,7 +1194,7 @@ public val Int.sign: Int get() = when { /** - * Returns the absolute value of the given value [a]. + * Returns the absolute value of the given value [n]. * * Special cases: * - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow @@ -1203,7 +1203,7 @@ public val Int.sign: Int get() = when { */ @SinceKotlin("1.2") @InlineOnly -public inline fun abs(a: Long): Long = nativeMath.abs(a) +public inline fun abs(n: Long): Long = nativeMath.abs(n) /** * Returns the smaller of two values.