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 RAA15563; Sun, 11 Nov 2001 17:33:19 +0100 (MET) 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 RAA15816 for ; Sun, 11 Nov 2001 17:33:19 +0100 (MET) Received: from mel-rti17.wanadoo.fr (smtprt17.wanadoo.fr [193.252.19.228]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fABGXIn02783 for ; Sun, 11 Nov 2001 17:33:18 +0100 (MET) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rti17.wanadoo.fr; 11 Nov 2001 17:33:18 +0100 Received: from debian (217.109.146.219) by mel-rta7.wanadoo.fr; 11 Nov 2001 17:32:58 +0100 Received: from moi by debian with local (Exim 3.32 #1 (Debian)) id 162xYe-0000Y3-00 for ; Sun, 11 Nov 2001 17:34:08 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Integer to floating point conversion errors References: From: Remi VANICAT Date: 11 Nov 2001 17:34:03 +0100 In-Reply-To: Message-ID: <87zo5ts1vo.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Post Office!~/sentmail writes: > On Sun, 11 Nov 2001, Berke Durak wrote: > > Pardon me, I wasn't clear. Since incr and mult are assumed to be > positive, seed should always be positive. Therefore a mod of C by a > positive number should always be positive. The problems arise like the > following: > > # seeded#raw;; > - : float = -0.011235290207 > # seeded#getseed;; > - : int = 12063801 > # float ( seeded#getseed );; > - : float = 12063801 > # float ( seeded#getseed ) /. float( 1073741824 );; > - : float = -0.011235290207 > # float (1073741824);; > - : float = -1073741824 # max_int;; - : int = 1073741823 so your int is bigger than max_int, and caml silently transform it in -1073741824 (there should be a warning) float ( seeded#getseed ) /. 1073741824.0 should work. -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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