Yasuhiro Matsumoto wrote:
> I found bug in string2float(). In some europe locale, it uses comma to
> display floating point value. So str2float('1.2') return 1.0 .
>
> https://github.com/Shougo/neocomplcache/issues/142#issuecomment-4104445
>
> Vim parse 'type(1.2)' to tokens like following.
>
> -------
> type
> (
> 1
> .2
> )
> -------
>
> Then it occur error. This cause that strtod("1.2", &end) stop
> forwarding pointer at '.'. In :help floating-point-format
>
> -----------
> Only a decimal point is accepted, not a comma. No matter what the
> current locale is.
> -----------
>
> I wrote a vim_strtod() which don't depend on locale. I couldn't understand
> how any code has an effect on vim license, So I didn't refer to any sources
> to write this. I contribute this code to vim_dev to fix this issue.
>
> Anyone, please review this code.
>
> https://gist.github.com/1890186
Vim should make sure the locale "C" is always used when parsing a
floating point number. Including our own strtod() is not desired.
The code does setlocale(LC_NUMERIC, "C") to make this works. Perhaps
there is some place where this is ineffective? Is LC_NUMERIC not
defined?
--
>From "know your smileys":
@:-() Elvis Presley
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
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