xref: /freebsd/contrib/arm-optimized-routines/pl/math/tools/v_erf.sollya (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
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);