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 OAA13322; Sun, 11 Nov 2001 14:40:17 +0100 (MET) 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 OAA13605 for ; Sun, 11 Nov 2001 14:40:16 +0100 (MET) Received: from gogol.zorgol (Mix-Montsouris-109-4-43.abo.wanadoo.fr [80.9.126.43]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id fABDeF509404 for ; Sun, 11 Nov 2001 14:40:15 +0100 (MET) Received: (qmail 11189 invoked by uid 1001); 11 Nov 2001 13:33:19 -0000 Date: Sun, 11 Nov 2001 14:33:19 +0100 From: Berke Durak To: Post Office!~/sentmail Cc: caml-list@inria.fr Subject: Re: [Caml-list] Integer to floating point conversion errors Message-ID: <20011111143319.A14950@gogol.zorgol> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from fjr6b@cms.mail.virginia.edu on Fri, Nov 09, 2001 at 06:39:58PM -0500 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, Nov 09, 2001 at 06:39:58PM -0500, Post Office!~/sentmail wrote: > I am getting negative results when I convert large integers to floating > point. This happens on both i386 and my G4 laptop with OCaml 3.02. The > code in question is this: > > method raw = (seed <- (seed*mult+incr)mod modu); > float seed /. float modu The operator ``mod'' does not necessarily return positive values (depending on your platform) : Objective Caml version 3.03 ALPHA # (-1) mod 5;; - : int = -1 -- Berke ------------------- 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