Average Error: 0.3 → 0.3
Time: 18.9s
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 r19414 = 1.0;
        double r19415 = x;
        double r19416 = tan(r19415);
        double r19417 = r19416 * r19416;
        double r19418 = r19414 - r19417;
        double r19419 = r19414 + r19417;
        double r19420 = r19418 / r19419;
        return r19420;
}

double f(double x) {
        double r19421 = 1.0;
        double r19422 = x;
        double r19423 = sin(r19422);
        double r19424 = tan(r19422);
        double r19425 = r19423 * r19424;
        double r19426 = cos(r19422);
        double r19427 = r19425 / r19426;
        double r19428 = r19421 - r19427;
        double r19429 = r19421 + r19427;
        double r19430 = r19428 / r19429;
        return r19430;
}

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 2019322 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))