aboutsummaryrefslogtreecommitdiff
path: root/pl/math/tools/cbrtf.sollya
blob: 4e0cc69b46a58eefce8e906cdbd034c1f7921956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// polynomial for approximating cbrt(x) in single precision
//
// Copyright (c) 2022-2023, 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, [|single ...|], [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), SG, RN);