Skip to content

internal: add package internal/float #42848

Open
@smasher164

Description

@smasher164

Currently, functions that rely on properties of a floating-point number like its sign-bit, nan-checking, and integer representation get duplicated across packages. For instance,

For instance, isFinite, isInf, abs, copysign, float64bits, and float64frombits are defined in both math and runtime.

isNaN itself is defined in math, math/bits, runtime, sort.

I propose that we move the declarations in runtime/float.go to internal/float and reuse them in both math, runtime, and anyplace else.

I assume this hasn't been done already because internal packages didn't exist at the time most of this code was written. In the case of sort, we wanted to remove its dependency on math, but if we end up adopting #33440, sort will need more access to a float64's underlying representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions