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 MAA17718; Sat, 4 Aug 2001 12:51:36 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA17719 for ; Sat, 4 Aug 2001 12:51:35 +0200 (MET DST) Received: from alpha2.tabu.stw-bonn.de (alpha2.tabu.stw-bonn.de [131.220.159.106]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f74ApTP03372 for ; Sat, 4 Aug 2001 12:51:29 +0200 (MET DST) Received: (qmail 391 invoked by uid 1001); 4 Aug 2001 10:49:46 -0000 From: "Kai Kaminski" Date: Sat, 4 Aug 2001 12:49:46 +0200 To: caml-list@inria.fr Subject: [Caml-list] Integer arithmetic: mod Message-ID: <20010804124945.A354@alpha2.tabu.stw-bonn.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I have a question regarding the 'mod' operator in OCaml. While playing around with the toplevel, I found that -1 mod 10 = -1 instead of -1 mod 10 = 9. Looking into the Handbook showed me, that the behaviour of 'mod' is platform dependent for negative arguments. Now, I could live with -1 mod 10 = -1, but why is it platform-dependent? As far as I can see it would be better to specify a certain behaviour and emulate it on platforms, where it is not directly supported by the cpu, especially for a high-level language as OCaml. 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. Beside that the speed penalty (are there other problems with this approach?) would probably be not too bad, would it? On the other hand I'm just a student, who doesn't know too much about programming languages and their implementation. So could someone please enlighten me? 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