Browse thread
Float literals
-
Edgar Friendly
-
Erik de Castro Lopo
-
Jon Harrop
- Edgar Friendly
-
Jon Harrop
- Robert Roessler
-
Erik de Castro Lopo
[
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: | -- (:) |
| From: | Edgar Friendly <thelema314@g...> |
| Subject: | Re: [Caml-list] Float literals |
Jon Harrop wrote:
> On Tuesday 26 June 2007 21:38:26 Erik de Castro Lopo wrote:
>> I do not find the second last case odd (all languages I have used
>> consider that a float), but I do for the last one.
>
> Would you like:
>
> float_of_string "55378008"
>
> to work?
>
Yes, I would. Somehow there's a difference between user input and
program code. For user input, you want to be pretty permissive in what
you accept. I guess you could force the programmer to write
try
float_of_string str
with
Failure _ ->
int_of_string str
but there's all sorts of corner cases in that, from alternate bases to
range issues.
But technically it's a violation of spec, as the note (that I missed
before) in the float-literal definition about requiring either an
exponent or a decimal part of the number should apply here too.