caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Robert Roessler <roessler@rftp.com>
To: Caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Float literals
Date: Tue, 26 Jun 2007 13:48:09 -0700	[thread overview]
Message-ID: <46817B89.30004@rftp.com> (raw)
In-Reply-To: <46817245.4020305@gmail.com>

Edgar Friendly wrote:
> 1e6       (* an integer?  no, a float without a .  Problem.*)
> 13        (* valid as a float, according to the above definition *)
> 
> Does anyone else find the last two cases kind of odd?  Maybe it's not a
> big deal because the 1e6 is scientific notation, which is float-y, and
> the last one is always parsed as an integer, I assume because of
> precedence in the lexing functions.

There isn't (to me) anything weird about this... from 6.1 in the 
reference manual on "Floating-point literals":

"The decimal part or the exponent part can be omitted, but not both to 
avoid ambiguity with integer literals."

And, as you suggest, in practice it isn't an issue either - a lexer 
will try to see a numeric literal as an int as long as it legally 
still can constitute an int.  But assuming we are still recognizing a 
base 10 literal, a *letter* that isn't 'l', 'L', or 'n' had better be 
an 'e' or 'E' (so that it may still be a float)... or you have an 
invalid token. ;)

Robert Roessler
roessler@rftp.com
http://www.rftp.com


      parent reply	other threads:[~2007-06-26 20:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 20:08 Edgar Friendly
2007-06-26 20:38 ` [Caml-list] " Erik de Castro Lopo
2007-06-27  4:10   ` Jon Harrop
2007-06-27  4:48     ` Edgar Friendly
2007-06-26 20:48 ` Robert Roessler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46817B89.30004@rftp.com \
    --to=roessler@rftp.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).