Average Error: 0.3 → 0.4
Time: 25.1s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\mathsf{fma}\left(\left(\frac{-1}{\cos x}\right), \left(\sin x \cdot \tan x\right), \left(\frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right) + \mathsf{fma}\left(1, 1, \left(\frac{-1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right)}{\tan x \cdot \tan x + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\mathsf{fma}\left(\left(\frac{-1}{\cos x}\right), \left(\sin x \cdot \tan x\right), \left(\frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right) + \mathsf{fma}\left(1, 1, \left(\frac{-1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right)}{\tan x \cdot \tan x + 1}
double f(double x) {
        double r713334 = 1.0;
        double r713335 = x;
        double r713336 = tan(r713335);
        double r713337 = r713336 * r713336;
        double r713338 = r713334 - r713337;
        double r713339 = r713334 + r713337;
        double r713340 = r713338 / r713339;
        return r713340;
}

double f(double x) {
        double r713341 = -1.0;
        double r713342 = x;
        double r713343 = cos(r713342);
        double r713344 = r713341 / r713343;
        double r713345 = sin(r713342);
        double r713346 = tan(r713342);
        double r713347 = r713345 * r713346;
        double r713348 = 1.0;
        double r713349 = r713348 / r713343;
        double r713350 = r713349 * r713347;
        double r713351 = fma(r713344, r713347, r713350);
        double r713352 = r713344 * r713347;
        double r713353 = fma(r713348, r713348, r713352);
        double r713354 = r713351 + r713353;
        double r713355 = r713346 * r713346;
        double r713356 = r713355 + r713348;
        double r713357 = r713354 / r713356;
        return r713357;
}

Error

Bits error versus x

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 - \color{blue}{\frac{\sin x}{\cos x}} \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied associate-*l/0.4

    \[\leadsto \frac{1 - \color{blue}{\frac{\sin x \cdot \tan x}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  5. Using strategy rm
  6. Applied div-inv0.4

    \[\leadsto \frac{1 - \color{blue}{\left(\sin x \cdot \tan x\right) \cdot \frac{1}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  7. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\color{blue}{1 \cdot 1} - \left(\sin x \cdot \tan x\right) \cdot \frac{1}{\cos x}}{1 + \tan x \cdot \tan x}\]
  8. Applied prod-diff0.4

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(1, 1, \left(-\frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right) + \mathsf{fma}\left(\left(-\frac{1}{\cos x}\right), \left(\sin x \cdot \tan x\right), \left(\frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right)}}{1 + \tan x \cdot \tan x}\]
  9. Final simplification0.4

    \[\leadsto \frac{\mathsf{fma}\left(\left(\frac{-1}{\cos x}\right), \left(\sin x \cdot \tan x\right), \left(\frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right) + \mathsf{fma}\left(1, 1, \left(\frac{-1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)\right)\right)}{\tan x \cdot \tan x + 1}\]

Reproduce

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