Average Error: 0.3 → 0.4
Time: 42.2s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\sqrt{1} + \tan x}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\sqrt{1} - \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\sqrt{1} + \tan x}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{\sqrt{1} - \tan x}}
double f(double x) {
        double r735387 = 1.0;
        double r735388 = x;
        double r735389 = tan(r735388);
        double r735390 = r735389 * r735389;
        double r735391 = r735387 - r735390;
        double r735392 = r735387 + r735390;
        double r735393 = r735391 / r735392;
        return r735393;
}

double f(double x) {
        double r735394 = 1.0;
        double r735395 = sqrt(r735394);
        double r735396 = x;
        double r735397 = tan(r735396);
        double r735398 = r735395 + r735397;
        double r735399 = fma(r735397, r735397, r735394);
        double r735400 = r735395 - r735397;
        double r735401 = r735399 / r735400;
        double r735402 = r735398 / r735401;
        return r735402;
}

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. Simplified0.4

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

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

Reproduce

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