Average Error: 0.3 → 0.3
Time: 22.5s
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 r310700 = 1.0;
        double r310701 = x;
        double r310702 = tan(r310701);
        double r310703 = r310702 * r310702;
        double r310704 = r310700 - r310703;
        double r310705 = r310700 + r310703;
        double r310706 = r310704 / r310705;
        return r310706;
}

double f(double x) {
        double r310707 = 1.0;
        double r310708 = x;
        double r310709 = tan(r310708);
        double r310710 = r310709 * r310709;
        double r310711 = r310707 - r310710;
        double r310712 = r310707 - r310709;
        double r310713 = fma(r310709, r310709, r310707);
        double r310714 = r310713 / r310712;
        double r310715 = r310712 * r310714;
        double r310716 = r310711 / r310715;
        return r310716;
}

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