On Tue, Apr 08, 2008 at 01:53:12PM -0700, Gautam Iyer 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).

I forgot to mention: Also

    echo 1.23e-3

can be used for the E notation. (The trailing f is not necessary).

GI

-- 
Modern Computer Viruses:
Pat Buchanan virus -- Shifts all your output to the extreme right of
your screen.

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

Raspunde prin e-mail lui