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{\sqrt{1} - \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)} \cdot \left(\sqrt{1} + \tan x\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\sqrt{1} - \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)} \cdot \left(\sqrt{1} + \tan x\right)
double f(double x) {
        double r890081 = 1.0;
        double r890082 = x;
        double r890083 = tan(r890082);
        double r890084 = r890083 * r890083;
        double r890085 = r890081 - r890084;
        double r890086 = r890081 + r890084;
        double r890087 = r890085 / r890086;
        return r890087;
}

double f(double x) {
        double r890088 = 1.0;
        double r890089 = sqrt(r890088);
        double r890090 = x;
        double r890091 = tan(r890090);
        double r890092 = r890089 - r890091;
        double r890093 = fma(r890091, r890091, r890088);
        double r890094 = r890092 / r890093;
        double r890095 = r890089 + r890091;
        double r890096 = r890094 * r890095;
        return r890096;
}

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. Final simplification0.4

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

Reproduce

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