Average Error: 0.3 → 0.4
Time: 49.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 + \tan x}{\frac{1 + \frac{\sin x \cdot \tan x}{\cos x}}{1 - \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 + \tan x}{\frac{1 + \frac{\sin x \cdot \tan x}{\cos x}}{1 - \tan x}}
double f(double x) {
        double r537819 = 1.0;
        double r537820 = x;
        double r537821 = tan(r537820);
        double r537822 = r537821 * r537821;
        double r537823 = r537819 - r537822;
        double r537824 = r537819 + r537822;
        double r537825 = r537823 / r537824;
        return r537825;
}

double f(double x) {
        double r537826 = 1.0;
        double r537827 = x;
        double r537828 = tan(r537827);
        double r537829 = r537826 + r537828;
        double r537830 = sin(r537827);
        double r537831 = r537830 * r537828;
        double r537832 = cos(r537827);
        double r537833 = r537831 / r537832;
        double r537834 = r537826 + r537833;
        double r537835 = r537826 - r537828;
        double r537836 = r537834 / r537835;
        double r537837 = r537829 / r537836;
        return r537837;
}

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. Using strategy rm
  3. Applied *-un-lft-identity0.3

    \[\leadsto \frac{\color{blue}{1 \cdot 1} - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}{1 + \tan x \cdot \tan x}\]
  5. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{1 + \tan x}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x}}}\]
  6. Using strategy rm
  7. Applied tan-quot0.4

    \[\leadsto \frac{1 + \tan x}{\frac{1 + \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}}{1 - \tan x}}\]
  8. Applied associate-*r/0.4

    \[\leadsto \frac{1 + \tan x}{\frac{1 + \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}}{1 - \tan x}}\]
  9. Final simplification0.4

    \[\leadsto \frac{1 + \tan x}{\frac{1 + \frac{\sin x \cdot \tan x}{\cos x}}{1 - \tan x}}\]

Reproduce

herbie shell --seed 2019142 
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))