Skip to content

printf: Exponent not parsed (printf "%f" 1e10) #7474

@drinkcat

Description

@drinkcat

Neither decimal nor hex exponents are parsed:

$ printf "%f %f\n" 1e10 0x1p2
10000000000.000000 4.000000
$ cargo run printf "%f %f\n" 1e10 0x1p2
printf: '1e10': value not completely converted
printf: '0x1p2': value not completely converted
1.000000 1.000000

Similarly to #7473, seq does parse those correctly (so again, unifying parsing seems like a good idea, see #7458 for the first step).

Note that this only applies to float formats, integer formats should not parse exponents:

$ printf "%d %d\n" 1e10 0x1p2
printf: 1e10: invalid number
printf: 0x1p2: invalid hex number
1 1

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