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

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

edwardbrosens/bcmath
====================

Convenience wrapper for the php bcmath extension.

0.1.4(8y ago)08MITPHPPHP &gt;=5.6

Since Jan 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/edwardbrosens/BCMath)[ Packagist](https://packagist.org/packages/edwardbrosens/bcmath)[ Docs](https://github.com/edwardbrosens/BCMath)[ RSS](/packages/edwardbrosens-bcmath/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (1)Versions (11)Used By (0)

BCMath: bcmath made easy
========================

[](#bcmath-bcmath-made-easy)

Convenience wrapper for the php bcmath extension.

---

- [Installation](#installation)
- [Requirements](#requirements)
- [Quick Start](#quick-start)
- [Available Methods](#available-methods)
- [Run Tests](#run-tests)
- [Contribute](#contribute)

---

### Installation

[](#installation)

To install BCMath, run:

```
$ composer require edwardbrosens/bcmath

```

### Requirements

[](#requirements)

BCMath works with at least PHP 5.6 and HHVM.

### Quick Start

[](#quick-start)

```
require __DIR__ . '/vendor/autoload.php';

use \BCMath\BCMath;

// Add two arbitrary precision numbers
$a = BCMath::add(1, 2); // ($a = 3)
$b = BCMath::sub(2, 1); // ($b = 1)
```

### Available Methods

[](#available-methods)

```
BCMath::add($left_operand, $right_operand, $scale = null); // Add two arbitrary precision numbers
BCMath::sub($left_operand, $right_operand, $scale = null); // Subtract two arbitrary precision numbers
BCMath::mul($left_operand, $right_operand, $scale = null); // Multiply two arbitrary precision numbers
BCMath::div($left_operand, $right_operand, $scale = null); // Divide two arbitrary precision numbers
BCMath::mod($left_operand, $modulus); // Get modulus of an arbitrary precision number
BCMath::pow($left_operand, $right_operand, $scale = null); // Raise an arbitrary precision number to another
BCMath::sqrt($operand, $scale = null); // Get the square root of an arbitrary precision number
BCMath::scale ($scale); // Set default scale parameter for all BCMath and bcmath functions
BCMath::comp($left_operand, $right_operand, $scale = null); // Compare two arbitrary precision numbers
BCMath::powmod($left_operand, $right_operand, $modulus, $scale = null); // Raise an arbitrary precision number to another, reduced by a specified modulus
```

### Run Tests

[](#run-tests)

To run tests:

```
$ git clone https://github.com/edwardbrosens/BCMath.git
$ composer install
$ ./vendor/bin/phpunit

```

### Contribute

[](#contribute)

1. Fork the repository on GitHub in order to make changes.
2. Write one or more tests for the new feature you're implementing or a fix for the bug you found.
3. Send a pull request to get your branch merged.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Every ~0 days

Total

2

Last Release

3080d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5037812?v=4)[Edward Brosens](/maintainers/edwardbrosens)[@edwardbrosens](https://github.com/edwardbrosens)

---

Top Contributors

[![edwardbrosens](https://avatars.githubusercontent.com/u/5037812?v=4)](https://github.com/edwardbrosens "edwardbrosens (27 commits)")

---

Tags

phpclassArbitrary-precisionbcmath

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[krowinski/bcmath-extended

Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions. (more http://php.net/manual/en/book.bc.php) Supports scientific notations

791.1M22](/packages/krowinski-bcmath-extended)[yzen.dev/plain-to-class

Class-transformer to transform your dataset into a structured object

162101.6k6](/packages/yzendev-plain-to-class)

PHPackages © 2026

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