Average Error: 0.3 → 0.4
Time: 19.6s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(1 - \tan x \cdot \tan x\right) \cdot \left(1 - \tan x\right)}{\left(1 - \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(1 - \tan x \cdot \tan x\right) \cdot \left(1 - \tan x\right)}{\left(1 - \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}
double f(double x) {
        double r341738 = 1.0;
        double r341739 = x;
        double r341740 = tan(r341739);
        double r341741 = r341740 * r341740;
        double r341742 = r341738 - r341741;
        double r341743 = r341738 + r341741;
        double r341744 = r341742 / r341743;
        return r341744;
}

double f(double x) {
        double r341745 = 1.0;
        double r341746 = x;
        double r341747 = tan(r341746);
        double r341748 = r341747 * r341747;
        double r341749 = r341745 - r341748;
        double r341750 = r341745 - r341747;
        double r341751 = r341749 * r341750;
        double r341752 = r341745 + r341748;
        double r341753 = r341750 * r341752;
        double r341754 = r341751 / r341753;
        return r341754;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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.3

    \[\leadsto \frac{\color{blue}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}{1 + \tan x \cdot \tan x}\]
  5. Using strategy rm
  6. Applied flip-+0.3

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \tan x \cdot \tan x}{1 - \tan x}} \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}\]
  7. Applied associate-*l/0.4

    \[\leadsto \frac{\color{blue}{\frac{\left(1 \cdot 1 - \tan x \cdot \tan x\right) \cdot \left(1 - \tan x\right)}{1 - \tan x}}}{1 + \tan x \cdot \tan x}\]
  8. Applied associate-/l/0.4

    \[\leadsto \color{blue}{\frac{\left(1 \cdot 1 - \tan x \cdot \tan x\right) \cdot \left(1 - \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 - \tan x\right)}}\]
  9. Final simplification0.4

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

Reproduce

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