Skip to content

spec: constant specification is invalid #1421

@rogpeppe

Description

@rogpeppe
The specification says:
"It is an error if the constant value cannot be accurately represented as a value
of the respective type."

This is true for conversion to integral types, but not to floating point,
otherwise:

var f float32 = math.Pi

would fail because math.Pi is much more accurate than can be
represented by a 32-bit float.

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