vim-patch:7.4.2291

Problem:    printf() handles floats wrong when there is a sign.
Solution:   Fix placing the sign.  Add tests. (Dominique Pelle)

0418609534
This commit is contained in:
Jurica Bradaric
2017-03-07 21:05:02 +01:00
committed by Jurica Bradaric
parent 6ca580be9b
commit cad9a76be2
4 changed files with 97 additions and 42 deletions

View File

@@ -5683,9 +5683,10 @@ printf({fmt}, {expr1} ...) *printf()*
%04x hex number padded with zeros to at least 4 characters
%X hex number using upper case letters
%o octal number
%f floating point number in the form 123.456
%e floating point number in the form 1.234e3
%E floating point number in the form 1.234E3
%f floating point number as 12.23, inf, -inf or nan
%F floating point number as 12.23, INF, -INF or NAN
%e floating point number as 1.23e3, inf, -inf or nan
%E floating point number as 1.23E3, INF, -INF or NAN
%g floating point number, as %f or %e depending on value
%G floating point number, as %f or %E depending on value
%% the % character itself
@@ -5810,8 +5811,9 @@ printf({fmt}, {expr1} ...) *printf()*
digits after the decimal point. When the precision is
zero the decimal point is omitted. When the precision
is not specified 6 is used. A really big number
(out of range or dividing by zero) results in "inf".
"0.0 / 0.0" results in "nan".
(out of range or dividing by zero) results in "inf"
or "-inf" with %f (INF or -INF with %F).
"0.0 / 0.0" results in "nan" with %f (NAN with %F).
Example: >
echo printf("%.2f", 12.115)
< 12.12