Download the PHP package xxc/fractionmath without Composer
On this page you can find all versions of the php package xxc/fractionmath. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package fractionmath
Composer package for math operations with fractions
Auto simplifies the fractions on initialisation. Installation:
Usage:
Available methods for a Fraction:
- numerator() - gets the numerator
- denominator() - gets the denominator
- integer() - gets the integer
- getGreatestCommonDivisor() - gets the GCD of the numetor and the denominator
- getFractionAsArray() - returns the fraction as array with keys numerator, denominator, integer
- getFractionAsObject() - returns the fraction as object
- display() - returns the html for a fraction
- parse() - static method for quick parsing strings to fractions
Works with irregular fractions aswell
If you need you can parse strings to fractions with the static parse method. The method accepts a string param in the format integer-space-nominator-slash-deniminator - Example for valid inputs: 1/2; 5 1/2; 5/6; 666 1/5;
The Math class handles all the math operations - requires Fraction as inputs and returns a Fraction
Math operations:
- add()
- subtract()
- multiply()
- divide()
All versions of fractionmath with dependencies
PHP Build Version
Package Version
No informations.
The package xxc/fractionmath contains the following files
Loading the files please wait ....