On Tue, 13 Mar 2012 15:13:01 -0400, bearophile <bearophileh...@lycos.com> wrote:

For the modulus I sometimes use:
((x % y) + y) % y

This might be more efficient (assuming z is your target for this):

if((z = x % y) < 0) z += y;

Though I don't know, maybe the optimizer will reduce to this.

Hard to do it in a single expression without using a function.

-Steve

Reply via email to