diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 00:58:26 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 00:58:26 +0000 |
commit | 29109db5ff4f54e1b9694505aa34d54fda6ab6d2 (patch) | |
tree | b6182e391304fb3a42c51d482dcf671f540f2363 /pl/math/tools/erfcf.sollya | |
parent | 5977ae8110ccfef79770bcc209243185bda69811 (diff) | |
parent | 172d24a7ae67ee7bae413d5a8618f1b5edc002be (diff) | |
download | arm-optimized-routines-29109db5ff4f54e1b9694505aa34d54fda6ab6d2.tar.gz |
Snap for 10447354 from 172d24a7ae67ee7bae413d5a8618f1b5edc002be to mainline-tethering-releaseaml_tet_341712060aml_tet_341610020aml_tet_341511010aml_tet_341411060aml_tet_341310230aml_tet_341112070aml_tet_341010040aml_tet_340913030android14-mainline-tethering-release
Change-Id: I3d1ba62dd3ec4f1f932ef5e2ce24308402f6b85d
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); |