14

Does PHP have Decimal(±1.0 × 10−28 to ±7.9 × 1028) data type?

Rob Forrest
  • 7,329
  • 7
  • 52
  • 69
Neir0
  • 12,849
  • 28
  • 83
  • 139
  • 1
    Related: Floating point numbers in PHP: http://www.php.net/manual/en/language.types.float.php – Pekka Jul 14 '10 at 07:22

1 Answers1

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