Bram Moolenaar wrote:
> Here is an update for the floating point patch.

I've done a bit more testing with the latest floating point patch. Vim's 
floating
point doesn't need to cover all extremes, but the following shows some bad 
results.

 :help floating-point-format (in eval.txt)
    It says you can have negative number:  &-0.123
 :let a = &-0.123
    Result:  E112: Option name missing: &-0.123
 :let a = -&0.123
    This works but is inelegant.

str2float('1.75') works by converting '1' to 1 and '75' to 75, then combining 
them
(1 + 75/10^2). That gives a couple of problems. First, should probably document 
that
a 32-bit machine won't keep 15 digits of precision in something like
str2float('0.123456789012345').

Second, the lhs and rhs of the '.' can each overflow an integer, giving chaos.
 :let a=str2float('0.3111222333')
 :echo a
    Result:  -0.118374

In the next example, Vim calculates (-1 + 0.75).
 :let a=str2float('-1.75')
 :echo a
    Result:  -0.250000

Typo in eval.c ("sting" --> "string"):
    Convert the sting "text" to a floating point number.

John


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

Raspunde prin e-mail lui