decimal

Correctly-rounded arbitrary precision decimal floating-point arithmetic in PHP


Correctly-rounded arbitrary precision decimal floating-point arithmetic in PHP

License: MIT License

Latest releases

Version Release Download
2.0.1 2026-04-11 decimal-2.0.1.tgz
2.0.0 2020-02-03 decimal-2.0.0.tgz
1.5.3 2026-04-11 decimal-1.5.3.tgz
1.5.1 2026-04-11 decimal-1.5.1.tgz
1.5.0 2024-01-20 decimal-1.5.0.tgz
Show all releases

Changelog

Version Message
2.0.1 - Default decimal precision changed from 28 to 34.
- Decimal operations now use the **minimum** precision of all operands.
- Added `Decimal\Rational` implementation for rational numbers (fractions).
- Added `Decimal\Number` abstract class.
- Performance improvements, reduced object allocations.
- Private constructors, static initializers via `valueOf`.
- PHP 8.2, 8.3, and 8.4 compatibility.
- Fixed isPositive/isNegative to return false for zero values.
- Fixed array/debug output for Decimal and Rational objects.
- Renamed `toSci` to `toScientific`.
2.0.0 - Default decimal precision changed from 28 to 34.
- Decimal operations now use the **minimum** precision of all operands.
- Added `Decimal\Rational` implementation for rational numbers (fractions).
- Added `Decimal\Number` abstract class.
- Performance improvements, reduced object allocations.
- Private constructors, static initializers via `valueOf`.
1.5.3 - Fixed isPositive/isNegative to return false for zero values (per GDA spec).
- Added get_properties_for handler for array cast, var_export, and debug output.
- Fixed get_properties_for signature for PHP 7.4 compatibility.
- Added composer.json for PIE/Packagist support.
- Set minimum PHP version to 7.4.
1.5.1 - Fixed isPositive/isNegative to return false for zero values (per GDA spec).
- Added get_properties_for handler for array cast, var_export, and debug output.
- Version bump to 1.5.1.
1.5.0 - Fix object handlers for PHP 8.3 (thank you @Majkl578)
Show complete changelog