2010-07-14 15 views
10

Hat PHP Dezimal (± 1.0 × 10-28 bis ± 7.9 × 1028) Datentyp?Dezimal Typ in PHP

+1

Verwandte: Gleitkommazahlen in PHP: http://www.php.net/manual/en/ Sprache.Typen.Float.php –

Antwort

18

Die BC Math Erweiterung implementiert beliebiger Genauigkeit dezimal Mathematik:

$a = '0.1'; 
$b = '0.2'; 
echo bcadd($a, $b);  // prints 0.3 

(Von The Floating-Point Guide)