Average Error: 0.3 → 0.4
Time: 22.4s
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 r693614 = 1.0;
        double r693615 = x;
        double r693616 = tan(r693615);
        double r693617 = r693616 * r693616;
        double r693618 = r693614 - r693617;
        double r693619 = r693614 + r693617;
        double r693620 = r693618 / r693619;
        return r693620;
}

double f(double x) {
        double r693621 = 1.0;
        double r693622 = x;
        double r693623 = tan(r693622);
        double r693624 = r693621 + r693623;
        double r693625 = fma(r693623, r693623, r693621);
        double r693626 = r693621 - r693623;
        double r693627 = r693625 / r693626;
        double r693628 = r693624 / r693627;
        return r693628;
}

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