Average Error: 0.3 → 0.4
Time: 19.3s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r315467 = 1.0;
        double r315468 = x;
        double r315469 = tan(r315468);
        double r315470 = r315469 * r315469;
        double r315471 = r315467 - r315470;
        double r315472 = r315467 + r315470;
        double r315473 = r315471 / r315472;
        return r315473;
}

double f(double x) {
        double r315474 = 1.0;
        double r315475 = x;
        double r315476 = tan(r315475);
        double r315477 = r315474 + r315476;
        double r315478 = r315474 - r315476;
        double r315479 = r315477 * r315478;
        double r315480 = r315476 * r315476;
        double r315481 = r315474 + r315480;
        double r315482 = r315479 / r315481;
        return r315482;
}

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

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

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

Reproduce

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