Sunday, November 25, 2018

Re: str2float() issue

Hexadecimal (not octal) seems to be a special case:

:echo str2float('0x1') str2float('0xff') str2float('010') str2float('0b1')

answers

1.0 255.0 10.0 0.0

while

:echo 0x1 0xff 010 0b1

answers

1 255 8 1

Not yet sure if I'll call it a feature or a bug.

Best regards,
Tony.
On Sun, Nov 25, 2018 at 2:41 PM Wolf Bogacz <wbogacz@gmail.com> wrote:
>
> See help for str2float() - all "text after the number is silently ignored" for the second case.
> See help in the Variables section 1.1, under the section for conversion.
> For the first case; octal conversion happened in the first case before applying the str2float().
>
>
> On Sun, Nov 25, 2018 at 12:51 AM <vstenbock@gmail.com> wrote:
>>
>> str2float('0x1') returns 1 ( as expected )
>> but
>> str2float('0b1') returns 0 ( why ? )
>>
>> --
>> --
>> You received this message from the "vim_use" 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_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> --
> You received this message from the "vim_use" 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_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: