Average Error: 0.3 → 0.3
Time: 19.3s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{\sin x \cdot \tan x}{\cos x}}{1 + \frac{\sin x \cdot \tan x}{\cos x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{\sin x \cdot \tan x}{\cos x}}{1 + \frac{\sin x \cdot \tan x}{\cos x}}
double f(double x) {
        double r20452 = 1.0;
        double r20453 = x;
        double r20454 = tan(r20453);
        double r20455 = r20454 * r20454;
        double r20456 = r20452 - r20455;
        double r20457 = r20452 + r20455;
        double r20458 = r20456 / r20457;
        return r20458;
}

double f(double x) {
        double r20459 = 1.0;
        double r20460 = x;
        double r20461 = sin(r20460);
        double r20462 = tan(r20460);
        double r20463 = r20461 * r20462;
        double r20464 = cos(r20460);
        double r20465 = r20463 / r20464;
        double r20466 = r20459 - r20465;
        double r20467 = r20459 + r20465;
        double r20468 = r20466 / r20467;
        return r20468;
}

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. Simplified0.4

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

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

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

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

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

Reproduce

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