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 AAA05856; Sat, 11 Aug 2001 00:12:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 AAA05885 for ; Sat, 11 Aug 2001 00:12:31 +0200 (MET DST) Received: from alpha2.tabu.stw-bonn.de (alpha2.tabu.stw-bonn.de [131.220.159.106]) by concorde.inria.fr (8.11.1/8.10.0) with SMTP id f7AMCUj04945 for ; Sat, 11 Aug 2001 00:12:30 +0200 (MET DST) Received: (qmail 5033 invoked by uid 1001); 10 Aug 2001 22:10:35 -0000 From: "Kai Kaminski" Date: Sat, 11 Aug 2001 00:10:35 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] Integer arithmetic: mod Message-ID: <20010811001035.D4854@alpha2.tabu.stw-bonn.de> References: <20010804124945.A354@alpha2.tabu.stw-bonn.de> <3B6DD833.6030765E@maxtal.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B6DD833.6030765E@maxtal.com.au>; from skaller@maxtal.com.au on Mon, Aug 06, 2001 at 09:35:15AM +1000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Aug 06, 2001 at 09:35:15AM +1000, John Max Skaller wrote: > > The reason is that whenever such a behaviour is platform-dependent, you > > can't use it at all, as long as you want to have your programs portable. > > Yes you can: it works for non-negative arguments. > And you can always roll your own function that works as you desire > for negative ones: I'm using a high-level language like OCaml and I still have to define my own 'mod'-operator? I know that it is possible to write a function that gives me what I want. > This way, YOU choose whether you want a deterministic result > for non-negative values (use mod, its fast), or are willing > to pay extra for determinism for negative values. With a second operator this wouldn't be a problem. If you need really fast code and the behaviour for negative numbers doesn't matter, you just choose the faster one. Your code gets a bit platform specific, but it is better to 'punish' the few implementors of speed-critical applications, than all the rest of us. > But I agree with you anyhow. :-) IMHO, that's always a good thing ;) Kai Kaminski ------------------- 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