From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 1C1BABC29 for ; Tue, 8 Aug 2006 23:41:00 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k78LexHc004636 for ; Tue, 8 Aug 2006 23:40:59 +0200 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 XAA30256 for ; Tue, 8 Aug 2006 23:40:59 +0200 (MET DST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.184]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k78LewK6022656 for ; Tue, 8 Aug 2006 23:40:58 +0200 Received: by nf-out-0910.google.com with SMTP id o25so337333nfa for ; Tue, 08 Aug 2006 14:40:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HsENZVgJ6lUT7NNzz9gYC7iRCdWLGsgZ1uGhCqc+mnIoCEUkLQw+yPTxa4iXk/7ln8IVAtvLyC8kmQzVSDW4qBIc2Io62I+/jGmOaHGnRvTYGe3Bn8aESZo4zeDj5A4TnsN0ZMY42G57uYGStC8dn6+dAJ/jfZMiwr0E5XyUU7Y= Received: by 10.49.26.18 with SMTP id d18mr938911nfj; Tue, 08 Aug 2006 14:40:58 -0700 (PDT) Received: by 10.48.203.7 with HTTP; Tue, 8 Aug 2006 14:40:58 -0700 (PDT) Message-ID: <388f6fcd0608081440x3797a882o51e5288205581de0@mail.gmail.com> Date: Tue, 8 Aug 2006 14:40:58 -0700 From: "Sachin Shah" To: "Oliver Bandel" Subject: Re: [Caml-list] Arg-module: Float-Args also accept integer values Cc: caml-list@inria.fr In-Reply-To: <20060808213359.GA2364@first.in-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060808205748.GA745@first.in-berlin.de> <20060808213359.GA2364@first.in-berlin.de> X-j-chkmail-Score: MSGID : 44D904EA.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 44D904EB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44D904EA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 bandel:01 ocaml's:01 integers:01 subset:01 2006:98 2006,:98 wrote:01 wrote:01 oliver:01 oliver:01 caml-list:01 integer:01 integer:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 On 8/8/06, Oliver Bandel wrote: > On Tue, Aug 08, 2006 at 03:19:15PM -0600, William D. Neumann wrote: > > On Tue, 8 Aug 2006, Oliver Bandel wrote: > > > > >Is this a wanted behaviour? > > >It's an implicit conversion from the integer value in the cli-string > > >to float. Even if this is very convenient for a user, it is not > > >completely following OCaml's philosophy (regarding types). > > > > Not really. It's the same behavior as float_of_string (because it uses > > float of string). > > > > # float_of_string "42";; > > - : float = 42. > > > [...] > > Ah, ok, I see. > > Thanks! > > (But.... shouldn't throw this an eception, because it's > an int, not a float?!) > > Ciao, > Oliver No, because 42 is a valid int and a valid float. Since integers are a proper subset of floating-point numbers, this is the correct behavior for float_of_string. Regards, Sachin.