Average Error: 0.3 → 0.5
Time: 21.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\left(\left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) - \left(\tan x \cdot \left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right)\right) \cdot \sqrt[3]{\tan x}\right) + 1\right) \cdot \frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right), \tan x \cdot \tan x, 1\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\left(\left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) - \left(\tan x \cdot \left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right)\right) \cdot \sqrt[3]{\tan x}\right) + 1\right) \cdot \frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right), \tan x \cdot \tan x, 1\right)}
double f(double x) {
        double r329490 = 1.0;
        double r329491 = x;
        double r329492 = tan(r329491);
        double r329493 = r329492 * r329492;
        double r329494 = r329490 - r329493;
        double r329495 = r329490 + r329493;
        double r329496 = r329494 / r329495;
        return r329496;
}

double f(double x) {
        double r329497 = x;
        double r329498 = tan(r329497);
        double r329499 = r329498 * r329498;
        double r329500 = r329499 * r329499;
        double r329501 = cbrt(r329498);
        double r329502 = r329501 * r329501;
        double r329503 = r329498 * r329502;
        double r329504 = r329503 * r329501;
        double r329505 = r329500 - r329504;
        double r329506 = 1.0;
        double r329507 = r329505 + r329506;
        double r329508 = r329506 - r329499;
        double r329509 = fma(r329500, r329499, r329506);
        double r329510 = r329508 / r329509;
        double r329511 = r329507 * r329510;
        return r329511;
}

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 flip3-+0.4

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\color{blue}{\frac{{1}^{3} + {\left(\tan x \cdot \tan x\right)}^{3}}{1 \cdot 1 + \left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) - 1 \cdot \left(\tan x \cdot \tan x\right)\right)}}}\]
  4. Applied associate-/r/0.4

    \[\leadsto \color{blue}{\frac{1 - \tan x \cdot \tan x}{{1}^{3} + {\left(\tan x \cdot \tan x\right)}^{3}} \cdot \left(1 \cdot 1 + \left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) - 1 \cdot \left(\tan x \cdot \tan x\right)\right)\right)}\]
  5. Simplified0.4

    \[\leadsto \color{blue}{\frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right), \tan x \cdot \tan x, 1\right)}} \cdot \left(1 \cdot 1 + \left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) - 1 \cdot \left(\tan x \cdot \tan x\right)\right)\right)\]
  6. Using strategy rm
  7. Applied add-cube-cbrt0.5

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right), \tan x \cdot \tan x, 1\right)} \cdot \left(1 \cdot 1 + \left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) - 1 \cdot \left(\tan x \cdot \color{blue}{\left(\left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \sqrt[3]{\tan x}\right)}\right)\right)\right)\]
  8. Applied associate-*r*0.5

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

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

Reproduce

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