diff options
author | Joe Ramsay <Joe.Ramsay@arm.com> | 2022-12-20 09:26:47 +0000 |
---|---|---|
committer | Joe Ramsay <joe.ramsay@arm.com> | 2022-12-20 09:26:47 +0000 |
commit | 04e91eca36b0a7dbbab78bf9401c978ab1b08b67 (patch) | |
tree | 8776137a2ff398663dc34f65ed6d842e57104b2e /pl/math/tools/cbrt.sollya | |
parent | a5fc3ed57ba4bc6df2e582f6a51c5fcc8e4459cd (diff) | |
download | arm-optimized-routines-04e91eca36b0a7dbbab78bf9401c978ab1b08b67.tar.gz |
pl/math: Add scalar & vector/Neon cbrt
New routines use the same algorithm, with simplified argument
reduction and recombination in the vector variant. Both are accurate
to 2 ULP.
Diffstat (limited to 'pl/math/tools/cbrt.sollya')
-rw-r--r-- | pl/math/tools/cbrt.sollya | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pl/math/tools/cbrt.sollya b/pl/math/tools/cbrt.sollya new file mode 100644 index 0000000..7f179eb --- /dev/null +++ b/pl/math/tools/cbrt.sollya @@ -0,0 +1,20 @@ +// polynomial for approximating cbrt(x) in double precision +// +// Copyright (c) 2022, Arm Limited. +// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +deg = 3; + +a = 0.5; +b = 1; + + +f = x^(1/3); + +poly = fpminimax(f, deg, [|double ...|], [a;b]); + +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 round(coeff(poly,i), D, RN); |