Average Error: 0.3 → 0.4
Time: 4.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \tan x \cdot \frac{\sin x}{\cos x}}{1 + \frac{\tan x \cdot \sin x}{\cos x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \tan x \cdot \frac{\sin x}{\cos x}}{1 + \frac{\tan x \cdot \sin x}{\cos x}}
double f(double x) {
        double r10461 = 1.0;
        double r10462 = x;
        double r10463 = tan(r10462);
        double r10464 = r10463 * r10463;
        double r10465 = r10461 - r10464;
        double r10466 = r10461 + r10464;
        double r10467 = r10465 / r10466;
        return r10467;
}

double f(double x) {
        double r10468 = 1.0;
        double r10469 = x;
        double r10470 = tan(r10469);
        double r10471 = sin(r10469);
        double r10472 = cos(r10469);
        double r10473 = r10471 / r10472;
        double r10474 = r10470 * r10473;
        double r10475 = r10468 - r10474;
        double r10476 = r10470 * r10471;
        double r10477 = r10476 / r10472;
        double r10478 = r10468 + r10477;
        double r10479 = r10475 / r10478;
        return r10479;
}

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 associate-*r/0.4

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

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

    \[\leadsto \frac{1 - \frac{\tan x \cdot \sin x}{\cos x}}{1 + \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}}\]
  8. Using strategy rm
  9. Applied *-un-lft-identity0.3

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

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

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

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

Reproduce

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