Files
kotlin-fork/compiler/testData/ir/irText/expressions/floatingPointComparisons/floatingPointCompareTo.kt.txt
T
2024-02-16 10:19:38 +00:00

81 lines
1.7 KiB
Kotlin
Vendored

fun test1d(x: Double, y: Double): Int {
return x.compareTo(other = y)
}
fun test1f(x: Float, y: Float): Int {
return x.compareTo(other = y)
}
fun Float.test1fr(x: Float): Int {
return <this>.compareTo(other = x)
}
fun test2d(x: Double, y: Any): Boolean {
return when {
y is Double -> EQEQ(arg0 = x.compareTo(other = y /*as Double */), arg1 = 0)
else -> false
}
}
fun test2f(x: Float, y: Any): Boolean {
return when {
y is Float -> EQEQ(arg0 = x.compareTo(other = y /*as Float */), arg1 = 0)
else -> false
}
}
fun Float.test2fr(x: Any): Boolean {
return when {
x is Float -> EQEQ(arg0 = <this>.compareTo(other = x /*as Float */), arg1 = 0)
else -> false
}
}
fun test3d(x: Any, y: Any): Boolean {
return when {
when {
x is Double -> y is Double
else -> false
} -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Double */), arg1 = 0)
else -> false
}
}
fun test3f(x: Any, y: Any): Boolean {
return when {
when {
x is Float -> y is Float
else -> false
} -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Float */), arg1 = 0)
else -> false
}
}
fun Float.test3fr(x: Any): Boolean {
return when {
x is Double -> EQEQ(arg0 = <this>.compareTo(other = x /*as Double */), arg1 = 0)
else -> false
}
}
fun testDF(x: Any, y: Any): Boolean {
return when {
when {
x is Double -> y is Float
else -> false
} -> EQEQ(arg0 = x /*as Double */.compareTo(other = y /*as Float */), arg1 = 0)
else -> false
}
}
fun testFD(x: Any, y: Any): Boolean {
return when {
when {
x is Float -> y is Double
else -> false
} -> EQEQ(arg0 = x /*as Float */.compareTo(other = y /*as Double */), arg1 = 0)
else -> false
}
}