David Garcia
Jul 10, 2023

--

When someone works with money (and other critical data, that always must match, no matter what), working with decimals is always a bad idea, due to the "floating-point precision" or "floating-point arithmetic errors". I am sure you have seen many times the following example:

0.1 + 0.2 !== 0.3

Symfony provides out-of-the-box the MoneyType when working with user input data to make sure any decimal value is transformed to integer to prevent errors.

Please consider updating your article.

--

--

David Garcia
David Garcia

Written by David Garcia

Senior Software Engineer, Backend, NodeJS & Symfony developer, workaholic, passionate for new technologies and OSS contributor. https://linktr.ee/davidgarciacat

No responses yet