On 14/03/2012 11:27, Steven Schveighoffer wrote: <snip>
This might be more efficient (assuming z is your target for this):if((z = x % y) < 0) z += y;
<snip>Depends on what you want it to do if y is negative. In such cases, what you've got here will return a value in (y, 0] if x is positive, or in (2*y, y] if x is negative.
I too wish D gave the choice between floor-mod and trunc-mod. Stewart.
