This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/13932] dbl-64 pow unexpectedly slow for some inputs


https://sourceware.org/bugzilla/show_bug.cgi?id=13932

--- Comment #10 from Vincent LefÃvre <vincent-srcware at vinc17 dot net> ---
(In reply to Paul Pluzhnikov from comment #2)
> # x86_64:
> ./elf/ld.so --library-path .:math:dlfcn /tmp/test_pow64
> pow(0.562500, 1.5): 0.000990 calls/usec
> pow(0.563250, 1.5): 12.753271 calls/usec
> ratio:  12887

Note that mathematically x^1.5 = sqrt(x)^3.

Now, 0.562500 is a perfect square:

? sqrt(0.562500)
%1 = 0.75000000000000000000000000000000000000

This is probably related to the slowness. Unless the implementation tries to
provide the correct inexact flag (which I doubt), I don't see a theoretical
reason for which it would be slow in rounding to nearest. It would be very
different in a directed rounding mode since this is an exact case. Still, this
could be a corner case for an algorithm that doesn't expect exact results or
something like that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]