Dominique Pellé wrote:

> I found more unexpected results of printf() with
> float infinity and float nan (not a number) values
> using Vim-7.4.2275:
> 
> :echo printf('%+f', 1.0/0.0)
>   Expected: '+inf'
>   Actual:   'inf'
> 
> :echo printf('% f', 1.0/0.0)
>   Expected: ' inf'
>   Actual:   'inf'
> 
> :echo printf('%+06f', 1.0/0.0)
>   Expected: '  +inf'
>   Actual:   '000inf'
> 
> :echo printf('%G', 0.0/0.0)
>   Expected: 'NAN'
>   Actual:   '-NAN'
> 
> :echo printf('%6f', 0.0/0.0)
>    Expected: '   nan'
>    Actual:   '  nan'
> 
> :echo printf('%06f', 0.0/0.0)
>    Expected: '   nan'
>    Actual:   '00nan'
> 
> Code in Vim-7.4.2275 was also using isinf(f) == -1
> which I don't think was portable as man isinf states:
> 
> === BEGIN QUOTE  man isinf ===
> For isinf(), the standards merely say that the return value
> is nonzero if and only if the argument has an infinite value.
> === END QUOTE ===
> 
> Attached patch fixes all those problems, and adds the
> test cases to src/testdir/test_expr.vim.  I could only test
> it on Linux.
> 
> But there are remaining problems which I have not been
> able to fix yet (they exist prior to my  patch, so they are not
> introduced by my patch):
> 
> :echo printf('%06.2f', -1.0/3.0)
>    Expected: '000.33'
>    Actual:   '0-0.33'
> 
> :echo printf('%+06.2f', 1.0/3.0)
>    Expected: '+00.33'
>    Actual:   '000.33'
> 
> :echo printf('% 06.2f', 1.0/3.0)
>    Expected: ' 00.33'
>    Actual:   '000.33'
> 
> I added test cases for the remaining problems too, but they are
> commented out as they currently fail.

Thanks, I'll include it.
I hope you can fix the remaining problems too.

-- 
I AM THANKFUL...
...for the mess to clean after a party because it means I have
been surrounded by friends.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui