\Tazorax\MathUtils\ArithmeticFraction

Class representing a fraction number

Summary

Methods
Properties
Constants
__construct()
simplify()
floatValue()
getFromFloat()
$numerator
$denominator
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$numerator

$numerator : integer

Numerator

Type

integer

$denominator

$denominator : integer

Denominator

Type

integer

Methods

__construct()

__construct(integer  $numerator, integer  $denominator) 

Fraction constructor.

Parameters

integer $numerator

Numerator

integer $denominator

Denominator

floatValue()

floatValue() : float

Give a float representation of this fraction

Throws

\Tazorax\MathUtils\Exception

Returns

float

getFromFloat()

getFromFloat(float  $value, float  $tolerance = 1.0E-6) : \Tazorax\MathUtils\Arithmetic\Fraction

Create an instance of Fraction from a float value

Parameters

float $value

Value to convert

float $tolerance

Tolerance (1.e-6 if omitted)

Returns

\Tazorax\MathUtils\Arithmetic\Fraction