diff options
author | Elliott Hughes <enh@google.com> | 2023-01-25 16:31:42 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2023-01-25 18:11:56 +0000 |
commit | 62662f115a17a5548402fcd02f3b7e1b9b38e087 (patch) | |
tree | 945eb1832687ad5eb97c433013617dbe107718e5 /pl/math/tools/erfcf.sollya | |
parent | 04d0bc466ce39c702459d77a15754a19533eaec9 (diff) | |
parent | 56e3bf05c19c4e28e1f5edd9093c712f16c5c32a (diff) | |
download | arm-optimized-routines-62662f115a17a5548402fcd02f3b7e1b9b38e087.tar.gz |
Upgrade ARM-software/optimized-routines to v23.01
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update arm-optimized-routines
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I03de0ecb0ea89c2a77b1c411685af09fd480b63e
Diffstat (limited to 'pl/math/tools/erfcf.sollya')
-rw-r--r-- | pl/math/tools/erfcf.sollya | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pl/math/tools/erfcf.sollya b/pl/math/tools/erfcf.sollya new file mode 100644 index 0000000..69c6836 --- /dev/null +++ b/pl/math/tools/erfcf.sollya @@ -0,0 +1,31 @@ +// polynomial for approximating erfc(x)*exp(x*x) +// +// Copyright (c) 2022-2023, Arm Limited. +// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +deg = 15; // poly degree + +// interval bounds +a = 0x1.0p-26; +b = 2; + +f = proc(y) { + return erfc(y) * exp(y*y); +}; + +approx = proc(poly, d) { + return remez(1 - poly(x)/f(x), deg-d, [a;b], x^d/f(x), 1e-10); +}; + +poly = 0; +for i from 0 to deg do { + p = roundcoefficients(approx(poly,i), [|D ...|]); + poly = poly + x^i*coeff(p,0); + print(i); +}; + +display = hexadecimal; +print("rel error:", accurateinfnorm(1-poly(x)/f(x), [a;b], 30)); +print("in [",a,b,"]"); +print("coeffs:"); +for i from 0 to deg do coeff(poly,i); |