Is it true that is c99, a%b is calulated as sign(a) * (abs(a) % abs(b)) ?
where,
sign(a) = 1 if a is +ve
sign(a) = -1 if a is -ve.
Is it true that is c99, a%b is calulated as sign(a) * (abs(a) % abs(b)) ?
where,
sign(a) = 1 if a is +ve
sign(a) = -1 if a is -ve.
From draft standard see section 6.5.5
The C99 Draft (N869, 18 January, 1999)
Tim S.
Last edited by stahta01; 01-06-2012 at 10:31 AM.
According to Modulo operation - Wikipedia, the free encyclopedia, yes. Specifically, in C (ISO 1999) result has same sign as dividend.