Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-08 Thread Lauri Kenttä
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

Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Semen Dubina
> 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/ --

Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Legale.legale
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

Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Semen Dubina
> 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 !==

Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Legale.legale
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

Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Semen Dubina
> 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

Re: [PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Thomas Bley
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

[PHP-DEV] Proposal: change precision for output functions

2019-01-07 Thread Semen Dubina
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