|
 |
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?
Just curious.
-Shay
Post a reply to this message
|
 |