[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: My wish list
- From: Tom N Harris <telliamed@...>
- Date: Mon, 19 Mar 2012 19:40:03 -0400
On 03/16/2012 07:51 PM, Egor Skriptunoff wrote:
2)
Frequently both quotient and remainder are needed.
Let % operator returns pair of values:
a % b == a-floor(a/b)*b, floor(a/b)
The argument for this is that some architectures have a fast divmod
implementation. On the other hand, you could do this:
function divmod(q,r)
local i,f = math.modf(q/r)
return i, f*r
end
--
- tom
telliamed@whoopdedo.org