Could we have mod in std.math?

Stewart Gordon smjg_1998 at yahoo.com
Wed Dec 21 05:37:00 PST 2011


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.


More information about the Digitalmars-d mailing list