Add a note about NaN propagation for floating point specializations.
This commit is contained in:
@@ -9722,6 +9722,8 @@ public inline fun CharArray.forEachIndexed(action: (Int, Char) -> Unit): Unit {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Double>.max(): Double? {
|
||||
@@ -9738,6 +9740,8 @@ public fun Array<out Double>.max(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Float>.max(): Float? {
|
||||
@@ -9819,6 +9823,8 @@ public fun LongArray.max(): Long? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun FloatArray.max(): Float? {
|
||||
if (isEmpty()) return null
|
||||
@@ -9834,6 +9840,8 @@ public fun FloatArray.max(): Float? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun DoubleArray.max(): Double? {
|
||||
if (isEmpty()) return null
|
||||
@@ -10141,6 +10149,8 @@ public fun CharArray.maxWith(comparator: Comparator<in Char>): Char? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Double>.min(): Double? {
|
||||
@@ -10157,6 +10167,8 @@ public fun Array<out Double>.min(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Float>.min(): Float? {
|
||||
@@ -10238,6 +10250,8 @@ public fun LongArray.min(): Long? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun FloatArray.min(): Float? {
|
||||
if (isEmpty()) return null
|
||||
@@ -10253,6 +10267,8 @@ public fun FloatArray.min(): Float? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun DoubleArray.min(): Double? {
|
||||
if (isEmpty()) return null
|
||||
|
||||
@@ -1464,6 +1464,8 @@ public inline fun <T> Iterable<T>.forEachIndexed(action: (Int, T) -> Unit): Unit
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Double>.max(): Double? {
|
||||
@@ -1481,6 +1483,8 @@ public fun Iterable<Double>.max(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Float>.max(): Float? {
|
||||
@@ -1545,6 +1549,8 @@ public fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Double>.min(): Double? {
|
||||
@@ -1562,6 +1568,8 @@ public fun Iterable<Double>.min(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Float>.min(): Float? {
|
||||
|
||||
@@ -843,6 +843,8 @@ public inline fun <T> Sequence<T>.forEachIndexed(action: (Int, T) -> Unit): Unit
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Double>.max(): Double? {
|
||||
@@ -860,6 +862,8 @@ public fun Sequence<Double>.max(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Float>.max(): Float? {
|
||||
@@ -924,6 +928,8 @@ public fun <T> Sequence<T>.maxWith(comparator: Comparator<in T>): T? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Double>.min(): Double? {
|
||||
@@ -941,6 +947,8 @@ public fun Sequence<Double>.min(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Float>.min(): Float? {
|
||||
|
||||
@@ -5753,12 +5753,16 @@ public header inline fun CharArray.forEachIndexed(action: (Int, Char) -> Unit):
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Array<out Double>.max(): Double?
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Array<out Float>.max(): Float?
|
||||
@@ -5790,11 +5794,15 @@ public header fun LongArray.max(): Long?
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public header fun FloatArray.max(): Float?
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public header fun DoubleArray.max(): Double?
|
||||
|
||||
@@ -5895,12 +5903,16 @@ public header fun CharArray.maxWith(comparator: Comparator<in Char>): Char?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Array<out Double>.min(): Double?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Array<out Float>.min(): Float?
|
||||
@@ -5932,11 +5944,15 @@ public header fun LongArray.min(): Long?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public header fun FloatArray.min(): Float?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public header fun DoubleArray.min(): Double?
|
||||
|
||||
|
||||
@@ -767,12 +767,16 @@ public header inline fun <T> Iterable<T>.forEachIndexed(action: (Int, T) -> Unit
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Iterable<Double>.max(): Double?
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Iterable<Float>.max(): Float?
|
||||
@@ -794,12 +798,16 @@ public header fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Iterable<Double>.min(): Double?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Iterable<Float>.min(): Float?
|
||||
|
||||
@@ -494,12 +494,16 @@ public header inline fun <T> Sequence<T>.forEachIndexed(action: (Int, T) -> Unit
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Sequence<Double>.max(): Double?
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Sequence<Float>.max(): Float?
|
||||
@@ -521,12 +525,16 @@ public header fun <T> Sequence<T>.maxWith(comparator: Comparator<in T>): T?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Sequence<Double>.min(): Double?
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public header fun Sequence<Float>.min(): Float?
|
||||
|
||||
@@ -9805,6 +9805,8 @@ public inline fun CharArray.forEachIndexed(action: (Int, Char) -> Unit): Unit {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Double>.max(): Double? {
|
||||
@@ -9821,6 +9823,8 @@ public fun Array<out Double>.max(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Float>.max(): Float? {
|
||||
@@ -9902,6 +9906,8 @@ public fun LongArray.max(): Long? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun FloatArray.max(): Float? {
|
||||
if (isEmpty()) return null
|
||||
@@ -9917,6 +9923,8 @@ public fun FloatArray.max(): Float? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun DoubleArray.max(): Double? {
|
||||
if (isEmpty()) return null
|
||||
@@ -10224,6 +10232,8 @@ public fun CharArray.maxWith(comparator: Comparator<in Char>): Char? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Double>.min(): Double? {
|
||||
@@ -10240,6 +10250,8 @@ public fun Array<out Double>.min(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Array<out Float>.min(): Float? {
|
||||
@@ -10321,6 +10333,8 @@ public fun LongArray.min(): Long? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun FloatArray.min(): Float? {
|
||||
if (isEmpty()) return null
|
||||
@@ -10336,6 +10350,8 @@ public fun FloatArray.min(): Float? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
public fun DoubleArray.min(): Double? {
|
||||
if (isEmpty()) return null
|
||||
|
||||
@@ -1475,6 +1475,8 @@ public inline fun <T> Iterable<T>.forEachIndexed(action: (Int, T) -> Unit): Unit
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Double>.max(): Double? {
|
||||
@@ -1492,6 +1494,8 @@ public fun Iterable<Double>.max(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Float>.max(): Float? {
|
||||
@@ -1556,6 +1560,8 @@ public fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Double>.min(): Double? {
|
||||
@@ -1573,6 +1579,8 @@ public fun Iterable<Double>.min(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Iterable<Float>.min(): Float? {
|
||||
|
||||
@@ -862,6 +862,8 @@ public inline fun <T> Sequence<T>.forEachIndexed(action: (Int, T) -> Unit): Unit
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Double>.max(): Double? {
|
||||
@@ -879,6 +881,8 @@ public fun Sequence<Double>.max(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the largest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Float>.max(): Float? {
|
||||
@@ -943,6 +947,8 @@ public fun <T> Sequence<T>.maxWith(comparator: Comparator<in T>): T? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Double>.min(): Double? {
|
||||
@@ -960,6 +966,8 @@ public fun Sequence<Double>.min(): Double? {
|
||||
|
||||
/**
|
||||
* Returns the smallest element or `null` if there are no elements.
|
||||
*
|
||||
* If any of elements is `NaN` returns `NaN`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun Sequence<Float>.min(): Float? {
|
||||
|
||||
@@ -159,7 +159,10 @@ fun aggregates(): List<GenericFunction> {
|
||||
if (isFloat && isGeneric)
|
||||
since("1.1")
|
||||
}
|
||||
doc { f -> "Returns the ${if (op == "max") "largest" else "smallest"} ${f.element} or `null` if there are no ${f.element.pluralize()}." }
|
||||
doc { f ->
|
||||
"Returns the ${if (op == "max") "largest" else "smallest"} ${f.element} or `null` if there are no ${f.element.pluralize()}." +
|
||||
if (isFloat) "\n\n" + "If any of ${f.element.pluralize()} is `NaN` returns `NaN`." else ""
|
||||
}
|
||||
returns("T?")
|
||||
|
||||
body {
|
||||
|
||||
@@ -130,6 +130,7 @@ fun comparables(): List<GenericFunction> {
|
||||
If values are equal, returns the first one.
|
||||
"""
|
||||
}
|
||||
// TODO: Add a note about NaN propagation for floats.
|
||||
doc(Primitives) {
|
||||
"""Returns the smaller of two values."""
|
||||
}
|
||||
@@ -154,6 +155,7 @@ fun comparables(): List<GenericFunction> {
|
||||
returns("T")
|
||||
customReceiver("")
|
||||
inline(Primitives) { Inline.Only }
|
||||
// TODO: Add a note about NaN propagation for floats.
|
||||
doc {
|
||||
"""
|
||||
Returns the smaller of three values.
|
||||
@@ -215,6 +217,7 @@ fun comparables(): List<GenericFunction> {
|
||||
If values are equal, returns the first one.
|
||||
"""
|
||||
}
|
||||
// TODO: Add a note about NaN propagation for floats.
|
||||
doc(Primitives) {
|
||||
"""Returns the greater of two values."""
|
||||
}
|
||||
@@ -238,6 +241,7 @@ fun comparables(): List<GenericFunction> {
|
||||
returns("T")
|
||||
customReceiver("")
|
||||
inline(Primitives) { Inline.Only }
|
||||
// TODO: Add a note about NaN propagation for floats.
|
||||
doc {
|
||||
"""
|
||||
Returns the greater of three values.
|
||||
|
||||
Reference in New Issue
Block a user