PHPackages                             nickjbedford/decimal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nickjbedford/decimal

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nickjbedford/decimal
====================

A custom implementation of a Decimal class wrapping the BC library.

1.4.0(3mo ago)0207MITPHPPHP ^8.3

Since Mar 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/nickjbedford/decimal)[ Packagist](https://packagist.org/packages/nickjbedford/decimal)[ Docs](https://github.com/nickjbedford/decimal)[ RSS](/packages/nickjbedford-decimal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (29)Used By (0)

Yet Another Decimal Class
=========================

[](#yet-another-decimal-class)

This library implements the BC Math library into both an immutable and mutable subclass pair of classes named ImmutableDecimal and Decimal (mutable). The classes provide common methods such as simple arithmetic, equality and comparison methods as well as formatting and changes to decimal precision.

Example Usage
-------------

[](#example-usage)

### Immutable decimal arithmetic

[](#immutable-decimal-arithmetic)

```
$balance = new \YetAnother\ImmutableDecimal(144.52, 2);
$newBalance = $balance->plus(55.95);
$newBalance->printValue(); // "200.02"

if ($newBalance->greaterThanOrEqual(200)) {
    print("New balance is at or over $200.");
}
```

### Mutable decimal arithmetic (with helpers)

[](#mutable-decimal-arithmetic-with-helpers)

```
$amount = d4('129.9523'); // 4-digit precision (mutable) Decimal
$amount->add(87.5); // addition in place
$amount->printValue(); // "217.4523"

$remainder = $amount->modulus(5.5);
$remainder->printValue(); // "2.9523"
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance78

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Recently: every ~60 days

Total

28

Last Release

119d ago

Major Versions

0.3.9 → 1.0.02023-11-16

PHP version history (3 changes)0.1PHP &gt;=7.4

1.0.0PHP &gt;=8.0

1.4.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bce7dd852d725a53d2d7a81183acc952c7902242b8fcfa4b45564fe1702d8f3?d=identicon)[nickjbedford](/maintainers/nickjbedford)

---

Top Contributors

[![nickjbedford](https://avatars.githubusercontent.com/u/10795658?v=4)](https://github.com/nickjbedford "nickjbedford (3 commits)")

---

Tags

decimalbcmath

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nickjbedford-decimal/health.svg)

```
[![Health](https://phpackages.com/badges/nickjbedford-decimal/health.svg)](https://phpackages.com/packages/nickjbedford-decimal)
```

###  Alternatives

[brick/math

Arbitrary-precision arithmetic library

2.1k504.0M277](/packages/brick-math)[phpseclib/bcmath_compat

PHP 5.x-8.x polyfill for bcmath extension

16720.7M17](/packages/phpseclib-bcmath-compat)[prestashop/decimal

Object-oriented wrapper/shim for BC Math PHP extension. Allows for arbitrary-precision math operations.

178.2M5](/packages/prestashop-decimal)[rtlopez/decimal

An object oriented immutable arbitrary-precision arithmetic library for PHP

27262.8k2](/packages/rtlopez-decimal)[php-decimal/php-decimal

Correctly-rounded arbitrary precision decimal floating point

781.0M9](/packages/php-decimal-php-decimal)[aza/math

AzaMath - Anizoptera CMF mathematic component. Arbitrary precision arithmetic (for huge integers; BCMath wrapper) and universal convertor between positional numeral systems (supported bases from 2 to 62 inclusive, and systems with custom alphabet; pure PHP realisation, can use GMP and core PHP functions for speed optimization).

1921.9k1](/packages/aza-math)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
