Skip to content

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

@drinkcat

Description

@drinkcat

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions