Does PHP have Decimal(±1.0 × 10−28 to ±7.9 × 1028) data type?
Asked
Active
Viewed 1.6k times
14
-
1Related: Floating point numbers in PHP: http://www.php.net/manual/en/language.types.float.php – Pekka Jul 14 '10 at 07:22
1 Answers
25
The BC Math extension implements arbitrary-precision decimal math:
$a = '0.1';
$b = '0.2';
echo bcadd($a, $b); // prints 0.3
(From The Floating-Point Guide)

Michael Borgwardt
- 342,105
- 78
- 482
- 720