Average Error: 0.3 → 0.3
Time: 1.0m
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]
double f(double x) {
        double r2476877 = 1.0;
        double r2476878 = x;
        double r2476879 = tan(r2476878);
        double r2476880 = r2476879 * r2476879;
        double r2476881 = r2476877 - r2476880;
        double r2476882 = r2476877 + r2476880;
        double r2476883 = r2476881 / r2476882;
        return r2476883;
}

double f(double x) {
        double r2476884 = 1.0;
        double r2476885 = x;
        double r2476886 = tan(r2476885);
        double r2476887 = r2476886 * r2476886;
        double r2476888 = r2476884 - r2476887;
        double r2476889 = r2476887 + r2476884;
        double r2476890 = r2476888 / r2476889;
        return r2476890;
}

\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \tan x \cdot \tan x}{\tan x \cdot \tan x + 1}

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 add-log-exp0.4

    \[\leadsto \color{blue}{\log \left(e^{\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\right)}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity0.4

    \[\leadsto \log \left(e^{\frac{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}}\right)\]
  6. Applied *-un-lft-identity0.4

    \[\leadsto \log \left(e^{\frac{\color{blue}{1 \cdot 1} - \tan x \cdot \tan x}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\right)\]
  7. Applied difference-of-squares0.4

    \[\leadsto \log \left(e^{\frac{\color{blue}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\right)\]
  8. Applied times-frac0.5

    \[\leadsto \log \left(e^{\color{blue}{\frac{1 + \tan x}{1} \cdot \frac{1 - \tan x}{1 + \tan x \cdot \tan x}}}\right)\]
  9. Applied exp-prod0.5

    \[\leadsto \log \color{blue}{\left({\left(e^{\frac{1 + \tan x}{1}}\right)}^{\left(\frac{1 - \tan x}{1 + \tan x \cdot \tan x}\right)}\right)}\]
  10. Applied log-pow0.5

    \[\leadsto \color{blue}{\frac{1 - \tan x}{1 + \tan x \cdot \tan x} \cdot \log \left(e^{\frac{1 + \tan x}{1}}\right)}\]
  11. Using strategy rm
  12. Applied associate-*l/0.4

    \[\leadsto \color{blue}{\frac{\left(1 - \tan x\right) \cdot \log \left(e^{\frac{1 + \tan x}{1}}\right)}{1 + \tan x \cdot \tan x}}\]
  13. Simplified0.3

    \[\leadsto \frac{\color{blue}{1 - \tan x \cdot \tan x}}{1 + \tan x \cdot \tan x}\]
  14. Final simplification0.3

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]

Reproduce

herbie shell --seed 2019102 
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))