Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2017oct3 Language: php Keywords: GNU Multiple Precision Arithmetic Library, Maple, Wolfram Alpha, Mathematica Q. How can I do math with really big numbers in PHP? A. Use the built-in GMP (GNU Multiple Precision) library. Examples:$x = gmp_init('12345678901234567890'); $y = gmp_init('12345678901234567890'); $prod = gmp_mul($x, $y); $strprod = gmp_strval($prod); print "x * y = $strprod\n"; $fact = gmp_fact(100); $strfact = gmp_strval($fact); print "factorial=$strfact\n";You don't need to import anything to use this.
Add a commentSign in to add a comment