On 21/12/2011 06:08, Caligo wrote: <snip>
assert(mod(-6, 20) == 14); assert(mod( 6, -20) == -14); assert(mod(-6, -20) == -6);I'm hoping to see something like the above mod function in Phobos someday. And perhapse a 'rem' or 'remainder' function that's a wrapper for the % operator, just to stay consistent.
<snip> And a floor-divide along the same lines. See also http://www.digitalmars.com/d/archives/digitalmars/D/13125.html Stewart.