xref: /freebsd/contrib/arm-optimized-routines/pl/math/tools/v_erf.sollya (revision 9f23cbd6cae82fd77edfad7173432fa8dccd0a95)
1// polynomial for approximating erf(x).
2// To generate coefficients for interval i (0 to 47) do:
3// $ sollya v_erf.sollya $i
4//
5// Copyright (c) 2022-2023, Arm Limited.
6// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
7
8scale = 1/8;
9deg = 9;
10
11itv = parse(__argv[0]);
12if (itv == 0)  then { a = 0x1p-1022; }
13else                { a = itv * scale; };
14
15prec=256;
16
17poly = fpminimax(erf(scale*x+a), deg, [|D ...|], [0; 1]);
18
19display = hexadecimal;
20for i from 0 to deg do coeff(poly, i);