Skip to content

Fix Java division semantics for negative integers#44

Merged
satran004 merged 1 commit into
mainfrom
fix/divide_integer
Jun 17, 2026
Merged

Fix Java division semantics for negative integers#44
satran004 merged 1 commit into
mainfrom
fix/divide_integer

Conversation

@satran004

Copy link
Copy Markdown
Member

Fixes #43

Summary

  • Compile Java / and BigInteger.divide() to QuotientInteger so division truncates toward zero like Java.
  • Keep % and BigInteger.remainder() mapped to RemainderInteger.
  • Add explicit floor semantics via Math.floorDiv/floorMod and MathLib.floorDiv/floorMod.
  • Make MathLib.divMod a clean floor division/modulo pair and keep MathLib.quotRem truncating.
  • Update docs to clarify truncating vs floor division behavior.

Tests

  • ./gradlew :julc-compiler:test --tests com.bloxbean.cardano.julc.compiler.StdlibCompileEvalTest
  • ./gradlew :julc-compiler:test :julc-stdlib:test
  • git diff --check

Compile Java / and BigInteger.divide to QuotientInteger, expose explicit floor division APIs, and add Java/Scalus VM regression coverage.\n\nFixes #43
@satran004 satran004 merged commit 4cdffe2 into main Jun 17, 2026
1 check passed
@satran004 satran004 deleted the fix/divide_integer branch June 17, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Java division semantics: map / and BigInteger.divide() to QuotientInteger

1 participant