This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Decimal
Andreu Correa Casablanca edited this page Mar 18, 2015
·
10 revisions
The Decimal
class has been created to make easier handling large numbers inside financial applications without precision loss.
To import the Decimal
class, you must add the following line in the header of your PHP script:
use \Litipk\BigNumbers\Decimal as Decimal;
The Decimal
class provides many static constructors.
The most generic constructor, but also the slowest one.
Decimal::create($value, $scale=null)
-
$value
: Any PHP native variable that represents a number. -
$scale
: The precision we want (measured in number of digits behind the fixed point).
Decimal::fromInteger($intValue, $scale=null)
Decimal::fromFloat($fltValue, $scale=null)
Decimal::fromString($strValue, $scale=null)
Constructs a new Decimal object based on a previous one, but changing it's $scale property.
Decimal::fromDecimal(Decimal $b, $scale=null)
TODO