Average Error: 0.3 → 0.3
Time: 14.4s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \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 - \frac{\tan x \cdot \sin x}{\cos x}}{1 + \frac{\tan x \cdot \sin x}{\cos x}}
double f(double x) {
        double r19579 = 1.0;
        double r19580 = x;
        double r19581 = tan(r19580);
        double r19582 = r19581 * r19581;
        double r19583 = r19579 - r19582;
        double r19584 = r19579 + r19582;
        double r19585 = r19583 / r19584;
        return r19585;
}

double f(double x) {
        double r19586 = 1.0;
        double r19587 = x;
        double r19588 = tan(r19587);
        double r19589 = sin(r19587);
        double r19590 = r19588 * r19589;
        double r19591 = cos(r19587);
        double r19592 = r19590 / r19591;
        double r19593 = r19586 - r19592;
        double r19594 = r19586 + r19592;
        double r19595 = r19593 / r19594;
        return r19595;
}

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. Final simplification0.3

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

Reproduce

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