Skip to content

strconv: ParseFloat should accept 'p' notation for binary exponents  #12518

@kortschak

Description

@kortschak

See https://groups.google.com/d/topic/golang-dev/oIB-wBj3ufw/discussion.

The language specification never mentioned binary exponent float representation, but it was previously included in the gc implementation and it is included as a formatting option via strconv.AppendFloat with the 'b' fmt argument. However, it now lives on as a parsing option only in the compiler and test code in strconv.

The capacity to represent exact float values in a clear human-readable way is valuable in numeric code, for example here, where otherwise comments are required to explain the magic hex.

It is not clear how this should be included, since parsing a string is failable at runtime and these values are likely to nearly always be compile time constants.

/cc @griesemer

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions