Path: blob/main/contrib/arm-optimized-routines/math/aarch64/experimental/atan_common.h
48375 views
/*1* Double-precision polynomial evaluation function for scalar2* atan(x) and atan2(y,x).3*4* Copyright (c) 2021-2024, Arm Limited.5* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception6*/78#include "math_config.h"9#include "poly_scalar_f64.h"1011/* Polynomial used in fast atan(x) and atan2(y,x) implementations12The order 19 polynomial P approximates (atan(sqrt(x))-sqrt(x))/x^(3/2). */13static inline double14eval_poly (double z, double az, double shift)15{16/* Use split Estrin scheme for P(z^2) with deg(P)=19. Use split instead of17full scheme to avoid underflow in x^16. */18double z2 = z * z;19double x2 = z2 * z2;20double x4 = x2 * x2;21double x8 = x4 * x4;22double y = fma (estrin_11_f64 (z2, x2, x4, x8, __atan_poly_data.poly + 8),23x8, estrin_7_f64 (z2, x2, x4, __atan_poly_data.poly));2425/* Finalize. y = shift + z + z^3 * P(z^2). */26y = fma (y, z2 * az, az);27y = y + shift;2829return y;30}3132#undef P333435