Average Error: 0.3 → 0.3
Time: 17.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \tan x \cdot \tan x}{\left(1 - \tan x\right) \cdot \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 \cdot \tan x}{\left(1 - \tan x\right) \cdot \frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x}}
double f(double x) {
        double r296798 = 1.0;
        double r296799 = x;
        double r296800 = tan(r296799);
        double r296801 = r296800 * r296800;
        double r296802 = r296798 - r296801;
        double r296803 = r296798 + r296801;
        double r296804 = r296802 / r296803;
        return r296804;
}

double f(double x) {
        double r296805 = 1.0;
        double r296806 = x;
        double r296807 = tan(r296806);
        double r296808 = r296807 * r296807;
        double r296809 = r296805 - r296808;
        double r296810 = r296805 - r296807;
        double r296811 = fma(r296807, r296807, r296805);
        double r296812 = r296811 / r296810;
        double r296813 = r296810 * r296812;
        double r296814 = r296809 / r296813;
        return r296814;
}

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. Using strategy rm
  8. Applied flip-+0.4

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \tan x \cdot \tan x}{1 - \tan x}}}{\frac{\mathsf{fma}\left(\tan x, \tan x, 1\right)}{1 - \tan x}}\]
  9. Applied associate-/l/0.3

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

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

Reproduce

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