Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 938 Bytes

README.md

File metadata and controls

60 lines (40 loc) · 938 Bytes

Relational Namber

PHP Class for Rational numbers manipulations

Installation

The preferred way to install this extension is through composer.

Either run

composer require idapgroup/rational-number

or add

{
  "require": {
    "idapgroup/rational-number": "^1.0.0"
  }
}

to the requirement section of your composer.json file.

Quickstart

$number = new Rational(100);

Create number

$number = new Rational(100);

Operations with numbers

$firstNumber = new Rational(100);
$secondNumber = new Rational(200);

//Multiplication 
$mulResult = $firstNumber->mul($secondNumber);

//Division
$divResult = $firstNumber->div($secondNumber);

//Summarizing
$sumResult = $firstNumber->add($secondNumber);

//Subtraction
$subResult = $firstNumber->sub($secondNumber);

//Сomparison
$equalsResult = $firstNumber->equals($secondNumber);