Browse thread
Arg-module: Float-Args also accept integer values
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-08-09 (03:30) |
From: | Jonathan Roewen <jonathan.roewen@g...> |
Subject: | Re: [Caml-list] Arg-module: Float-Args also accept integer values |
> > =========================================== > > first:~ oliver$ ocaml > > Objective Caml version 3.09.2 > > > > # let floatingpoint_id (x:float) = x;; > > val floatingpoint_id : float -> float = <fun> > > # floatingpoint_id 42;; > > This expression has type int but is here used with type float > > # > > =========================================== > > float_of_string doesn't use the ocaml type system ;-) Don't know > about > impl details, but it's basically like atof (or whatever it's called) > in > standard C libs. The two are completely separate. Oops, I should clarify: float_of_string doesn't use the ocaml lexing tools that are used in the toplevel, and the compilers themselves. That's why it parses integers. Jonathan