1. Go to this page and download the library: Download joaomfrebelo/decimal library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
joaomfrebelo / decimal example snippets
php
use Rebelo\Decimal\RoundMode;
use Rebelo\Decimal\Decimal;
$decimal = new Decimal(9.9, 4, new RoundMode(RoundMode::HALF_UP));
$result = $decimal->plus(new Decimal(0.1, 2));
$float = $result->valueOf();
// Simple initialization
$decimal = new Decimal(9.9, 4);
// Full initialization set the RoundMode and precion round mode
$decimal = new Decimal(9.9, 4, new RoundMode(RoundMode::HALF_UP), true);
// Difference between standard mode round precision and high precision
// Standard mode
new Decimal(12571.674647, 2, null, false); // will be round to 12571.67
// high precision mode
new Decimal($value, 2, null, true); // will be12571.68
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.