coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

printf: Binary numbers (`0b...`) should not be allowed for float formats

Open drinkcat opened this issue 7 months ago • 0 comments

Decimal parsing is fine:

$ env printf "%d\n" 0b100
4
$ cargo run printf "%d\n" 0b100
4

But binary format should not be allowed for floats (just like octal is already disallowed):

$ env printf "%f\n" 0b100
printf: ‘0b100’: value not completely converted
0.000000
$ cargo run printf "%f\n" 0b100
4.000000

drinkcat avatar Mar 18 '25 20:03 drinkcat