Re: very simple questions about integer division

  • From: Egor Skriptunoff <egor.skriptunoff@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 1 Sep 2012 09:36:04 +0300

On 8/31/12, Mike Pall <mike-1208@xxxxxxxxxx> wrote:
> But I'm not sure where I'd place them -- math.* or bit.* are not a
> perfect fit for these functions.

IMHO, divmod deserves it's own operator:
local d, m = a /% b
to be equivalent to
local d, m = floor(a / b), a % b

Other related posts: