Average Error: 0.3 → 0.4
Time: 23.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\frac{1}{\sqrt{1} - \tan x}} \cdot \frac{\tan x + \sqrt{1}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\frac{1}{\sqrt{1} - \tan x}} \cdot \frac{\tan x + \sqrt{1}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}
double f(double x) {
        double r859247 = 1.0;
        double r859248 = x;
        double r859249 = tan(r859248);
        double r859250 = r859249 * r859249;
        double r859251 = r859247 - r859250;
        double r859252 = r859247 + r859250;
        double r859253 = r859251 / r859252;
        return r859253;
}

double f(double x) {
        double r859254 = 1.0;
        double r859255 = 1.0;
        double r859256 = sqrt(r859255);
        double r859257 = x;
        double r859258 = tan(r859257);
        double r859259 = r859256 - r859258;
        double r859260 = r859254 / r859259;
        double r859261 = r859254 / r859260;
        double r859262 = r859258 + r859256;
        double r859263 = fma(r859258, r859258, r859255);
        double r859264 = r859262 / r859263;
        double r859265 = r859261 * r859264;
        return r859265;
}

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 clear-num0.4

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

    \[\leadsto \left(\sqrt{1} + \tan x\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(\tan x, \tan x, 1\right) \cdot \frac{1}{\sqrt{1} - \tan x}}}\]
  13. Applied *-un-lft-identity0.4

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

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

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

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

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

Reproduce

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