www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15008] New: floor(float x) and floor(double x) have no FPU

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 puremagic.com
          Reporter: aliloko 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.

--
Sep 03 2015