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 WAA26133; Thu, 30 Oct 2003 22:15:25 +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 WAA26122 for ; Thu, 30 Oct 2003 22:15:24 +0100 (MET) Received: from pecan.cc.columbia.edu (pecan.cc.columbia.edu [128.59.59.178]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h9ULEt125833 for ; Thu, 30 Oct 2003 22:15:07 +0100 (MET) Received: from tw304h3.cpmc.columbia.edu (tw304h3.cpmc.columbia.edu [156.111.84.180]) (user=ot14 mech=LOGIN bits=0) by pecan.cc.columbia.edu (8.12.10/8.12.10) with ESMTP id h9ULENwF015521 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Thu, 30 Oct 2003 16:14:24 -0500 (EST) From: Oleg Trott To: ijtrotts@ucdavis.edu, "Marcin 'Qrczak' Kowalczyk" Subject: Re: [Caml-list] Int overflow in literals Date: Thu, 30 Oct 2003 16:14:02 -0500 User-Agent: KMail/1.5.4 Cc: OCaml Mailing List References: <1067522012.5880.6.camel@qrnik> <20031030200519.GA19324@ucdavis.edu> In-Reply-To: <20031030200519.GA19324@ucdavis.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310301614.02646.oleg_trott@columbia.edu> X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.35 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; oleg:01 oleg:01 caml-list:01 issac:01 trotts:01 marcin:01 'qrczak':01 kowalczyk:01 issac:01 3.06:01 nums:01 caml:01 imho:01 int:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thursday 30 October 2003 03:05 pm, Issac Trotts wrote: > On Thu, Oct 30, 2003 at 02:53:32PM +0100, Marcin 'Qrczak' Kowalczyk wrote: > > I understand that int overflow is not checked on arithmetic for > > efficiency reasons, but IMHO it would be better if it was checked > > at least in literals. When someone writes 10000000000, he certainly > > does not mean -737418240. > > If you want to be sure that the number is correctly stored, you can use > Int64: > > Int64.of_string "10000000000" > > Issac Or, better yet, use Big_int: Objective Caml version 3.06 # Int64.of_string "10000000000000000000";; - : int64 = # #load "nums.cma";; # Big_int.big_int_of_string "10000000000000000000";; -- Oleg Trott ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners