Average Error: 0.3 → 0.4
Time: 5.0s
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 + \tan x \cdot \tan 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 + \tan x \cdot \tan x}
double f(double x) {
        double r13451 = 1.0;
        double r13452 = x;
        double r13453 = tan(r13452);
        double r13454 = r13453 * r13453;
        double r13455 = r13451 - r13454;
        double r13456 = r13451 + r13454;
        double r13457 = r13455 / r13456;
        return r13457;
}

double f(double x) {
        double r13458 = 1.0;
        double r13459 = x;
        double r13460 = tan(r13459);
        double r13461 = sin(r13459);
        double r13462 = cos(r13459);
        double r13463 = r13461 / r13462;
        double r13464 = r13460 * r13463;
        double r13465 = r13458 - r13464;
        double r13466 = r13460 * r13460;
        double r13467 = r13458 + r13466;
        double r13468 = r13465 / r13467;
        return r13468;
}

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 *-un-lft-identity0.4

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

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

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

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

Reproduce

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