1*f3087befSAndrew Turner// polynomial for approximating atanf(x) 2*f3087befSAndrew Turner// 3*f3087befSAndrew Turner// Copyright (c) 2022-2024, Arm Limited. 4*f3087befSAndrew Turner// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception 5*f3087befSAndrew Turner 6*f3087befSAndrew Turner// Generate list of monomials: 7*f3087befSAndrew Turner// Taylor series of atan is of the form x + ax^3 + bx^5 + cx^7 + ... 8*f3087befSAndrew Turner// So generate a, b, c, ... such that we can approximate atan(x) by: 9*f3087befSAndrew Turner// x + x^3 * (a + bx^2 + cx^4 + ...) 10*f3087befSAndrew Turner 11*f3087befSAndrew Turnerdeg = 7; 12*f3087befSAndrew Turner 13*f3087befSAndrew Turnera = 1.1754943508222875e-38; 14*f3087befSAndrew Turnerb = 1; 15*f3087befSAndrew Turner 16*f3087befSAndrew Turnerpoly = fpminimax((atan(sqrt(x))-sqrt(x))/x^(3/2), deg, [|single ...|], [a;b]); 17*f3087befSAndrew Turner 18*f3087befSAndrew Turnerdisplay = hexadecimal; 19*f3087befSAndrew Turnerprint("coeffs:"); 20*f3087befSAndrew Turnerfor i from 0 to deg do coeff(poly,i); 21