PHPackages                             pxb/bcmath - 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. pxb/bcmath

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

pxb/bcmath
==========

bc math

02PHP

Since Jan 19Pushed 7y agoCompare

[ Source](https://github.com/768984347/bcmath)[ Packagist](https://packagist.org/packages/pxb/bcmath)[ RSS](/packages/pxb-bcmath/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

bcmath
======

[](#bcmath)

php 精度数学

//加载依赖

composer require pxb/bcmath

//加载类

use Noob\\Lib\\BC;

//声明单例

BC::instance(); //默认2位小数

BC::instance(4); //4位小数 改变结果小数位

\###异常 exception:

ExtensionNotFound // bcmath依赖没有加载

\##方法

加

BC::instance()-&gt;add(1, 1.11111); // "2.11"

BC::instance(1)-&gt;add(2.22, 2, 2, 2, 2,...); //不限制参数个数

BC::instance(0)-&gt;add(\[1,1,1,1,1.111\]); //数组参数

减

BC::instance()-&gt;sub(2, 2); // "0.00"

BC::instance(4)-&gt;sub(6, 2, 2, ...); //不限制参数个数

BC::instance(6)-&gt;sub(\[8.000005, 2, 2\]); //数组参数

乘

BC::instance(2)-&gt;mul(2, 2)； // "4.00"

BC::instance(4)-&gt;mul(2, 2, 2, ...); //不限制参数个数

BC::instance(6)-&gt;mul(\[2,2,2,2.000001\]); //数组参数

除

BC::instance(0)-&gt;div(1, 1); // "1"

BC::instance(1)-&gt;div(4, 2, 1); //不限制参数个数

BC::instance(2)-&gt;div(\[64.32, 8, 2\]); //数组参数

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/71de59bfb9dd4104030476cdf1bc7b52f3fca1a7c2fcc1eef18fa0d01be4408e?d=identicon)[768984347](/maintainers/768984347)

---

Top Contributors

[![pxb-dev](https://avatars.githubusercontent.com/u/27324810?v=4)](https://github.com/pxb-dev "pxb-dev (4 commits)")

### Embed Badge

![Health badge](/badges/pxb-bcmath/health.svg)

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

PHPackages © 2026

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