xref: /freebsd/contrib/arm-optimized-routines/pl/math/tools/erfc.sollya (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1// tables and constants for approximating erfc(x).
2//
3// Copyright (c) 2023, Arm Limited.
4// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
5
6display = hexadecimal;
7prec=128;
8
9// Tables
10print("{ i, r, erfc(r), 2/sqrt(pi) * exp(-r^2) }");
11for i from 0 to 3787 do {
12  r = 0.0 + i / 128;
13  t0 = double(erfc(r) * 2^128);
14  t1 = double(2/sqrt(pi) * exp(-r * r) * 2^128);
15  print("{ " @ t0 @ ",\t" @ t1 @ " },");
16};
17
18// Constants
19print("> 2/sqrt(pi)");
20double(2/sqrt(pi));
21
22print("> 1/3");
23double(1/3);
24
25print("> P5");
26double(2/15);
27double(1/10);
28double(2/9);
29double(2/45);
30
31print("> P6");
32double(1/42);
33double(1/7);
34double(2/21);
35double(4/315);
36
37print("> Q");
38double( 5.0 / 4.0);
39double( 6.0 / 5.0);
40double( 7.0 / 6.0);
41double( 8.0 / 7.0);
42double( 9.0 / 8.0);
43double(10.0 / 9.0);
44
45print("> R");
46double(-2.0 * 4.0 / (5.0 * 6.0));
47double(-2.0 * 5.0 / (6.0 * 7.0));
48double(-2.0 * 6.0 / (7.0 * 8.0));
49double(-2.0 * 7.0 / (8.0 * 9.0));
50double(-2.0 * 8.0 / (9.0 * 10.0));
51double(-2.0 * 9.0 / (10.0 * 11.0));
52