about summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/e_logf_data.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2017-09-04 17:48:46 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2017-09-29 11:46:46 +0100
commitbf27d3973d75ed676ea0a0b0dae2fac367d7749b (patch)
treefc32d238bcc9d0440a2e1d0bfeb24eac8396e135 /sysdeps/ieee754/flt-32/e_logf_data.c
parent4088d8dd29ce0629eeaa7cceca02414c85d98e05 (diff)
downloadglibc-bf27d3973d75ed676ea0a0b0dae2fac367d7749b.tar.gz
glibc-bf27d3973d75ed676ea0a0b0dae2fac367d7749b.tar.xz
glibc-bf27d3973d75ed676ea0a0b0dae2fac367d7749b.zip
New generic logf
without wrapper on aarch64:
logf reciprocal-throughput: 2.2x faster
logf latency: 1.9x faster
old worst case error: 0.89 ulp
new worst case error: 0.82 ulp
aarch64 .text size: -356 bytes
aarch64 .rodata size: +240 bytes

Uses double precision arithmetics and a lookup table to allow smaller
polynomial and avoid the use of division.

Data is in a separate translation unit with fixed layout to prevent the
compiler generating suboptimal literal access.

Errors are handled inline according to POSIX rules, but this patch
keeps the wrapper with SVID compatible error handling.

Needs libm-test-ulps adjustment for clogf in non-nearest rounding mode.

	* math/Makefile (type-float-routines): Add e_logf_data.
	* sysdeps/ieee754/flt-32/e_logf.c: New implementation.
	* sysdeps/ieee754/flt-32/e_logf_data.c: New file.
	* sysdeps/ieee754/flt-32/math_config.h (__logf_data): Define.
	(LOGF_TABLE_BITS, LOGF_POLY_ORDER): Define.
	* sysdeps/i386/fpu/e_logf_data.c: New file.
	* sysdeps/ia64/fpu/e_logf_data.c: New file.
	* sysdeps/m68k/m680x0/fpu/e_logf_data.c: New file.
Diffstat (limited to 'sysdeps/ieee754/flt-32/e_logf_data.c')
-rw-r--r--sysdeps/ieee754/flt-32/e_logf_data.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sysdeps/ieee754/flt-32/e_logf_data.c b/sysdeps/ieee754/flt-32/e_logf_data.c
new file mode 100644
index 0000000000..ce2a0f8a5c
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/e_logf_data.c
@@ -0,0 +1,44 @@
+/* Data definition for logf.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "math_config.h"
+
+const struct logf_data __logf_data = {
+  .tab = {
+  { 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2 },
+  { 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2 },
+  { 0x1.49539f0f010bp+0, -0x1.01eae7f513a67p-2 },
+  { 0x1.3c995b0b80385p+0, -0x1.b31d8a68224e9p-3 },
+  { 0x1.30d190c8864a5p+0, -0x1.6574f0ac07758p-3 },
+  { 0x1.25e227b0b8eap+0, -0x1.1aa2bc79c81p-3 },
+  { 0x1.1bb4a4a1a343fp+0, -0x1.a4e76ce8c0e5ep-4 },
+  { 0x1.12358f08ae5bap+0, -0x1.1973c5a611cccp-4 },
+  { 0x1.0953f419900a7p+0, -0x1.252f438e10c1ep-5 },
+  { 0x1p+0, 0x0p+0 },
+  { 0x1.e608cfd9a47acp-1, 0x1.aa5aa5df25984p-5 },
+  { 0x1.ca4b31f026aap-1, 0x1.c5e53aa362eb4p-4 },
+  { 0x1.b2036576afce6p-1, 0x1.526e57720db08p-3 },
+  { 0x1.9c2d163a1aa2dp-1, 0x1.bc2860d22477p-3 },
+  { 0x1.886e6037841edp-1, 0x1.1058bc8a07ee1p-2 },
+  { 0x1.767dcf5534862p-1, 0x1.4043057b6ee09p-2 },
+  },
+  .ln2 = 0x1.62e42fefa39efp-1,
+  .poly = {
+  -0x1.00ea348b88334p-2, 0x1.5575b0be00b6ap-2, -0x1.ffffef20a4123p-2,
+  }
+};