Average Error: 0.3 → 0.4
Time: 5.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{1 + \frac{\tan x \cdot \sin x}{\cos x}} - \frac{\frac{\tan x \cdot \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}{1 + \frac{\tan x \cdot \sin x}{\cos x}} - \frac{\frac{\tan x \cdot \sin x}{\cos x}}{1 + \frac{\tan x \cdot \sin x}{\cos x}}
double f(double x) {
        double r13520 = 1.0;
        double r13521 = x;
        double r13522 = tan(r13521);
        double r13523 = r13522 * r13522;
        double r13524 = r13520 - r13523;
        double r13525 = r13520 + r13523;
        double r13526 = r13524 / r13525;
        return r13526;
}

double f(double x) {
        double r13527 = 1.0;
        double r13528 = x;
        double r13529 = tan(r13528);
        double r13530 = sin(r13528);
        double r13531 = r13529 * r13530;
        double r13532 = cos(r13528);
        double r13533 = r13531 / r13532;
        double r13534 = r13527 + r13533;
        double r13535 = r13527 / r13534;
        double r13536 = r13533 / r13534;
        double r13537 = r13535 - r13536;
        return r13537;
}

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 div-sub0.4

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

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

Reproduce

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