[FIR] Use ieee754equals for floating-point equality operations
This commit is contained in:
committed by
Mikhail Glukhikh
parent
d66281d11f
commit
b74652aa5b
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun eq_double_doubleN(a: Double, b: Double?) = a == b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun <A: Double, B: Double?> eq_double_doubleN(a: A, b: B) = a == b
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val plusZero: Any = 0.0
|
||||
val minusZero: Any = -0.0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
|
||||
fun equals1(a: Double, b: Double) = a == b
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun equals1(a: Double, b: Double) = a == b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
|
||||
fun equals1(a: Float, b: Float) = a == b
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun equals1(a: Float, b: Float) = a == b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
|
||||
fun equals1(a: Double, b: Double?) = a == b
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun equals1(a: Double, b: Double?) = a == b
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
|
||||
fun equals1(a: Float, b: Float?) = a == b
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun equals1(a: Float, b: Float?) = a == b
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FILE: b.kt
|
||||
|
||||
class Foo<T>(val minus0: T, val plus0: T) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun less(a: Comparable<Double>, b: Double): Boolean {
|
||||
return a < b
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val plusZero: Any? = 0.0
|
||||
val minusZero: Any? = -0.0
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun eqDI(x: Any?, y: Any?) = x is Double? && y is Int? && x == y
|
||||
fun eqDL(x: Any?, y: Any?) = x is Double? && y is Long? && x == y
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun ne(x: Any, y: Any) = x is Double && y is Float && x != y
|
||||
fun lt(x: Any, y: Any) = x is Double && y is Float && x < y
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
val minus: Any = -0.0
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ fun box(): String {
|
||||
-0.0 -> {
|
||||
return "fail 2"
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
if (minusZero is Double) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
val plusZero: Any = 0.0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
val plusZero: Any = 0.0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun eqeq(x: Any, y: Any) =
|
||||
x is Double && y is Double && x == y
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun eqeq(x: Any, y: Any) =
|
||||
x is Float && y is Float && x == y
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// This test checks that our bytecode is consistent with javac bytecode
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +VariableDeclarationInWhenSubject
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
val dz = -0.0
|
||||
val fz = -0.0f
|
||||
|
||||
Reference in New Issue
Block a user