diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt index 9691c9d17..830c504f3 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/algebraExtensions.kt @@ -108,9 +108,9 @@ public fun Sequence.averageWith(space: S): T where S : Ring, S : Sc * @author Evgeniy Zhelenskiy */ public fun Ring.power(arg: T, power: UInt): T = when { - this == zero && power > 0U -> zero - this == one -> arg - this == -one -> powWithoutOptimization(arg, power % 2U) + arg == zero && power > 0U -> zero + arg == one -> arg + arg == -one -> powWithoutOptimization(arg, power % 2U) else -> powWithoutOptimization(arg, power) }