Average Error: 0.3 → 0.4
Time: 44.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\left(1 + \tan x\right) \cdot \frac{1 - \tan x}{\tan x \cdot \tan x + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\left(1 + \tan x\right) \cdot \frac{1 - \tan x}{\tan x \cdot \tan x + 1}
double f(double x) {
        double r1685024 = 1.0;
        double r1685025 = x;
        double r1685026 = tan(r1685025);
        double r1685027 = r1685026 * r1685026;
        double r1685028 = r1685024 - r1685027;
        double r1685029 = r1685024 + r1685027;
        double r1685030 = r1685028 / r1685029;
        return r1685030;
}

double f(double x) {
        double r1685031 = 1.0;
        double r1685032 = x;
        double r1685033 = tan(r1685032);
        double r1685034 = r1685031 + r1685033;
        double r1685035 = r1685031 - r1685033;
        double r1685036 = r1685033 * r1685033;
        double r1685037 = r1685036 + r1685031;
        double r1685038 = r1685035 / r1685037;
        double r1685039 = r1685034 * r1685038;
        return r1685039;
}

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{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  4. Applied *-un-lft-identity0.3

    \[\leadsto \frac{\color{blue}{1 \cdot 1} - \tan x \cdot \tan x}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  5. Applied difference-of-squares0.4

    \[\leadsto \frac{\color{blue}{\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)}}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  6. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{1 + \tan x}{1} \cdot \frac{1 - \tan x}{1 + \tan x \cdot \tan x}}\]
  7. Simplified0.4

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

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

Reproduce

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