On 2019-01-07 21:17, Legale.legale wrote:
I think your solution by changing precision is not good enough because
float summation is still not working properly.
As you may know, most computers use binary numbers. This applies to
floating-point values as well. They have a limited number of
> 08.01.2019, 00:39, "Legale.legale" :
> What proposal? I'm talking about elementary arithmetic.
>
> Take a look here:
> Https://jdoodle.com/embed/v0/Tgu
Yes, floating-point arithmetic says: '0.8!=0.1+0.7'.
jdoodle.com/a/Thv
Will we discuss this now?
-- Semen V. Dubina https://sam002.net/
--
What proposal? I'm talking about elementary arithmetic.
Take a look here:
Https://jdoodle.com/embed/v0/Tgu
On Jan 7, 2019 10:32 PM, Semen Dubina wrote:
>
>
> > 07.01.2019, 22:17, "Legale.legale" :
> > I think your solution by changing precision is not good enough because
> > float summation
> 07.01.2019, 22:17, "Legale.legale" :
> I think your solution by changing precision is not good enough because float
> summation is still not working properly.
>
> var_dump(0.1 + 0.7);
>
> returns:
>
> 0.79
>
> expected: 0.8
>
Hi!
If you are about the proposal, then '0.1 + 0.7 !==
I think your solution by changing precision is not good enough because float
summation is still not working properly.
wrote:
>
> > 07.01.2019, 20:24, "Thomas Bley" :
> >
> > Hello,
> >
> > good point, having:
> >
> > echo ini_get('precision') . PHP_EOL;
> > echo
> 07.01.2019, 20:24, "Thomas Bley" :
>
> Hello,
>
> good point, having:
>
> echo ini_get('precision') . PHP_EOL;
> echo ini_get('serialize_precision') . PHP_EOL;
> echo json_encode(array('price' => round('45.99', 2))) . PHP_EOL;
> echo (0.1+0.7), json_encode(0.1+0.7) . PHP_EOL;
>
> gives
Semen Dubina wrote on 07.01.2019 16:38:
> Hi, everyone!
> Original PR and description see: https://github.com/php/php-src/pull/3460.
>
> Because of the accuracy constraint set by the 'precision' variable, debugging
> problems often occur, and many developers consider the limited accuracy to be
Hi, everyone!
Original PR and description see: https://github.com/php/php-src/pull/3460.
Because of the accuracy constraint set by the 'precision' variable, debugging
problems often occur, and many developers consider the limited accuracy to be a
feature of the language.
For better