[Issue 15008] New: floor(float x) and floor(double x) have no FPU implementation

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 3 05:38:51 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15008

          Issue ID: 15008
           Summary: floor(float x) and floor(double x) have no FPU
                    implementation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: aliloko at gmail.com

This came up in JPEG decoding performance measurement.

https://github.com/lgvz/imageformats/issues/4

Commit here:
https://github.com/p0nce/imageformats/commit/dd9a7a21e270da365eef58722557080493b9a86c

While the floor() operations in this commit proved useless, I looked at its
implementation in Phobos: https://github.com/lgvz/imageformats/issues/4

It appears that floor(float) and floor(double) have a software-emulation of
floor while floor(real) use the proper FPU instructions.

Why is that?

More over, it would be nice to have lfloor/lceil/ltrunc, since floor calls are
currently usually accompanied with cast to int.

--


More information about the Digitalmars-d-bugs mailing list