\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\mathsf{expm1}\left(\log \left(1 + \frac{1 - \tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\right)\right)double f(double x) {
double r918636 = 1.0;
double r918637 = x;
double r918638 = tan(r918637);
double r918639 = r918638 * r918638;
double r918640 = r918636 - r918639;
double r918641 = r918636 + r918639;
double r918642 = r918640 / r918641;
return r918642;
}
double f(double x) {
double r918643 = 1.0;
double r918644 = x;
double r918645 = tan(r918644);
double r918646 = r918645 * r918645;
double r918647 = r918643 - r918646;
double r918648 = r918646 + r918643;
double r918649 = r918647 / r918648;
double r918650 = r918643 + r918649;
double r918651 = log(r918650);
double r918652 = expm1(r918651);
return r918652;
}



Bits error versus x
Results
Initial program 0.3
rmApplied expm1-log1p-u0.4
rmApplied log1p-udef0.4
Final simplification0.4
herbie shell --seed 2019158 +o rules:numerics
(FPCore (x)
:name "Trigonometry B"
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))