Average Error: 0.3 → 0.3
Time: 5.7s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\sqrt{1} \cdot \sqrt{1} - \tan x \cdot \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\sqrt{1} \cdot \sqrt{1} - \tan x \cdot \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}
double f(double x) {
        double r14154 = 1.0;
        double r14155 = x;
        double r14156 = tan(r14155);
        double r14157 = r14156 * r14156;
        double r14158 = r14154 - r14157;
        double r14159 = r14154 + r14157;
        double r14160 = r14158 / r14159;
        return r14160;
}

double f(double x) {
        double r14161 = 1.0;
        double r14162 = sqrt(r14161);
        double r14163 = r14162 * r14162;
        double r14164 = x;
        double r14165 = tan(r14164);
        double r14166 = r14165 * r14165;
        double r14167 = r14163 - r14166;
        double r14168 = fma(r14165, r14165, r14161);
        double r14169 = r14167 / r14168;
        return r14169;
}

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 add-sqr-sqrt0.3

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

    \[\leadsto \frac{\color{blue}{\left(\sqrt{1} + \tan x\right) \cdot \left(\sqrt{1} - \tan x\right)}}{1 + \tan x \cdot \tan x}\]
  5. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{\sqrt{1} + \tan x}{\frac{1 + \tan x \cdot \tan x}{\sqrt{1} - \tan x}}}\]
  6. Using strategy rm
  7. Applied flip--0.4

    \[\leadsto \frac{\sqrt{1} + \tan x}{\frac{1 + \tan x \cdot \tan x}{\color{blue}{\frac{\sqrt{1} \cdot \sqrt{1} - \tan x \cdot \tan x}{\sqrt{1} + \tan x}}}}\]
  8. Applied associate-/r/0.4

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

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

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{1} \cdot \sqrt{1} - \tan x \cdot \tan x}{\sqrt{1} - \tan x}}}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x \cdot \tan x} \cdot \left(\sqrt{1} + \tan x\right)}\]
  12. Applied associate-/l/0.5

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

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

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

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)))))