Add NaN-propagation in coerceIn(ClosedComparableRange<Double>)
This commit is contained in:
@@ -103,8 +103,10 @@ fun comparables(): List<GenericFunction> {
|
||||
"""
|
||||
if (range.isEmpty()) throw IllegalArgumentException("Cannot coerce value to an empty range: ${'$'}range.")
|
||||
return when {
|
||||
!range.lessThanOrEquals(range.start, this) -> range.start
|
||||
!range.lessThanOrEquals(this, range.endInclusive) -> range.endInclusive
|
||||
// this < start equiv to this <= start && !(this >= start)
|
||||
range.lessThanOrEquals(this, range.start) && !range.lessThanOrEquals(range.start, this) -> range.start
|
||||
// this > end equiv to this >= end && !(this <= end)
|
||||
range.lessThanOrEquals(range.endInclusive, this) && !range.lessThanOrEquals(this, range.endInclusive) -> range.endInclusive
|
||||
else -> this
|
||||
}
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user