This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Stupid off-topic question


Geoff Keating wrote:

> nbecker@fred.net writes:

> > I can't understand this logic.
> >
> > -1 % 4083 -> -1

> The rule in C99 is that (a/b)*b + a%b == a
> and than / truncates towards 0.
      ^^^^ that ?

Hmmm, has this changed with C99 ?  K&R II has (2.5 Arithmetic Operators,
page 41):

"The direction of truncation for / and the sign of the result for % are
machine-dependent for negative operands, ..."

Cheers,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]