1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #3116 from nickd0/printf-round-fix

printf: fix printf sci notation round up
This commit is contained in:
Sylvestre Ledru 2022-03-09 19:47:52 +01:00 committed by GitHub
commit 2e860e7048
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 12 deletions

View file

@ -228,6 +228,22 @@ fn sub_num_float() {
.stdout_only("twenty is 20.000000");
}
#[test]
fn sub_num_float_e_round() {
new_ucmd!()
.args(&["%e", "99999999"])
.succeeds()
.stdout_only("1.000000e+08");
}
#[test]
fn sub_num_float_e_no_round() {
new_ucmd!()
.args(&["%e", "99999994"])
.succeeds()
.stdout_only("9.999999e+07");
}
#[test]
fn sub_num_float_round() {
new_ucmd!()
@ -236,6 +252,14 @@ fn sub_num_float_round() {
.stdout_only("two is 2.000000");
}
#[test]
fn sub_num_float_round_nines_dec() {
new_ucmd!()
.args(&["%f", "0.99999999"])
.succeeds()
.stdout_only("1.000000");
}
#[test]
fn sub_num_sci_lower() {
new_ucmd!()