xref: /freebsd/contrib/arm-optimized-routines/pl/math/tools/atanf.sollya (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1// polynomial for approximating atanf(x)
2//
3// Copyright (c) 2022-2023, Arm Limited.
4// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
5
6// Generate list of monomials:
7// Taylor series of atan is of the form x + ax^3 + bx^5 + cx^7 + ...
8// So generate a, b, c, ... such that we can approximate atan(x) by:
9// x + x^3 * (a + bx^2 + cx^4 + ...)
10
11deg = 7;
12
13a = 1.1754943508222875e-38;
14b = 1;
15
16poly = fpminimax((atan(sqrt(x))-sqrt(x))/x^(3/2), deg, [|single ...|], [a;b]);
17
18display = hexadecimal;
19print("coeffs:");
20for i from 0 to deg do coeff(poly,i);
21