[Wasm] Fix invalid rounding for reminder calculation
#Fixed KT-58681
This commit is contained in:
committed by
Space Team
parent
33140b7fcf
commit
a224feefd2
@@ -101,7 +101,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
}
|
||||
}
|
||||
"rem" -> when (thisKind) {
|
||||
in PrimitiveType.floatingPoint -> "this - (wasm_${thisKind.prefixLowercase}_nearest(this / $parameterName) * $parameterName)"
|
||||
in PrimitiveType.floatingPoint -> "this - (wasm_${thisKind.prefixLowercase}_truncate(this / $parameterName) * $parameterName)"
|
||||
else -> return implementAsIntrinsic(thisKind, methodName)
|
||||
}
|
||||
else -> return implementAsIntrinsic(thisKind, methodName)
|
||||
|
||||
@@ -2146,7 +2146,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_nearest(this / other) * other)
|
||||
this - (wasm_f32_truncate(this / other) * other)
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -2552,7 +2552,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_nearest(this / other) * other)
|
||||
this - (wasm_f64_truncate(this / other) * other)
|
||||
|
||||
/**
|
||||
* Returns this value incremented by one.
|
||||
|
||||
Reference in New Issue
Block a user