Average Error: 0.3 → 0.4
Time: 5.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}
double f(double x) {
        double r14756 = 1.0;
        double r14757 = x;
        double r14758 = tan(r14757);
        double r14759 = r14758 * r14758;
        double r14760 = r14756 - r14759;
        double r14761 = r14756 + r14759;
        double r14762 = r14760 / r14761;
        return r14762;
}

double f(double x) {
        double r14763 = 1.0;
        double r14764 = x;
        double r14765 = sin(r14764);
        double r14766 = 2.0;
        double r14767 = pow(r14765, r14766);
        double r14768 = cos(r14764);
        double r14769 = pow(r14768, r14766);
        double r14770 = r14767 / r14769;
        double r14771 = r14763 - r14770;
        double r14772 = r14770 + r14763;
        double r14773 = r14771 / r14772;
        return r14773;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.3

    \[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  2. Taylor expanded around inf 0.4

    \[\leadsto \color{blue}{\frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}}\]
  3. Final simplification0.4

    \[\leadsto \frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}\]

Reproduce

herbie shell --seed 2020021 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))