From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA28498; Sun, 5 Aug 2001 10:06:06 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA28488 for ; Sun, 5 Aug 2001 10:06:05 +0200 (MET DST) Received: from shell16.ba.best.com (shell16.ba.best.com [206.184.139.148]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f75864b13504 for ; Sun, 5 Aug 2001 10:06:04 +0200 (MET DST) Received: from localhost (def6@localhost) by shell16.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id BAA16658; Sun, 5 Aug 2001 01:05:55 -0700 (PDT) X-Authentication-Warning: shell16.ba.best.com: def6 owned process doing -bs Date: Sun, 5 Aug 2001 01:05:54 -0700 (PDT) From: Chris Hecker X-Sender: def6@shell16.ba.best.com To: "Marcin 'Qrczak' Kowalczyk" cc: caml-list@inria.fr Subject: Re: [Caml-list] Integer arithmetic: mod In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > Unfortunately, people (and language and chip designers) assume > > (-4)/3 = -1 (truncate towards zero) rather than -2 (floor), > Not all people: Donald Knuth clearly disagrees. He has written > something along the lines "beware of programming languages which use > a different definition than the one which says (-4)/3 = -2". Yeah, Concrete Mathematics by Knuth, Graham, and Patashnik is the bible for this sort of thing. > Haskell has both: div & mod truncate downwards, quot & rem truncate > towards 0. Ah, that's a good idea, although I'd assume the div floor behavior is surprising at first. Chris ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr