Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: question regarding % operator. |
| Date | 2012-03-12 11:04 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <4F5E1098.1090105@verizon.net> (permalink) |
| References | <5cd1384f-dadd-4f6f-abcb-dafe20b3498a@qb4g2000pbb.googlegroups.com> <jjkpsv$b5i$1@dont-email.me> <0abfe2cd-dfdf-4dd8-b17f-f34686ee29b8@y27g2000yqy.googlegroups.com> <4F5E0514.5030505@verizon.net> <25841733.5359.1331562467047.JavaMail.geo-discussion-forums@ynje13> |
On 03/12/2012 10:27 AM, Fred K wrote: > On Monday, March 12, 2012 7:15:48 AM UTC-7, James Kuyper wrote: >> On 03/12/2012 10:02 AM, somenath wrote: >>> On Mar 12, 5:23 pm, Eric Sosman <esos...@ieee-dot-org.invalid> wrote: >> ... >>>> Division must now "round toward zero," always. Nowadays, -7 / 3 >> ... >>> So in case of 7/3 there also exist choices. It can be either 2 or 3. >>> But in C it is 2. So does it mean the choice was made to round toward >>> zero? >> >> Well, yes - that is precisely what he said. > > > One can't tell what choice was made for positive numbers - for positive numbers, "round toward zero" and "round toward negative infinity" always produce the same result. Yes, you can tell what choice was made. Just read what it says in the standard: "the result of the / operator is the algebraic quotient with any fractional part discarded.105" (6.5.5p6). The 105 refers to footnote 105, which explains that "This is often called ‘‘truncation toward zero’’.". Alternatively, you could simply read the paraphrase of footnote 105 that was written by Eric Sosman and quoted by me above. I can understand questioning the accuracy of his paraphrase; but after being told "A is true, always", to ask "Is A true in this particular case?" seems a bit odd, unless you have some particular reason to doubt the "always" part; somenath provided no such reason.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
question regarding % operator. somenath <pal_somenath@emc.com> - 2012-03-11 20:17 -0700
Re: question regarding % operator. gordonb.ddi19@burditt.org (Gordon Burditt) - 2012-03-12 02:27 -0500
Re: question regarding % operator. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-12 08:23 -0400
Re: question regarding % operator. somenath <pal_somenath@emc.com> - 2012-03-12 07:02 -0700
Re: question regarding % operator. James Kuyper <jameskuyper@verizon.net> - 2012-03-12 10:15 -0400
Re: question regarding % operator. Fred K <fred.l.kleinschmidt@gmail.com> - 2012-03-12 07:27 -0700
Re: question regarding % operator. James Kuyper <jameskuyper@verizon.net> - 2012-03-12 11:04 -0400
Re: question regarding % operator. somenath <pal_somenath@emc.com> - 2012-03-12 08:43 -0700
Re: question regarding % operator. Robert Wessel <robertwessel2@yahoo.com> - 2012-03-12 11:04 -0500
Re: question regarding % operator. Fred K <fred.l.kleinschmidt@gmail.com> - 2012-03-12 07:24 -0700
Re: question regarding % operator. James Kuyper <jameskuyper@verizon.net> - 2012-03-12 11:24 -0400
Re: question regarding % operator. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-12 20:17 -0400
Re: question regarding % operator. Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-13 16:35 -0700
csiph-web