Re: Proposal for floored division and modulo functions

From: Date: Sun, 21 Aug 2022 21:59:58 +0000
Subject: Re: Proposal for floored division and modulo functions
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-118450@lists.php.net to get a copy of this message
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 quick examples of when these functions would give different answers, and why someone might need / want the "floor" variants? I clicked through to the Python History article, and Guido gives the example of taking a timestamp module 86400, and says that with the "truncation" technique it gives "a meaningless result", but doesn't actually illustrate that result, so I'm struggling to picture exactly what each algorithm does. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#118450) next »