|
 |
Shay wrote:
> I noticed this while browsing through some stuff I'd cut and pasted into
> my .vimrc.
>
> syn match Float "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
> " floating point number, without dot, with exponent
> " Author: Jean-Marc Vanel <http://jmvanel.free.fr/>
>
> Though this might be some kind of C thing, but tried it in Python:
> >>> 1+0
> 1
> >>> 2-1
> 1
> >>> 1*1
> 1
> >>> 1/1
> 1
> >>> 3%2
> 1
> >>> 1e0
> 1.0
> >>> pow(1,1)
> 1
> >>>
>
> That last one especially throws me. Why is 1e0 a float? Simply to cover
> instances where NeN represents a float value with no decimal points
> anywhere in the expression? Is the language's interpretation that
> "dumb"? If that's the case, why doesn't pow always return a float?
1e0 denotes scientific notation. Scientific notation is defined as an
integer [1..9] followed by a decimal point, which then requires at least
one digit after it.
--
Tim Cook
http://home.bellsouth.net/p/PWP-empyrean
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------
Post a reply to this message
|
 |