I spent hours tracking down this bug, because the code compiled and looked fine to me:
val m1 = mat[0.5]
m1[0] -= 1
println(m1[0]) // 0.0 WRONG!
When I replaced the 1 with 1.0 (out of lack of things to try) the bug went away:
val m2 = mat[0.5]
m2[0] -= 1.0
println(m2[0]) // -0.5 correct
What's weird is that Kotlin has no issue with auto-casting a constant to double:
val m3 = mat[0.5]
println(m3[0] - 1) // -0.5 correct
So the bug only appears when using augmented assignments (+=, -=, etc.)
I have no idea how to debug this.
I'm using Koma EJML 0.12, Kotlin 1.3.61, Java 1.8.0_242
I spent hours tracking down this bug, because the code compiled and looked fine to me:
When I replaced the 1 with 1.0 (out of lack of things to try) the bug went away:
What's weird is that Kotlin has no issue with auto-casting a constant to double:
So the bug only appears when using augmented assignments (
+=,-=, etc.)I have no idea how to debug this.
I'm using Koma EJML 0.12, Kotlin 1.3.61, Java 1.8.0_242