Skip to content

exponents 1-9 should use 2 digits instead of 1 #8

@fcrick

Description

@fcrick

One difference from python I noticed. Python always uses at least 2 digits for exponents.

>>> repr(2e-6)
'2e-06'

whereas python-format can use a single digit:

console.log(pythonFormat('{}', 2e-6))
"2e-6"

I think it's from pystrtod.c where it says

/* From the C99 standard, section 7.19.6:
The exponent always contains at least two digits, and only as many more digits
as necessary to represent the exponent.
*/
#define MIN_EXPONENT_DIGITS 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions