Re: Inconsistent float to string vs. string to floatcasting
| From: | Christoph M. Becker | Date: | Fri, 04 Jan 2019 13:30:03 +0000 |
| Subject: | Re: Inconsistent float to string vs. string to floatcasting | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103681@lists.php.net to get a copy of this message | ||
On 03.01.2019 at 02:19, Stanislav Malyshev wrote:
> If this is part of a data pipeline, the difference between 1,500 and
> 1.500 can be huge (about 1000 times ;). With luck, there would be unit
> tests, so instead of broken bank account we'd have broken unit tests,
> but we all know how unit test coverage tends to lag behind...
> Number formatting difference may be a funny quirk in an average website
> context, but could be absolutely disastrous in scientific or financial
> application context.
Using floats for currency calculations may have more subtle issues. And
for scientific applications, one may not want to have
echo 123456789012345678.9; // 1,2345678901235E+17
--
Christoph M. Becker