Martin C. Martin | 27 Jun 12:50

[groovy-dev] Floating point literals

Hi,

Why do we require a digit before the decimal point in floating point 
literals?

foo.groovy: 1: expecting EOF, found '+' @ line 1, column 11.
   println 5 + .3
             ^

1 error

Best,
Martin

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Guillaume Laforge | 27 Jun 13:01

Re: [groovy-dev] Floating point literals

Because .3 is ugly? :-)

On Fri, Jun 27, 2008 at 12:51 PM, Martin C. Martin
<martin@...> wrote:
> Hi,
>
> Why do we require a digit before the decimal point in floating point
> literals?
>
> foo.groovy: 1: expecting EOF, found '+' @ line 1, column 11.
>  println 5 + .3
>            ^
>
> 1 error
>
> Best,
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

--

-- 
Guillaume Laforge
Groovy Project Manager
G2One, Inc. Vice-President Technology
(Continue reading)

Russel Winder | 27 Jun 13:10

Re: [groovy-dev] Floating point literals

On Fri, 2008-06-27 at 06:51 -0400, Martin C. Martin wrote:
> Hi,
> 
> Why do we require a digit before the decimal point in floating point 
> literals?
> 
> foo.groovy: 1: expecting EOF, found '+' @ line 1, column 11.
>    println 5 + .3
>              ^
> 
> 1 error
> 
> Best,
> Martin

Because it is the right thing to do?

Writing .3 instead of 0.3 is generally considered a bad thing to do
since it hinders readability.  
--

-- 
Russel.
====================================================
Dr Russel Winder                 Partner

Concertant LLP                   t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,              f: +44 8700 516 084
London SW11 1EN, UK.             m: +44 7770 465 077

Gmane