From d7bc0d9f9bf2b12bd8e013cf209db607b043ecf1 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 29 Jul 2020 23:44:55 +0700 Subject: [PATCH] Make div/rem operators because of consistency, minor BigNumbers refactor --- .../kmath/operations/OptionalOperations.kt | 8 ++++---- .../scientifik/kmath/operations/BigNumbers.kt | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/OptionalOperations.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/OptionalOperations.kt index 21a263ebd..5b44fe964 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/OptionalOperations.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/OptionalOperations.kt @@ -87,16 +87,16 @@ interface RemainderDivisionOperations : RingOperations { /** * Calculates the remainder of dividing this value by [arg]. */ - infix fun T.rem(arg: T): T + operator fun T.rem(arg: T): T /** * Performs the floored division of this value by [arg]. */ - infix fun T.div(arg: T): T + operator fun T.div(arg: T): T override fun binaryOperation(operation: String, left: T, right: T): T = when (operation) { - REM_OPERATION -> left rem right - DIV_OPERATION -> left div right + REM_OPERATION -> left % right + DIV_OPERATION -> left / right else -> super.binaryOperation(operation, left, right) } diff --git a/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt b/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt index a0c9c9202..71fcc4518 100644 --- a/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt +++ b/kmath-core/src/jvmMain/kotlin/scientifik/kmath/operations/BigNumbers.kt @@ -14,14 +14,15 @@ object JBigIntegerField : Ring, RemainderDivisionOperations