On Tue, Apr 08, 2008 at 10:45:18PM +0200, Bram Moolenaar wrote:

> One of the items I planned to discuss is why Vim has no floating point
> support.  Well, this turned into actually implementing it.
> 
> The main problem with floating point is that the usual notation already
> has a meaning:
> 
>       echo 123.456
>          123456
> 
> That is because "." is the concatenation operator, and numbers are
> automatically converted to strings.
> 
> I considered a few alternatives:
> 
>       123,456             used for function arguments
>       float("123,456")    too verbose
>       #123.456            has a meaning after == and !=
>       $123.456            confusion with $ENV
> 
> The best I could think of was &123.456.  It's a bit obscure, you need to
> get used to it.  But it works.
> 
>        echo &123.456e-3
>           0.123456
> 
> Feel free to suggest something better, but make sure it doesn't already
> mean something in any context in Vim script.

How about just adding an "f" at the end of the number?

    echo 1.23f

This doesn't seem to mean anything to Vim currently. (I get an error
when I try and echo it).

GI

-- 
A)bort, R)etry, I)nfluence with large hammer.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui