From 7077560650063709104
X-Google-Thread: f78e5,c063db358aabf0d8
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: jm@bourguet.org (Jean-Marc Bourguet)
Newsgroups: comp.std.c++
Subject: Re: Integer division specification
Date: Tue, 20 Feb 2007 21:55:23 GMT
Organization: Guest of ProXad - France
Lines: 28
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <87y7msh56h.fsf@news.bourguet.org>
References: <n5u5t219ouhheqn399kchuhhrd3jm7er69@4ax.com> <k9odt25148b6olt421jip03kqqbcq4meo1@4ax.com> <45d8adcb$0$7365$19deed1b@news.inter.NL.net> <e16jt2db2qgajj6vdp2ss1g3dcpt7jkj68@4ax.com> <45db3f12$0$428$19deed1b@news.inter.NL.net>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.demon.co.uk 1172008530 4104 158.152.254.254 (20 Feb 2007 21:55:30 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 20 Feb 2007 21:55:30 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.8+Sun/8.13.8/Submit) id l1KLtN5h006550;
	Wed, 21 Feb 2007 08:55:23 +1100 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: 20 Feb 2007 22:48:03 MET
X-Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:5655

M.Kronenburg@inter.nl.net ("Maarten Kronenburg") writes:

> After all, when -4 / 3 == -2 (instead of -1), while 4 / 3 == 1, then
> obviously something strange is going on.

You can wonder why Knuth defined MMIX so that its division operates this
way.  See also http://mathworld.wolfram.com/IntegerDivision.html which
define integer division in exactly that way.

Practically, I remember few use of integer division or remainder with
negative operands.  All divisions needed the version C99 mandates.  Things
change when you consider the remainder: the two versions seems to me about
as usefull.

For what it worth, Ada defines / as Fortran, but has two remainder
operators: mod (which is periodic) and rem (which is odd).

Yours,

-- 
Jean-Marc

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



