Hey. I have the problem of rounding numbers to -0 , not just 0
the code:
<?php $num= 0.000000031; $round = number_format((float)$num, 1, '.', ''); echo $round * -1; ?>
Output: -0
expected result: 0
I searched for any solution but found nothing.
kindly explain and help me why is it rounded to -0 instead of 0 ? thanks
floating-point php rounding
sa.lva.ge
source share