Average Error: 0.3 → 0.4
Time: 24.6s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 + \tan x}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 + \tan x}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x}}
double f(double x) {
        double r693611 = 1.0;
        double r693612 = x;
        double r693613 = tan(r693612);
        double r693614 = r693613 * r693613;
        double r693615 = r693611 - r693614;
        double r693616 = r693611 + r693614;
        double r693617 = r693615 / r693616;
        return r693617;
}

double f(double x) {
        double r693618 = 1.0;
        double r693619 = x;
        double r693620 = tan(r693619);
        double r693621 = r693618 + r693620;
        double r693622 = fma(r693620, r693620, r693618);
        double r693623 = r693618 - r693620;
        double r693624 = r693622 / r693623;
        double r693625 = r693621 / r693624;
        return r693625;
}

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{\color{blue}{1 \cdot 1} - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied difference-of-squares0.4

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

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

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

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

Reproduce

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