[Wasm/std] Fix invalid sign for FP rem operator

Fixed #KT-64829
This commit is contained in:
Igor Yakovlev
2024-01-22 18:56:02 +01:00
committed by Space Team
parent a15e88ba1e
commit 3e9b2573c5
3 changed files with 9 additions and 3 deletions
@@ -2155,7 +2155,7 @@ public class Float private constructor(private val value: Float) : Number(), Com
@SinceKotlin("1.1")
@kotlin.internal.IntrinsicConstEvaluation
public operator fun rem(other: Float): Float =
this - (wasm_f32_truncate(this / other) * other)
wasm_f32_copysign(this - (wasm_f32_truncate(this / other) * other), this)
/**
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
@@ -2565,7 +2565,7 @@ public class Double private constructor(private val value: Double) : Number(), C
@SinceKotlin("1.1")
@kotlin.internal.IntrinsicConstEvaluation
public operator fun rem(other: Double): Double =
this - (wasm_f64_truncate(this / other) * other)
wasm_f64_copysign(this - (wasm_f64_truncate(this / other) * other), this)
/**
* Returns this value incremented by one.