PHPackages                             backendtea/safe-bc-math - 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. backendtea/safe-bc-math

ActiveLibrary

backendtea/safe-bc-math
=======================

Safe versions of BC math functions

0.1.0(6y ago)7361[1 issues](https://github.com/BackEndTea/safe-bc-math/issues)MITPHPPHP ^7.2CI failing

Since Mar 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/BackEndTea/safe-bc-math)[ Packagist](https://packagist.org/packages/backendtea/safe-bc-math)[ RSS](/packages/backendtea-safe-bc-math/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Safe BC Math
============

[](#safe-bc-math)

Installation
------------

[](#installation)

```
$ composer require backendtea/safe-bc-math
```

Why this package
----------------

[](#why-this-package)

Casting a float to a string does not always do what you think it does. Some locales may give unexpected results, and give a malformed string, or the number is cast to a scientific notationm for example: `1.0E-11`. Which bcmath cant handle. Even if you do not manually cast it to a string, the bc math functions expect strings, and will cast it themselves.

This package will throw an exception telling you what error it encountered, instead of giving a warning `bcmath function argument is not well-formed` and returning a wrong error.

Usage
-----

[](#usage)

Replace any usage of bc math functions with the `Backendtea\bc..` version.

e.g.

```
- bcadd($a, $b);
+ \BackEndTea\bcadd($a, $b);
```

Or even better, import the funtion:

```
+ use function BackEndTea\bcadd;

bcadd($a, $b);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2240d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7472777959978078c70a919d0c71fef49501a5337ce57889a9dd9a7d830e41f8?d=identicon)[BackEndTea](/maintainers/BackEndTea)

---

Top Contributors

[![BackEndTea](https://avatars.githubusercontent.com/u/14289961?v=4)](https://github.com/BackEndTea "BackEndTea (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/backendtea-safe-bc-math/health.svg)

```
[![Health](https://phpackages.com/badges/backendtea-safe-bc-math/health.svg)](https://phpackages.com/packages/backendtea-safe-bc-math)
```

PHPackages © 2026

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