Skip to content

std.conv.to!double wrong in some cases on aarch64 #4433

Open

Description

@John-Colvin
v = "0.6".to!double;
writefln!"%x"(*cast(ulong*)&v);

I think the correct answer is 3fe3333333333333, which is what we get on dmd and ldc on x86_64, but ldc on aarch64 (macos) gives 3fe3333333333334

"1234567.89" & "12.3456789" also showed up in testing as different.

Activity

  1. JohanEngelen commented on Jul 9, 2023

    @JohanEngelen
    Member

    couldn't this be due to some rounding mode difference?

  2. John-Colvin commented on Jul 9, 2023

    @John-Colvin
    ContributorAuthor

    Well maybe... but something is definitely off, because strtod gives the right answer (3fe3333333333333).

  3. kinke commented on Jul 10, 2023

    @kinke
    Member

    The same result is obtained on Windows (tested with LDC v1.31), so if this is a bug, it's almost certainly in Phobos and related to 64-bit real (on AArch64, only for Apple).

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