Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joshuaestes/math

General Purpose Math Library
https://github.com/joshuaestes/math

Last synced: 1 day ago
JSON representation

General Purpose Math Library

Awesome Lists containing this project

README

        

Math
====

General purpose math library for php that allows you to switch between various
math extension such as BC Math and GMP.

# Features

* Support for GMP
* Support for BC Math
* Auto select based on server configuration

# Installation

## Composer

```bash
composer.phar require "joshuaestes/math:~0.2@dev"
```

# Usage

```php
add(2, 2);
// $result == 4
```

# Extensions

This project currently supports only a few extensions.

## GMP Extension

Use the GNU Multiple Precision PHP extension.

```php
$math = new \Math\Math(new \Math\Extension\GmpExtension());
```

## BC Math Extension

Uses the BC Math PHP extension.

```php
$math = new \Math\Math(new \Math\Extension\BcMathExtension());
```

## Auto Select Extension

This extension selects the best possible extension based on your current server
configuration. It includes all the extensions, if you know what your system
uses, it's advisable to just use that extension.

# Roll Your Own Extension

All extensions implement the [ExtensionInterface]. You are free to use implement
this interface to create your own unique extension. Feel free to contribute back
by checking out [CONTRIBUTING.md].

# How to contribute?

See [CONTRIBUTING.md]

# Change log

See [CHANGELOG.md]

# License (MIT)

Copyright (c) 2015 Joshua Estes

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.

[CONTRIBUTING.md]: https://github.com/JoshuaEstes/Math/blob/master/CONTRIBUTING.md
[CHANGELOG.md]: https://github.com/JoshuaEstes/Math/blob/master/CHANGELOG.md
[ExtensionInterface]: https://github.com/JoshuaEstes/Math/blob/master/src/Math/Extension/ExtensionInterface.php