This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Stupid off-topic question
- To: Geoff Keating <geoffk at cygnus dot com>
- Subject: Re: Stupid off-topic question
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Wed, 02 Aug 2000 22:49:09 +0200
- CC: nbecker at fred dot net, gcc at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <x88r987pjy9.fsf@adglinux1.hns.com> <jm4s5378i7.fsf@envy.cygnus.com>
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)