Skip to content

CWG2752 Excess-precision floating-point literals  #1584

Description

@jensmaurer

In C23, floating-point literals (called "constants" there) can be represented with excess precision, meaning a float literal is treated as a double or long double value (without affecting the type system, though).

In C++, there is no such permission.

Both C++ and C permit floating-point computations (including operands) to use excess precision. A footnote hints that a conversion will drop the excess precision (e.g. (float)(314.f/100.f) yields a value with float precision) (like C does), but there is no normative wording to make that happen.

What is the design intent for handling excess-precision floating-point computations in C++?

See CWG2752 for details.

Activity

  1. jfbastien commented on Sep 24, 2023

    @jfbastien
    Collaborator

    SG6 input is desired, please assign to EWG afterwards.

  2. mattkretz commented on Nov 12, 2023

    @mattkretz
    Member

    2023-11-07 SG6 Minutes

    Chair: Matthias Kretz

    Minute Taker: Philip Craig

    Summary

    The issue is asking

    What is the design intent for handling excess-precision floating-point
    computations in C++?

    Nobody in SG6 felt qualified to answer this question from an "original design
    intent" perspective. So the question was interpreted as stating design intent
    as required by numerics users. There was no consensus for a desired behavior
    and it appears that a more thorough exploration in a paper would be necessary
    to aid the discussion.

    Polls

    1. Compilers need to be allowed to use the x87 FPU for computation and
      comparison (without "too much" intermediate rounding)

    POLL: C++ should not deviate from C in how floating-point behaves (excess
    precision, fp contraction, literals)

    SF F N A SA
    0 3 1 1 1

    # of Participants: 7
    Outcome: No consensus for change
    Comments: We could really use a paper to make a more informed decision. The
    paper would need to explore the consequences of all the different options.

    Polls considered, but not taken without a better understanding of the
    consequences:

    POLL: The C++ standard should allow floating-point contraction into FMAs by
    default.

    (We disagreed on whether the current wording in [expr.pre] allows fp
    contraction. Therefore, there was no clear "status-quo" position.)

    POLL: There needs to be a standard-conforming way to control floating-point
    contraction.

  3. moved this to reviewed, needs to come back in SG6on Aug 26, 2024
  4. removed
    paper neededAn issue needs a paper to describe its solution
    on Nov 1, 2024
  5. moved this from Wroclaw '24 Friday to Wroclaw '24 in SG6on Nov 1, 2024
  6. moved this from 2024-11 Wroclaw to forwarded in SG6on Nov 19, 2024
  7. added
    EWGEvolution
    and removed
    SG6Numerics
    on Nov 19, 2024
  8. mattkretz commented on Nov 19, 2024

    @mattkretz
    Member

    #2136 (P3488) is the paper to schedule for this issue.

  9. jfbastien commented on Nov 20, 2024

    @jfbastien
    Collaborator

    Seen in EWG on Wednesday:

    Poll: CWG2752 / P3488: Floating-Point Excess Precision, FLT_EVAL_METHOD must always be 0.

    SF F N A SA
    2 5 5 4 4

    Result: not consensus

    Poll: CWG2752 / P3488: Floating-Point Excess Precision, FLT_EVAL_METHOD can have any value allowed by C (this poll requires fixing some Core wording).

    SF F N A SA
    0 5 8 4 4

    Result: not consensus

  10. added
    SG6Numerics
    and removed
    EWGEvolution
    on Nov 20, 2024
  11. moved this from forwarded to reviewed, needs to come back in SG6on May 30, 2025
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

    ISShip vehicle: ISSG6Numericssize - smallpaper size estimate

    Type

    No type

    Projects

    • Status
      reviewed, needs to come back

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions