On Wed, Dec 21, 2016 at 12:45 PM, Tony Mechelynck
<[email protected]> wrote:
> Unary + and unary - are accepted as operators for Numbers in
> vimscript. Floats are not expressly mentioned under ":help expr7" but
> I would expect them to be "some kind of number", thus + 1.2 should be
> a legitimate expression (1.2, unchanged) and so would - 1.2 (1.2, with
> sign change). These expressions would of course be subject to operator
> precedence. In particular 1.2 is an atomic Float (an expr9) and so is
> -1.2 (with no space), but - 1.2 (with space) is an expr7.

This is indeed so for the eval() function, however the original topic
is on behavior of str2float.
The expressions are not quite relevant there, because str2float should
just convert some string to a float.
I'd suggest to have str2float("- 1.2") and str2float("+ 1.2") return
zero in the same fashion as str2float("(2 + 2)")
returns 0 rather than 4.

Best,

Pavol

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui