Average Error: 0.3 → 0.5
Time: 5.4s
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}}}{1 + \tan x \cdot \tan x}\]
\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}}}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r10591 = 1.0;
        double r10592 = x;
        double r10593 = tan(r10592);
        double r10594 = r10593 * r10593;
        double r10595 = r10591 - r10594;
        double r10596 = r10591 + r10594;
        double r10597 = r10595 / r10596;
        return r10597;
}

double f(double x) {
        double r10598 = 1.0;
        double r10599 = x;
        double r10600 = sin(r10599);
        double r10601 = 2.0;
        double r10602 = pow(r10600, r10601);
        double r10603 = cos(r10599);
        double r10604 = pow(r10603, r10601);
        double r10605 = r10602 / r10604;
        double r10606 = r10598 - r10605;
        double r10607 = tan(r10599);
        double r10608 = r10607 * r10607;
        double r10609 = r10598 + r10608;
        double r10610 = r10606 / r10609;
        return r10610;
}

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 tan-quot0.4

    \[\leadsto \frac{1 - \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  4. Applied tan-quot0.4

    \[\leadsto \frac{1 - \color{blue}{\frac{\sin x}{\cos x}} \cdot \frac{\sin x}{\cos x}}{1 + \tan x \cdot \tan x}\]
  5. Applied frac-times0.5

    \[\leadsto \frac{1 - \color{blue}{\frac{\sin x \cdot \sin x}{\cos x \cdot \cos x}}}{1 + \tan x \cdot \tan x}\]
  6. Simplified0.5

    \[\leadsto \frac{1 - \frac{\color{blue}{{\left(\sin x\right)}^{2}}}{\cos x \cdot \cos x}}{1 + \tan x \cdot \tan x}\]
  7. Simplified0.5

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

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

Reproduce

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