-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Openlibm's pow
, hypot
, exp
and log
are considerably slower than Glibc's
#234
Comments
maybe you should mention the version of glibc you are comparing to, since starting from 2.28, the slow paths have been removed from some functions, improving their speed at the expense of less accurate results. In the next release (2.34) the slow path will be removed for tan, asin, acos, atan, and atan2 (all for double precision).
|
Got this: |
The benchmark code is |
Openlibm was built with flags
|
Also reproduced with $ cd test; make bench
$ diff -y <(echo bench-syslibm; ./bench-syslibm) <(echo bench-openlibm; ./bench-openlibm)
bench-syslibm | bench-openlibm
pow : 30.8371 MPS | pow : 12.1320 MPS
hypot : 82.2698 MPS | hypot : 56.0207 MPS
exp : 98.3850 MPS | exp : 79.9451 MPS
log : 101.1390 MPS | log : 71.0276 MPS
log10 : 63.9289 MPS | log10 : 57.6193 MPS
sin : 80.4622 MPS | sin : 103.3160 MPS
cos : 85.3477 MPS | cos : 92.5908 MPS
tan : 65.5768 MPS | tan : 53.8914 MPS
asin : 88.9095 MPS | asin : 64.9857 MPS
acos : 81.0402 MPS | acos : 70.5646 MPS
atan : 82.0650 MPS | atan : 70.4644 MPS
atan2 : 28.3463 MPS | atan2 : 34.4602 MPS |
see https://members.loria.fr/PZimmermann/papers/accuracy.pdf (which uses Intel's compiler from 2023) |
no, as far as I know.
I believe the answer is no, since worst cases are in regions where the algorithm used has a bad accuracy. If you add a special case for one input, another one near that input will also give a large error. Yes all CRlibm functions have maximal error 0.5 ulp, as do the functions from CORE-MATH (https://core-math.gitlabpages.inria.fr/) |
I don't have the knowledge to do that.
the paper is already quite long, feel free to do the same for complex numbers !
we prefer to focus on accuracy
sorry I answered your question about worst cases |
yes, the next update of https://members.loria.fr/PZimmermann/papers/accuracy.pdf will include the Microsoft math library
1/10^5 is not exactly representable in binary. I prefer 0.000009999999999999999 which recalls you this fact. |
I'm not sure, since for the binary64 pow function, the largest error I get with AMD Libm 4.0 is 0.762 ulp (for x=0x1.00a000205d461p+1 and y=-0x1.fd35c41fc20bbp+9), whereas with Visual Studio 2022 I get 91.3 ulps (with x=0x1.fffff9c61ce40p-1 and y=0x1.c4e304ed4c734p+31). |
I just ran benchmarks of openlibm (compiled by gcc and clang) and system libm (Glibc), and these were the results:
System Libm is considerably faster than Openlibm on
pow
(4x)hypot
, (1.5x)exp
(1.5x) andlog
(1.7x), while Openlibm outperforms system Libm in almost all trigonometric functions (exceptcos
).Running on Kubuntu 21.04 (kernel 5.11.0-17-generic) in an Asus Rog Strix G531GT, CPU Intel Core i7-9750H CPU 2.60GHz.
Edit:
GNU libc version: 2.33
GNU libc release: release
The text was updated successfully, but these errors were encountered: