1// polynomial for approximating asinh(x) 2// 3// Copyright (c) 2022-2023, Arm Limited. 4// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception 5 6deg = 9; 7 8a = 0x1.0p-12; 9b = 1.0; 10 11f = proc(y) { 12 return asinh(x); 13}; 14 15approx = proc(poly, d) { 16 return remez(1 - poly(x)/f(x), deg-d, [a;b], x^d/f(x), 1e-10); 17}; 18 19poly = x; 20for i from 2 to deg do { 21 p = roundcoefficients(approx(poly,i), [|SG ...|]); 22 poly = poly + x^i*coeff(p,0); 23}; 24 25display = hexadecimal; 26print("rel error:", accurateinfnorm(1-poly(x)/f(x), [a;b], 30)); 27print("in [",a,b,"]"); 28print("coeffs:"); 29for i from 2 to deg do coeff(poly,i); 30