aboutsummaryrefslogtreecommitdiff
path: root/pl/math/tools/tan.sollya
blob: bb0bb28270e33a3c40605d950fa7571dfff88634 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// polynomial for approximating double precision tan(x)
//
// Copyright (c) 2023, Arm Limited.
// SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception

deg = 8;

// interval bounds
a = 0x1.0p-126;
b = pi / 8;

display = hexadecimal;

f = (tan(sqrt(x))-sqrt(x))/x^(3/2);
poly = fpminimax(f, deg, [|double ...|], [a*a;b*b]);

//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);