Average Error: 0.3 → 0.4
Time: 24.7s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\left(\sqrt{1} + \tan x\right) \cdot \frac{\frac{1 - \tan x \cdot \tan x}{\sqrt{1} + \tan x}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\left(\sqrt{1} + \tan x\right) \cdot \frac{\frac{1 - \tan x \cdot \tan x}{\sqrt{1} + \tan x}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}
double f(double x) {
        double r689474 = 1.0;
        double r689475 = x;
        double r689476 = tan(r689475);
        double r689477 = r689476 * r689476;
        double r689478 = r689474 - r689477;
        double r689479 = r689474 + r689477;
        double r689480 = r689478 / r689479;
        return r689480;
}

double f(double x) {
        double r689481 = 1.0;
        double r689482 = sqrt(r689481);
        double r689483 = x;
        double r689484 = tan(r689483);
        double r689485 = r689482 + r689484;
        double r689486 = r689484 * r689484;
        double r689487 = r689481 - r689486;
        double r689488 = r689487 / r689485;
        double r689489 = fma(r689484, r689484, r689481);
        double r689490 = r689488 / r689489;
        double r689491 = r689485 * r689490;
        return r689491;
}

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

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  4. Applied add-sqr-sqrt0.3

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \tan x \cdot \tan x}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  5. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(\sqrt{1} + \tan x\right) \cdot \left(\sqrt{1} - \tan x\right)}}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  6. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{\sqrt{1} + \tan x}{1} \cdot \frac{\sqrt{1} - \tan x}{1 + \tan x \cdot \tan x}}\]
  7. Simplified0.4

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

    \[\leadsto \left(\sqrt{1} + \tan x\right) \cdot \color{blue}{\frac{\sqrt{1} - \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}}\]
  9. Using strategy rm
  10. Applied flip--0.4

    \[\leadsto \left(\sqrt{1} + \tan x\right) \cdot \frac{\color{blue}{\frac{\sqrt{1} \cdot \sqrt{1} - \tan x \cdot \tan x}{\sqrt{1} + \tan x}}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\]
  11. Simplified0.4

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

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

Reproduce

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