Average Error: 0.3 → 0.4
Time: 27.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(1 - \tan x\right) \cdot \left(\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)\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\right) \cdot \left(\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)\right)}{\left(1 - \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}
double f(double x) {
        double r629335 = 1.0;
        double r629336 = x;
        double r629337 = tan(r629336);
        double r629338 = r629337 * r629337;
        double r629339 = r629335 - r629338;
        double r629340 = r629335 + r629338;
        double r629341 = r629339 / r629340;
        return r629341;
}

double f(double x) {
        double r629342 = 1.0;
        double r629343 = x;
        double r629344 = tan(r629343);
        double r629345 = r629342 - r629344;
        double r629346 = r629342 + r629344;
        double r629347 = r629346 * r629345;
        double r629348 = r629345 * r629347;
        double r629349 = r629344 * r629344;
        double r629350 = r629342 + r629349;
        double r629351 = r629345 * r629350;
        double r629352 = r629348 / r629351;
        return r629352;
}

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. Using strategy rm
  10. Applied difference-of-squares0.4

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

    \[\leadsto \frac{\left(1 - \tan x\right) \cdot \left(\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)\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)))))