dev-develop
dev-develop https://github.com/jnjxp/jnjxp.rincRound numbers to increments
MIT
by jake johns
dev-master
9999999-dev https://github.com/jnjxp/jnjxp.rincRound numbers to increments
MIT
by jake johns
Wallogit.com
2017 © Pedro Peláez
Round numbers to increments
Round numbers to increments, (*1)
![Build Status][ico-travis]
![Quality Score][ico-code-quality], (*2)
composer require jnjxp/rinc
use Jnjxp\Rinc; // Rounder $roundTo = new Rinc\RoundTo; echo $roundTo->nearest(1/4, 0.24); // 0.25 echo $roundTo->next(1/4, 0.26); // 0.5 echo $roundTo->previous(1/4, 0.46); // 0.25 // Increment $quarter = new Rinc\Increment(1/4); echo $quarter(0.24); // 0.25 (same as nearest()) echo $quarter->nearest(0.24); // 0.25 echo $quarter->next(0.26); // 0.5 echo $quarter->previous(0.46); // 0.25 // Named Convenience Constructors $eighth = Rinc\Increment::eighth(); // new Rinc\Increment(1/8) $quarter = Rinc\Increment::quarter(); // new Rinc\Increment(1/4) $half = Rinc\Increment::half(); // new Rinc\Increment(1/2)
Round numbers to increments
MIT
Round numbers to increments
MIT