aboutsummaryrefslogtreecommitdiff
path: root/pl/math/tools
diff options
context:
space:
mode:
authorJoe Ramsay <Joe.Ramsay@arm.com>2022-06-16 12:07:10 +0100
committerJoe Ramsay <joe.ramsay@arm.com>2022-06-16 12:07:10 +0100
commit2eedcfa316be6a8b74e062e903a7551fb4b7ddd8 (patch)
treecb74b999980210ecc9614f5ed64fc80906e17ef2 /pl/math/tools
parentf75d8045e2be293c4d1b8a54267e4db4feec5f0c (diff)
downloadarm-optimized-routines-2eedcfa316be6a8b74e062e903a7551fb4b7ddd8.tar.gz
pl/math: Add scalar atan2f
Ran make check and benchmarks. New routine is accurate to 3.0 ULP.
Diffstat (limited to 'pl/math/tools')
-rw-r--r--pl/math/tools/atanf.sollya20
1 files changed, 20 insertions, 0 deletions
diff --git a/pl/math/tools/atanf.sollya b/pl/math/tools/atanf.sollya
new file mode 100644
index 0000000..42b8c36
--- /dev/null
+++ b/pl/math/tools/atanf.sollya
@@ -0,0 +1,20 @@
+// polynomial for approximating atanf(x)
+//
+// Copyright (c) 2022, Arm Limited.
+// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
+
+// Generate list of monomials:
+// Taylor series of atan is of the form x + ax^3 + bx^5 + cx^7 + ...
+// So generate a, b, c, ... such that we can approximate atan(x) by:
+// x + x^3 * (a + bx^2 + cx^4 + ...)
+
+deg = 7;
+
+a = 1.1754943508222875e-38;
+b = 1;
+
+poly = fpminimax((atan(sqrt(x))-sqrt(x))/x^(3/2), deg, [|single ...|], [a;b]);
+
+display = hexadecimal;
+print("coeffs:");
+for i from 0 to deg do coeff(poly,i);