Average Error: 0.3 → 0.4
Time: 16.9s
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 + \tan x \cdot \tan 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 + \tan x \cdot \tan x}
double f(double x) {
        double r21521 = 1.0;
        double r21522 = x;
        double r21523 = tan(r21522);
        double r21524 = r21523 * r21523;
        double r21525 = r21521 - r21524;
        double r21526 = r21521 + r21524;
        double r21527 = r21525 / r21526;
        return r21527;
}

double f(double x) {
        double r21528 = 1.0;
        double r21529 = x;
        double r21530 = tan(r21529);
        double r21531 = sin(r21529);
        double r21532 = r21530 * r21531;
        double r21533 = cos(r21529);
        double r21534 = r21532 / r21533;
        double r21535 = r21528 - r21534;
        double r21536 = r21530 * r21530;
        double r21537 = r21528 + r21536;
        double r21538 = r21535 / r21537;
        return r21538;
}

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

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

Reproduce

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