Integral literals with Exp?

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 02:23:57 PDT 2014


On Mon, 15 Sep 2014 09:05:09 +0000
matovitch via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> Well, I guess it wouldn't help the lexer. To be consistent :
> 
> int x = 1.73e2;
> 
> should be allowed but not
> 
> int y = 1.73e1;
> 
> Not a good idea IMHO.
both numbers aren't ints. the first is obviously "173.0", not "173".
more convoluted sample: is "1000e-3" represents "1" or "1.0"?

for all my scripting languages where having separated ints and floats
makes any sense, i'm using this rules:
1. number with point in it is always float.
2. number with negative exponent is always float.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140915/3e44311f/attachment-0001.sig>


More information about the Digitalmars-d mailing list