Re: [PHP-DEV] rounding integers

2023-06-28 Thread Marc
Hi again, On 22.05.23 13:55, Robert Landers wrote: New function(s) on the other hand sounds like an ugly solution as well only helping people explicitly searching for it after they got bitten at least once. What about deprecating round() in favor of round_float() and round_int()? or something.

Re: [PHP-DEV] rounding integers

2023-05-22 Thread David Gebler
On Sun, May 21, 2023 at 4:21 PM Larry Garfield wrote: > > Having recently been bitten by floor() returning a float even though the > value that comes back is logically an int, I would be fully in support of > "and returns an int" versions of these functions in core. > What about adding a third,

Re: [PHP-DEV] rounding integers

2023-05-22 Thread Robert Landers
> New function(s) on the other hand sounds like an ugly solution as well > only helping people explicitly searching for it after they got bitten at > least once. What about deprecating round() in favor of round_float() and round_int()? or something. Robert Landers Software Engineer Utrecht NL --

Re: [PHP-DEV] rounding integers

2023-05-22 Thread Marc Bennewitz
On 21.05.23 17:20, Larry Garfield wrote: On Sun, May 21, 2023, at 7:18 AM, Rowan Tommins wrote: On 21 May 2023 13:00:30 BST, Dan Ackroyd wrote: On Sun, 21 May 2023 at 06:16, Marc wrote: Do you think this could be an acceptable BC-break No. Suggesting changing a 30 year old maths operations

Re: [PHP-DEV] rounding integers

2023-05-21 Thread Larry Garfield
On Sun, May 21, 2023, at 7:18 AM, Rowan Tommins wrote: > On 21 May 2023 13:00:30 BST, Dan Ackroyd wrote: >>On Sun, 21 May 2023 at 06:16, Marc wrote: >>> >>> Do you think this could be an acceptable BC-break >> >>No. Suggesting changing a 30 year old maths operations is a huge BC break. >> >>> or

Re: [PHP-DEV] rounding integers

2023-05-21 Thread Rowan Tommins
On 21 May 2023 13:00:30 BST, Dan Ackroyd wrote: >On Sun, 21 May 2023 at 06:16, Marc wrote: >> >> Do you think this could be an acceptable BC-break > >No. Suggesting changing a 30 year old maths operations is a huge BC break. > >> or should this be a different function? > >Just make your own that

Re: [PHP-DEV] rounding integers

2023-05-21 Thread Dan Ackroyd
On Sun, 21 May 2023 at 06:16, Marc wrote: > > Do you think this could be an acceptable BC-break No. Suggesting changing a 30 year old maths operations is a huge BC break. > or should this be a different function? Just make your own that does precisely what you want... cheers Dan Ack -- PHP I

[PHP-DEV] rounding integers

2023-05-20 Thread Marc
Hi all, The "round" function supports rounding to significant digits before the decimal point which can be very helpful but unfortunately it's handling everything as floating point numbers which in the end can lead to inaccurate results.     printf("%d\n", round(987654321098765432, -1) // 9