printf("%.3f");
match 0 in 1.23457e+06 out 1234567.000 expected 12e5
match 0 in 12345.6 out 12345.600 expected 12346
match 0 in 1234.56 out 1234.560 expected 1235
match 0 in 123.456 out 123.456 expected 123.5
match 0 in 12.3456 out 12.346 expected 12.35
match 1 in 1.23456 out 1.235 expected 1.235
match 0 in 1.2345 out 1.234 expected 1.235
match 1 in 1.234 out 1.234 expected 1.234
match 0 in 1.23 out 1.230 expected 1.23
match 0 in 1.2 out 1.200 expected 1.2
match 0 in 1 out 1.000 expected 1
match 1 in 0.11111 out 0.111 expected 0.111
match 1 in 0.01111 out 0.011 expected 0.011
match 1 in 0.00111 out 0.001 expected 0.001
match 0 in 0.00011 out 0.000 expected 11e-4
match 0 in 1e-05 out 0.000 expected 1e-5
match 1 in 0.11111 out 0.111 expected 0.111
match 1 in 0.01111 out 0.011 expected 0.011
match 1 in 0.00111 out 0.001 expected 0.001
match 0 in 0.00011 out 0.000 expected 11e-4
match 0 in 1e-05 out 0.000 expected 1e-5
printf("%.3g");
match 0 in 1.23457e+06 out 1.23e+06 expected 12e5
match 0 in 12345.6 out 1.23e+04 expected 12346
match 0 in 1234.56 out 1.23e+03 expected 1235
match 0 in 123.456 out 123 expected 123.5
match 0 in 12.3456 out 12.3 expected 12.35
match 0 in 1.23456 out 1.23 expected 1.235
match 0 in 1.2345 out 1.23 expected 1.235
match 0 in 1.234 out 1.23 expected 1.234
match 1 in 1.23 out 1.23 expected 1.23
match 1 in 1.2 out 1.2 expected 1.2
match 1 in 1 out 1 expected 1
match 1 in 0.11111 out 0.111 expected 0.111
match 0 in 0.01111 out 0.0111 expected 0.011
match 0 in 0.00111 out 0.00111 expected 0.001
match 0 in 0.00011 out 0.00011 expected 11e-4
match 0 in 1e-05 out 1e-05 expected 1e-5
match 1 in 0.11111 out 0.111 expected 0.111
match 0 in 0.01111 out 0.0111 expected 0.011
match 0 in 0.00111 out 0.00111 expected 0.001
match 0 in 0.00011 out 0.00011 expected 11e-4
match 0 in 1e-05 out 1e-05 expected 1e-5
printf("%.4g");
match 0 in 1.23457e+06 out 1.235e+06 expected 12e5
match 0 in 12345.6 out 1.235e+04 expected 12346
match 1 in 1234.56 out 1235 expected 1235
match 1 in 123.456 out 123.5 expected 123.5
match 1 in 12.3456 out 12.35 expected 12.35
match 1 in 1.23456 out 1.235 expected 1.235
match 0 in 1.2345 out 1.234 expected 1.235
match 1 in 1.234 out 1.234 expected 1.234
match 1 in 1.23 out 1.23 expected 1.23
match 1 in 1.2 out 1.2 expected 1.2
match 1 in 1 out 1 expected 1
match 0 in 0.11111 out 0.1111 expected 0.111
match 0 in 0.01111 out 0.01111 expected 0.011
match 0 in 0.00111 out 0.00111 expected 0.001
match 0 in 0.00011 out 0.00011 expected 11e-4
match 0 in 1e-05 out 1e-05 expected 1e-5
match 0 in 0.11111 out 0.1111 expected 0.111
match 0 in 0.01111 out 0.01111 expected 0.011
match 0 in 0.00111 out 0.00111 expected 0.001
match 0 in 0.00011 out 0.00011 expected 11e-4
match 0 in 1e-05 out 1e-05 expected 1e-5