Description
The following code:
https://3v4l.org/JXU4T#v8.4.13
<?php
var_dump( min( round( -0.01 / 2, 0 ), 0 ) );
var_dump( max( round( -0.01 / 2, 0 ), 0 ) );
Resulted in this output:
But I expected this output instead:
For 99.9% of applications, this output is actually what people would expect however: (instead of -0)
so I guess it would make sense to also change that.
This does not have any impact on calculations or comparisons, this is purely visual but can lead to unexpected behavior if the returned number is used as a string (e.g. substr, strtok,...) since there suddenly is an additional character in front of the numbers.
This is especially unexpected, when the float is the result of float arithmetics, which can minimally negative numbers in some cases
PHP Version
Operating System
No response
Description
The following code:
https://3v4l.org/JXU4T#v8.4.13
Resulted in this output:
But I expected this output instead:
For 99.9% of applications, this output is actually what people would expect however: (instead of
-0)so I guess it would make sense to also change that.
This does not have any impact on calculations or comparisons, this is purely visual but can lead to unexpected behavior if the returned number is used as a string (e.g. substr, strtok,...) since there suddenly is an additional character in front of the numbers.
This is especially unexpected, when the float is the result of float arithmetics, which can minimally negative numbers in some cases
PHP Version
Operating System
No response