Average Error: 0.3 → 0.4
Time: 5.1s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \tan x \cdot \frac{\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 - \tan x \cdot \frac{\sin x}{\cos x}}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r12299 = 1.0;
        double r12300 = x;
        double r12301 = tan(r12300);
        double r12302 = r12301 * r12301;
        double r12303 = r12299 - r12302;
        double r12304 = r12299 + r12302;
        double r12305 = r12303 / r12304;
        return r12305;
}

double f(double x) {
        double r12306 = 1.0;
        double r12307 = x;
        double r12308 = tan(r12307);
        double r12309 = sin(r12307);
        double r12310 = cos(r12307);
        double r12311 = r12309 / r12310;
        double r12312 = r12308 * r12311;
        double r12313 = r12306 - r12312;
        double r12314 = r12308 * r12308;
        double r12315 = r12306 + r12314;
        double r12316 = r12313 / r12315;
        return r12316;
}

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 *-un-lft-identity0.4

    \[\leadsto \frac{1 - \frac{\tan x \cdot \sin x}{\color{blue}{1 \cdot \cos x}}}{1 + \tan x \cdot \tan x}\]
  7. Applied times-frac0.4

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

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

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

Reproduce

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