Float Precision

no-email (Damien Seguy), Damien Seguy
Mon, 29 Apr 2024 00:00:00 +0000

PHP has a 'precision' directive that controls the number of decimals displayed by float values. This is used with echo (and co), but also with cast to string.
It default to 14, and peaks at 18, and gives up at 54. Use gmp for large numbers.
When changing it, don't forget to reset it to default, unless you like to puzzle people.