Skip to content

std: TotalF64, a float with a total order and key semantics (D96) #2182

Closed

Description

@ehartford

D96 (2026-10-05) refuses a float as a map key, and the error names a std wrapper for programs that do want float keys: TotalF64 (and TotalF32), a float with a total order and its -0.0/NaN rules spelled out, usable as a key and with <.

To decide in the implementation, from the references: IEEE 754 totalOrder (Rust's f64::total_cmp) orders -0.0 < +0.0 and NaNs by payload; a key wrapper that wants -0.0 == 0.0 canonicalizes first. The spec sentence goes with the type.

Activity

  1. ehartford commented on Oct 6, 2026

    @ehartford
    ContributorAuthor

    Fixed in #2204 (5cb113b): TotalF64/TotalF32 in std.traits (D97, D99); battery green on d5c6ef3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions