Skip to content

Possible bug: f128 constant only has 16 decimals of precision when printed #3612

Closed

Description

@bdezonia

Using 0.5.0 the following code:

var z : f128 = 1.738954882048422195749048390299;
warn("{:.34}\n",z);

Shows this:

1.7389548820484222000000000000000000e+00

It's like the compile time constant is 64 bit rather than 128 bit. The documentation implies that floating constants are 128 bit.

Is this a bug? Or am I doing something wrong?

Activity

  1. added this to the 0.7.0 milestone on Nov 14, 2019
  2. added
    bugObserved behavior contradicts documented or intended behavior
    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.
    standard libraryThis issue involves writing Zig code for the standard library.
    on Nov 14, 2019
  3. LakeByTheWoods commented on Nov 16, 2019

    @LakeByTheWoods
    Contributor

    This is because the current float formatter internally works on 64bit floats. #1299 should fix this.

  4. Mouvedia commented on Sep 27, 2020

    @Mouvedia

    dupe of #1181?

  5. modified the milestones: 0.7.0, 0.8.0 on Oct 30, 2020
  6. modified the milestones: 0.8.0, 0.9.0 on Nov 6, 2020
  7. modified the milestones: 0.9.0, 0.10.0 on May 19, 2021
  8. added a commit that references this issue on Mar 9, 2024
    c6ad551
  9. modified the milestones: 0.15.0, 0.12.0 on Mar 12, 2024
  10. added a commit that references this issue on Mar 20, 2024
    eedcf56
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

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions