Skip to content

math: docs omit mention of IEEE 754 endianness #27736

@seebs

Description

@seebs

What version of Go are you using (go version)?

1.11 (but N/A)

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

amd64 (but N/A)

What did you do?

Read pkg/math's documentation.

What did you expect to see?

Enough information to determine what bits to expect from Float64bits and/or Float32bits (and the bits going the other way, too).

What did you see instead?

Just enough information to guess that it's almost certainly either little-endian or big-endian, and may or may not depend on the host architecture.

What I'd like to know is, to a first approximation: Will the sign bit be 0x80, 0x1, or 0x8000000? Probably! My default guess would be that byte order would be the same as it is for ints, thus, 0x80000000. But it'd be nice to have that explicit. If I weren't used to Intel, I'd expect the sign bit to be the first bit "in memory", meaning that out of a 64-bit float, it would be the bit in the byte with the same address as the whole float, which would be 0x80. It's not, apparently, according to go playground. And that makes sense for Intel CPUs, but I don't know whether it's portable to non-x86 (don't have a go arm64 handy to test on), and I don't know whether it's actually specified or just happens to work out that way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions