Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A collection of math functions.
PHP
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/Heartsentwined/Math
test
.gitignore
.travis.yml
README.md
composer.json

README.md

Heartsentwined\Math

Build Status

A collection of math functions.

Installation

Composer:

{
    "require": {
        "heartsentwined/math": "1.*"
    }
}

Usage

roundUp

Round a $number up to a certain $precision:

use Heartsentwined\Math\Math;
Math::roundUp($number, $precision);

$number: any numeric scalar $precision: follows PHP's round function, i.e.

  • 2 = two decimal places
  • -2 = neartest hundreds

getDecimalPlace

Get the number of decimal places:

use Heartsentwined\Math\Math;
$dp = Math::getDecimalPlace(0.123456789); // $dp = 9
Something went wrong with that request. Please try again.