Average Error: 0.3 → 0.4
Time: 44.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(-\left(1 + \tan x\right) \cdot \tan x\right) + \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(-\left(1 + \tan x\right) \cdot \tan x\right) + \left(1 + \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r1907571 = 1.0;
        double r1907572 = x;
        double r1907573 = tan(r1907572);
        double r1907574 = r1907573 * r1907573;
        double r1907575 = r1907571 - r1907574;
        double r1907576 = r1907571 + r1907574;
        double r1907577 = r1907575 / r1907576;
        return r1907577;
}

double f(double x) {
        double r1907578 = 1.0;
        double r1907579 = x;
        double r1907580 = tan(r1907579);
        double r1907581 = r1907578 + r1907580;
        double r1907582 = r1907581 * r1907580;
        double r1907583 = -r1907582;
        double r1907584 = r1907583 + r1907581;
        double r1907585 = r1907580 * r1907580;
        double r1907586 = r1907578 + r1907585;
        double r1907587 = r1907584 / r1907586;
        return r1907587;
}

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. Using strategy rm
  6. Applied sub-neg0.4

    \[\leadsto \frac{\left(1 + \tan x\right) \cdot \color{blue}{\left(1 + \left(-\tan x\right)\right)}}{1 + \tan x \cdot \tan x}\]
  7. Applied distribute-lft-in0.4

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

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

Reproduce

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