Average Error: 0.3 → 0.4
Time: 22.8s
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 r508612 = 1.0;
        double r508613 = x;
        double r508614 = tan(r508613);
        double r508615 = r508614 * r508614;
        double r508616 = r508612 - r508615;
        double r508617 = r508612 + r508615;
        double r508618 = r508616 / r508617;
        return r508618;
}

double f(double x) {
        double r508619 = 1.0;
        double r508620 = x;
        double r508621 = tan(r508620);
        double r508622 = r508619 + r508621;
        double r508623 = r508619 - r508621;
        double r508624 = r508622 * r508623;
        double r508625 = r508621 * r508621;
        double r508626 = r508619 + r508625;
        double r508627 = r508624 / r508626;
        return r508627;
}

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 2019129 
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))