PHPackages                             ionux/rapim - 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. ionux/rapim

ActiveLibrary

ionux/rapim
===========

This project is a native Rich Arbitrary Precision Integer Mathematics Library implementation for PHP.

1.0.0(10y ago)453[1 issues](https://github.com/ionux/RichArbitraryPrecisionIntegerMath/issues)MITPHPPHP &gt;=5.5.0CI failing

Since Jan 8Pushed 2y ago2 watchersCompare

[ Source](https://github.com/ionux/RichArbitraryPrecisionIntegerMath)[ Packagist](https://packagist.org/packages/ionux/rapim)[ Docs](https://github.com/ionux/RichArbitraryPrecisionIntegerMath)[ RSS](/packages/ionux-rapim/feed)WikiDiscussions master Synced 2mo ago

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

Rich Arbitrary Precision Integer Math for PHP
=============================================

[](#rich-arbitrary-precision-integer-math-for-php)

[![Build Status](https://camo.githubusercontent.com/b8dcf8a275286e8c5a6b5042f38a2dc3d658b4ffa0665dd11077b9492694bafa/68747470733a2f2f7472617669732d63692e6f72672f696f6e75782f52696368417262697472617279507265636973696f6e496e74656765724d6174682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ionux/RichArbitraryPrecisionIntegerMath)

Description
-----------

[](#description)

This rich arbitrary precision integer mathematics (RAPIM) library for PHP is a project which aims to provide a completely self-contained solution for PHP projects that cannot install the GMP or BC math extensions. It can, of course, take advantage of those higher-performing math extensions but the library will fall back on pure PHP implementations of the math functions if they are not present.

RAPIM is a work in progress and should be considered alpha quality software. I would appreciate and welcome all feedback, especially if you have experience in implementing math algorithms. But all programming, debugging and test writing help is welcome!

Installing
----------

[](#installing)

Installation of this project is very easy using composer:

```
php composer.phar require ionux/rapim:1.0.0
```

If you have git installed, you can clone the repository:

```
git clone https://github.com/ionux/RichArbitraryPrecisionIntegerMath.git
```

Or you can install manually by downloading the zip file and extracting the contents into your project's source directory.

Usage
-----

[](#usage)

Integrating these classes with your project is very simple. For example, after including the necessary class files (or using an autoloader), to perform calculations:

```
$math = new \RAPIM\Math;

$result = $math->add($a, $b);
```

The result will be returned as a string value:

```
87184393310133944941037516098150368062480930902710059558578327529121455801724207495015120248109543168498739812179
```

Found a bug?
------------

[](#found-a-bug)

Let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues.

**Support:**

- [GitHub Issues](https://github.com/ionux/RichArbitraryPrecisionIntegerMath/issues)
    - Open an issue if you are having issues with this library

Contribute
----------

[](#contribute)

Would you like to help with this project? Great! You don't have to be a developer, either. If you've found a bug or have an idea for an improvement, please open an [issue](https://github.com/ionux/RichArbitraryPrecisionIntegerMath/issues) and tell me about it.

If you *are* a developer wanting contribute an enhancement, bugfix or other patch to this project, please fork this repository and submit a pull request detailing your changes. I review all PRs!

This open source project is released under the [MIT license](http://opensource.org/licenses/MIT) which means if you would like to use this project's code in your own project you are free to do so. Speaking of, if you have used this math library in a cool new project I would like to hear about it!

License
-------

[](#license)

```
  Copyright (c) 2014-2024 Rich Morgan, rich@richmorgan.me

  The MIT License (MIT)

  Permission is hereby granted, free of charge, to any person obtaining a copy of
  this software and associated documentation files (the "Software"), to deal in
  the Software without restriction, including without limitation the rights to
  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  the Software, and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.7% 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

3779d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f2ad65d1c41faacc99aa36081fefd6bc930975a3cdf89b09648f99ccd31f77f?d=identicon)[ionux](/maintainers/ionux)

---

Top Contributors

[![ionux](https://avatars.githubusercontent.com/u/6451654?v=4)](https://github.com/ionux "ionux (59 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

mathematicsmathintegerfftAlgorithmnumbermoduloprecisionarbitraryprimecoprimeadditiondivisionmultiplicationsubtractionrapimkaratsuba

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ionux-rapim/health.svg)

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

###  Alternatives

[ionux/phactor

Phactor is a high-performance PHP implementation of the elliptic curve math functions required to generate &amp; verify private/public (asymmetric) EC keypairs and ECDSA signatures based on secp256k1 curve parameters. This library also includes a class to generate Service Identification Numbers (SINs) based on the published Identity Protocol v1 spec.

5275.0k30](/packages/ionux-phactor)[brick/math

Arbitrary-precision arithmetic library

2.1k504.0M277](/packages/brick-math)[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)[markrogoyski/math-php

Math Library for PHP. Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra

2.4k7.1M40](/packages/markrogoyski-math-php)[php-decimal/php-decimal

Correctly-rounded arbitrary precision decimal floating point

781.0M9](/packages/php-decimal-php-decimal)[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.0M19](/packages/krowinski-bcmath-extended)

PHPackages © 2026

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