On 21 July 2023 21:38:03 CEST, Marco Pivetta <ocramius@gmail.com> wrote:
> Hey Jorg,
>
> What is the reason for using this over these?
>
> * https://www.php.net/manual/en/function.ceil.php
> * https://www.php.net/manual/en/function.floor.php
>
>
Hey Marco
floor and ceil convert a float to the next int.
round can also convert to the next decimal-,level.
round(16, -1) will round to 20 whereas round(12, -1) will be 10. And tuere's no way currently to make the first one 10 and the second one 20.
Cheers
Andreas
>
> On Fri, 21 Jul 2023, 21:26 Jorg Sowa, <jorg.sowa@gmail.com> wrote:
>
> > Hello internals!
> >
> > I would like to propose introducing two new modes to the function
> > `round()`: PHP_ROUND_DOWN and PHP_ROUND_UP.
> >
> > Those modes are highly requested as you can see by the comments on round
> > documentation page. First comment mentioning about those modes has 309
> > votes as of today. Introducing those 2 modes would be complementing to the
> > rounding in this function.
> >
> > Round documentation: https://www.php.net/manual/en/function.round.php
> > My implementation: https://github.com/php/php-src/pull/11741
> >
> > I'm not sure if such minor improvement requires RFC, but as someone may
> > have some concerns I create this thread to get your feedback.
> >
> > Kind regards,
> > Jorg
> >
--
Andreas Heigl