Skip to content

Remove dependency on abandoned pear/math_biginteger package.#33

Open
eisberg wants to merge 1 commit into
codename-hub:masterfrom
ModelTech:feature/remove_math_biginteger
Open

Remove dependency on abandoned pear/math_biginteger package.#33
eisberg wants to merge 1 commit into
codename-hub:masterfrom
ModelTech:feature/remove_math_biginteger

Conversation

@eisberg

@eisberg eisberg commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #31

This Pull Request removes the abandoned pear/math_biginteger dependency by refactoring the BigDecimal primitive class to fully rely on PHP's native GMP (GNU Multiple Precision) extension.

Changes Proposed

  • composer.json: Dropped pear/math_biginteger requirement.
  • BigDecimal:
    • Refactored DecimalToBinary() using gmp_export() with explicit bit-length calculation and two's complement binary construction for negative numbers.
    • Refactored BinaryDataToDecimal() using gmp_import() with manual sign-bit reconstruction for safe reverse mapping.
  • BigDecimalTest: Added and extended BigDecimalTest to ensure that the newly refactored GMP implementation produces identical results compared to the legacy Math_BigInteger code.

Verification Results

All PHPUnit assertions pass successfully. Tested with large arbitrary-precision values (83086059037282.54), including negative scales and zeros, with no regressions or unexpected output.

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.

Dependency on abandoned package pear/math_biginteger

1 participant