Average Error: 0.3 → 0.4
Time: 5.6s
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 r13400 = 1.0;
        double r13401 = x;
        double r13402 = tan(r13401);
        double r13403 = r13402 * r13402;
        double r13404 = r13400 - r13403;
        double r13405 = r13400 + r13403;
        double r13406 = r13404 / r13405;
        return r13406;
}

double f(double x) {
        double r13407 = 1.0;
        double r13408 = x;
        double r13409 = tan(r13408);
        double r13410 = sin(r13408);
        double r13411 = r13409 * r13410;
        double r13412 = cos(r13408);
        double r13413 = r13411 / r13412;
        double r13414 = r13407 - r13413;
        double r13415 = r13409 * r13409;
        double r13416 = r13407 + r13415;
        double r13417 = r13414 / r13416;
        return r13417;
}

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