diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:07:20 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:07:20 +0000 |
commit | 70bf985bf12dfa02e9d634a433858320aa2f29dd (patch) | |
tree | b6182e391304fb3a42c51d482dcf671f540f2363 /pl/math/tools/v_erfc.sollya | |
parent | a57d1a3f7aaf52c6cc32e264be96a14ed1cec5a0 (diff) | |
parent | 172d24a7ae67ee7bae413d5a8618f1b5edc002be (diff) | |
download | arm-optimized-routines-android14-mainline-sdkext-release.tar.gz |
Snap for 10453563 from 172d24a7ae67ee7bae413d5a8618f1b5edc002be to mainline-sdkext-releaseaml_sdk_341710000aml_sdk_341510000aml_sdk_341410000aml_sdk_341110080aml_sdk_341110000aml_sdk_341010000aml_sdk_340912010android14-mainline-sdkext-release
Change-Id: I215e72558ed58a0414b9cabba3e9c567d0895c17
Diffstat (limited to 'pl/math/tools/v_erfc.sollya')
-rw-r--r-- | pl/math/tools/v_erfc.sollya | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/pl/math/tools/v_erfc.sollya b/pl/math/tools/v_erfc.sollya new file mode 100644 index 0000000..3b03ba0 --- /dev/null +++ b/pl/math/tools/v_erfc.sollya @@ -0,0 +1,46 @@ +// 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 = 12; // poly degree + +itv = parse(__argv[0]); + +bounds = [|3.725290298461914e-9, + 0.18920711500272103, + 0.41421356237309515, + 0.681792830507429, + 1, + 1.378414230005442, + 1.8284271247461903, + 2.363585661014858, + 3, + 3.756828460010884, + 4.656854249492381, + 5.727171322029716, + 7, + 8.513656920021768, + 10.313708498984761, + 12.454342644059432, + 15, + 18.027313840043536, + 21.627416997969522, + 25.908685288118864, + 31|]; + +a = bounds[itv]; +b = bounds[itv + 1]; + +f = proc(y) { + t = y + a; + return erfc(t) * exp(t*t); +}; + +poly = fpminimax(f(x), deg, [|double ...|], [0;b-a]); + +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); |