21 lines
480 B
Plaintext
21 lines
480 B
Plaintext
|
|
// 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);
|