Bug in std::floor?
Fri Nov 10 10:24:00 GMT 2017
On 2017-11-10 05:58 +0100, Marc Glisse wrote:
> On Fri, 10 Nov 2017, Nil Geisweiller wrote:
> > Indeed! I would really like to have a look at the floor implementation, butÂ
> > it has proven difficult. It calls __builtin_floor, that is no where to beÂ
> > found. It seems to be implemented in gcc/builtins.c but it's too obfuscatedÂ
> > for me to understand.
> Look at the generated asm? Here, it is a single instruction: roundsd.
> For constant folding, you would want to look at real.c.
> builtins.c essentially delegates the work to each target to specify howÂ
> floor should be expanded, and generates a call to the system's C libraryÂ
> when that's not specified.
I found a machine independent version in glibc and slightly modified it
(expanding some macros and removing optimization barriers). It's attached.
Xi Ruoyao <email@example.com>
School of Aerospace Science and Technology, Xidian University
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2294 bytes
Desc: not available
More information about the Gcc-help