ionspin / kotlin-multiplatform-bignum

A Kotlin multiplatform library for arbitrary precision arithmetics
Apache License 2.0
345 stars 41 forks source link

Negative Mod Values #248

Closed abueide closed 1 year ago

abueide commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Operation - Mod
  2. Values to reproduce issue

BigInteger(-1) % BigInteger(17) returns -1 as a result

Expected behavior A clear and concise description of what you expected to happen. 16 should be returned as a result

Platform

abueide commented 1 year ago

Nvm, I just learned % maps to rem() which includes negative. I just need to use the mod function directly, sorry!