Bram Moolenaar <[email protected]> wrote:
> I wrote:
>
>> 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.
>
> Never mind. The test was failing on Windows, because it uses this weird
> 1.#INF format. So I fixed this as well.
Thanks for fixing the problem I described (-nan vs nan, inf vs -inf)
and the 1.#INF on Windows.
I just found 2 other things wrong with printf():
:echo printf('%07.2f', -1.0/3.0)
00-0.33
That's clearly wrong. I would have expected: -000.33
as is printed by:
#include <stdio.h>
int main()
{
printf("%07.2f\n", -1.0/3.0);
return 0;
}
Another wrong thing:
:echo printf('%+07.2f', 1.0/3.0)
0000.33
I would have expected instead:
+000.33
as printed by:
#include <stdio.h>
int main()
{
printf("%+07.2f\n", 1.0/3.0);
return 0;
}
I'll try to look at it tomorrow.
Regards
Dominique
--
--
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.