Average Error: 0.3 → 0.4
Time: 21.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\frac{\tan x \cdot \tan x + 1}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\frac{\tan x \cdot \tan x + 1}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}
double f(double x) {
        double r354604 = 1.0;
        double r354605 = x;
        double r354606 = tan(r354605);
        double r354607 = r354606 * r354606;
        double r354608 = r354604 - r354607;
        double r354609 = r354604 + r354607;
        double r354610 = r354608 / r354609;
        return r354610;
}

double f(double x) {
        double r354611 = 1.0;
        double r354612 = x;
        double r354613 = tan(r354612);
        double r354614 = r354613 * r354613;
        double r354615 = r354614 + r354611;
        double r354616 = r354611 + r354613;
        double r354617 = r354611 - r354613;
        double r354618 = r354616 * r354617;
        double r354619 = r354615 / r354618;
        double r354620 = r354611 / r354619;
        return r354620;
}

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

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

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

Reproduce

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