Dominique Pellé wrote:

> Attached patch improves coverage tests of function printf().

Thanks, I'll include it.

> While adding tests, I noticed a few things possibly wrong:
> 
> :echo printf("%f", sqrt(-1.0))
> -nan
> 
> I would have expected it to print "nan" instead of "-nan"
> as in the example given in :help sqrt().  nan should not
> be signed. I'm curious what it prints on other systems.
> 
> Another bug:  The following 2 commands correctly
> prints signed infinity:
> 
> :echo 1.0/0.0
> inf
> :echo -1.0/0.0
> -inf
> 
> But when using printf(), the sign is gone.  The sign
> is significant for infinity, so the output of printf()
> looks wrong:
> 
> :echo printf('%f', 1.0/0.0)
> inf
> :echo printf('%f', -1.0/0.0)
> inf
> 
> I expected instead inf and -inf.

Perhaps you can fix this.

> I also noticed that a few things are not documented
> in :help printf() but which appear to do something or
> are ignored. I did not test those as they are undocumented:
> 
> Is there any used for %p in vim function printf()?
> 
>   :echo printf('%p', 'abc')
>   0x22c96e0

It's a pointer.  Not useful, it's there because of where the code came
from.  We could perhaps remove it, I can't think of a way to use it.

> modifiers "%hd", "%ld", "%lld" are also undocumented:
> 
>   :echo printf('%hx', 0x12345678)
>   5678
>   :echo printf('%x', 0x12345678)
>   12345678
>   :echo printf('%lx', 0x12345678)
>   12345678
>   :echo printf('%llx', 0x12345678)
>   12345678

These are not very useful.  I'll add some documentation.

-- 
The sooner you fall behind, the more time you'll have to catch up.

 /// 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

--- 
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