Skip to content

math: math.SmallestNonzeroFloat64 is not sufficiently precise, leading to unexpected results #44058

@griesemer

Description

@griesemer

The compiler constant expression

math.SmallestNonzeroFloat64 / 2

gets printed as 5e-324 (program), but the exact computation of math.SmallestNonzeroFloat64 / 2 using math/big arithmetic followed by rounding results in 0 (program).

There's either an error with the rounding or constant arithmetic somewhere, or a mistake in my assumptions.

This affects a test case in types2/testdata/const1.src.

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