diff options
author | Joe Ramsay <Joe.Ramsay@arm.com> | 2022-07-12 09:13:09 +0100 |
---|---|---|
committer | Joe Ramsay <joe.ramsay@arm.com> | 2022-07-12 09:13:09 +0100 |
commit | ea3ad6c20ddd99aa1ee3f86e8f4bc5fe76cee35c (patch) | |
tree | 4ce195532f2d8bfafa38425b7b7ea51be0e7104d /pl/math/tools/asinhf.sollya | |
parent | d9a816bb547d3acc29e343c85dc568ff86add1c9 (diff) | |
download | arm-optimized-routines-ea3ad6c20ddd99aa1ee3f86e8f4bc5fe76cee35c.tar.gz |
pl/math: Add scalar asinhf
asinhf depends on logf, which has been copied over from the main math
directory. The only modification was to change the name logf to
optr_aor_log_f32 to resolve any ambiguity with libm.
Worst-case error is about 3.4 ULP, at very large input. There are 4
intervals with slightly different error behaviour, as follows:
Interval Worst-case accuracy (ulp)
|x| < 2^-12 0
|x| < 1 1.3
|x| < sqrt(FLT_MAX) 2.0
|x| < infinity 3.4
Diffstat (limited to 'pl/math/tools/asinhf.sollya')
-rw-r--r-- | pl/math/tools/asinhf.sollya | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pl/math/tools/asinhf.sollya b/pl/math/tools/asinhf.sollya new file mode 100644 index 0000000..cbe7d62 --- /dev/null +++ b/pl/math/tools/asinhf.sollya @@ -0,0 +1,29 @@ +// polynomial for approximating asinh(x) +// +// Copyright (c) 2022, Arm Limited. +// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + +deg = 9; + +a = 0x1.0p-12; +b = 1.0; + +f = proc(y) { + return asinh(x); +}; + +approx = proc(poly, d) { + return remez(1 - poly(x)/f(x), deg-d, [a;b], x^d/f(x), 1e-10); +}; + +poly = x; +for i from 2 to deg do { + p = roundcoefficients(approx(poly,i), [|SG ...|]); + poly = poly + x^i*coeff(p,0); +}; + +display = hexadecimal; +print("rel error:", accurateinfnorm(1-poly(x)/f(x), [a;b], 30)); +print("in [",a,b,"]"); +print("coeffs:"); +for i from 2 to deg do coeff(poly,i); |