@@ -219,34 +219,33 @@ While the polyfill is significantly slower than native bcmath:
219219 - PHP >= 7.3.0: Use ` bcscale() ` without arguments
220220 - PHP < 7.3.0: Use ` max(0, strlen(bcadd('0', '0')) - 2) `
221221
222- ### RoundingMode Enum Limitations
223- - Three ` RoundingMode ` enum values are not yet implemented:
224- - ` RoundingMode::TowardsZero ` - Will throw ` ValueError `
225- - ` RoundingMode::AwayFromZero ` - Will throw ` ValueError `
226- - ` RoundingMode::NegativeInfinity ` - Will throw ` ValueError `
227- - These modes are planned for implementation in a future release
228- - Use traditional ` PHP_ROUND_* ` constants as alternatives when needed
229-
230- ## 🔄 Key Differences from phpseclib/bcmath_compat
231-
232- | Feature | phpseclib/bcmath_compat | bcmath-polyfill |
233- | ---------------------------| --------------------------------| -------------------------------------|
234- | ** PHP 8.4 functions** | ❌ Not supported | ✅ Full support |
235- | ` bcfloor() ` | ❌ | ✅ |
236- | ` bcceil() ` | ❌ | ✅ |
237- | ` bcround() ` | ❌ | ✅ |
238- | ** RoundingMode enum** | ❌ Not supported | ✅ Partial (4/7 modes) |
239- | ` HalfAwayFromZero ` | ❌ | ✅ |
240- | ` HalfTowardsZero ` | ❌ | ✅ |
241- | ` HalfEven ` | ❌ | ✅ |
242- | ` HalfOdd ` | ❌ | ✅ |
243- | ` TowardsZero ` | ❌ | ⏳ Planned |
244- | ` AwayFromZero ` | ❌ | ⏳ Planned |
245- | ` NegativeInfinity ` | ❌ | ⏳ Planned |
246- | ** PHP 8.2+ deprecations** | ⚠️ Warnings | ✅ Fixed |
247- | ** Test suite pollution** | ⚠️ Issues | ✅ Fixed |
248- | ** Active maintenance** | ❌ Limited | ✅ Active |
249- | ** CI/CD (PHP versions)** | GitHub Actions (8.1, 8.2, 8.3) | GitHub Actions (8.1, 8.2, 8.3, 8.4, 8.5) |
222+ ## 🔄 Key Differences from phpseclib/bcmath_compat and symfony/polyfill-php84
223+
224+ The three libraries target different goals. ` phpseclib/bcmath_compat ` is the classic pre-8.4 polyfill.
225+ ` symfony/polyfill-php84 ` backports ** only** the new PHP 8.4 functions and activates them ** only when the
226+ native bcmath extension is already loaded** . ` bcmath-polyfill ` provides the complete bcmath API —
227+ including the PHP 8.4 additions — for environments ** with or without** the extension.
228+
229+ | Feature | phpseclib/bcmath_compat | symfony/polyfill-php84 | bcmath-polyfill |
230+ | ------------------------------------------------| --------------------------------| ---------------------------------| ------------------------------------------|
231+ | Classic bc functions (` bcadd ` , ` bcmul ` , …) | ✅ | ❌ Not provided | ✅ |
232+ | Works ** without** the bcmath extension | ✅ | ❌ Requires the extension | ✅ |
233+ | ` bcfloor() ` / ` bcceil() ` / ` bcround() ` | ❌ | ✅ (extension required) | ✅ |
234+ | ` bcdivmod() ` | ❌ | ✅ (delegates to native bc) | ✅ (works without the extension) |
235+ | ** RoundingMode enum** (all 8 modes) | ❌ | ✅ | ✅ |
236+ | Arbitrary-precision rounding (no float fallback)| ❌ | ✅ (pure string algorithm) | ✅ (pure string algorithm) |
237+ | ` RoundingMode ` is a * pure* enum (native shape) | — | ✅ | ✅ |
238+ | Implementation of rounding | — | Pure string digits | Pure string digits (phpseclib elsewhere) |
239+ | Extra dependency | phpseclib | none | phpseclib |
240+ | ** PHP 8.2+ deprecations** | ⚠️ Warnings | ✅ Fixed | ✅ Fixed |
241+ | ** Active maintenance** | ❌ Limited | ✅ Active | ✅ Active |
242+ | ** CI/CD (PHP versions)** | GitHub Actions (8.1, 8.2, 8.3) | 7.2+ | GitHub Actions (8.1, 8.2, 8.3, 8.4, 8.5) |
243+
244+ > When ` bcmath-polyfill ` and ` symfony/polyfill-php84 ` are installed together on an environment that has
245+ > the bcmath extension and runs PHP 8.2/8.3, both declare ` bcceil() ` /` bcfloor() ` /` bcround() ` and whichever
246+ > autoloads first wins (guarded by ` function_exists() ` , so no fatal redeclaration). Because this package's
247+ > rounding uses a native-compatible string algorithm, the results are identical either way. See
248+ > [ Interoperability with ` symfony/polyfill-php84 ` ] ( #interoperability-with-symfonypolyfill-php84 ) .
250249
251250### Migration from phpseclib/bcmath_compat
252251
0 commit comments