From 3399867479319200758
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!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 20 Feb 2007 17:00:04 -0600
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: serv4.gc.dca.giganews.com: news set sender to poster@giganews.com using -f
From: Pete Becker <pete@versatilecoding.com>
User-Agent: Thunderbird 1.5.0.9 (Macintosh/20061207)
MIME-Version: 1.0
Subject: Re: Integer division specification
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>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <55qdnR-NRrdr6kbYnZ2dnUVZ_rHinZ2d@giganews.com>
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Newsgroups: comp.std.c++
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Tue, 20 Feb 2007 16:56:23 CST
Lines: 32
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-ZKRTXHr43v9Q0DPOy+VhFSwzw8nKYLHCQ4CD8Ew+GnGBsPawYlEz+t6t1OOgFplskw1t1EEp7Yh1yHn!arNUZm8l1QqlNUUXQSGPXn+bYp68ZO9gslrRRST0Aw6K0oTCGoxtIa3CBNoW/fZ2sTGgvgFsjLnt!C46z3jnfJUB051EEB5tMVpI3vBRolFsu
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news2.google.com comp.std.c++:5659

Maarten Kronenburg wrote:
> A compiler with hardware that has truncation other
> than toward zero should then mention that in their documentation.

In C++, the direction of rounding is implemenation defined. That means 
the implementation is required to document it in all cases.

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

Not necessarily. Consider the remainders, as well. When you don't have 
rounding toward negative infinity, you often end up having to test 
remainders to see whether they're negative. Calendar calculations, in 
particular, end up with lots of code that looks like this:

int dow = date % 7;
if (dow < 0)
	dow += 7;

-- 

	-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and 
Reference." (www.petebecker.com/tr1book)

---
[ 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                      ]



