Re: [PHP-DEV] Proposal for floored division and modulo functions

2022-08-21 Thread Daniel Wolfe
On 2022-08-21 3:59 PM, Rowan Tommins wrote: Could you give some quick examples of when these functions would give different answers, and why someone might need / want the "floor" variants? My hobby is fiddling with calendrical calculations, and, if you need a perfect subject area where the fl

Re: [PHP-DEV] Proposal for floored division and modulo functions

2022-08-21 Thread Rowan Tommins
On 21/08/2022 21:30, Daniel Wolfe wrote: I have a fork on Github that adds functions named `floor_div` and `floor_mod` which implement the floor technique. Before I submit a pull request and write up an RFC, what are your thoughts or concerns about adding this to PHP? Could you give some qui

[PHP-DEV] Proposal for floored division and modulo functions

2022-08-21 Thread Daniel Wolfe
Hello, Before I submit an RFC, I’d like to see what others’ thoughts are. Should PHP implement functions for floor division and floor modulo? To keep it simple, in some programming languages such as PHP and C, the result of integer division will be rounded towards zero, and result of the modulo