Average Error: 0.3 → 0.4
Time: 16.9s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(\tan x \cdot \tan x + 1\right) - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x + 1\right)}{\left(\tan x \cdot \tan x + 1\right) \cdot \left(\tan x \cdot \tan x + 1\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(\tan x \cdot \tan x + 1\right) - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x + 1\right)}{\left(\tan x \cdot \tan x + 1\right) \cdot \left(\tan x \cdot \tan x + 1\right)}
double f(double x) {
        double r315204 = 1.0;
        double r315205 = x;
        double r315206 = tan(r315205);
        double r315207 = r315206 * r315206;
        double r315208 = r315204 - r315207;
        double r315209 = r315204 + r315207;
        double r315210 = r315208 / r315209;
        return r315210;
}

double f(double x) {
        double r315211 = x;
        double r315212 = tan(r315211);
        double r315213 = r315212 * r315212;
        double r315214 = 1.0;
        double r315215 = r315213 + r315214;
        double r315216 = r315213 * r315215;
        double r315217 = r315215 - r315216;
        double r315218 = r315215 * r315215;
        double r315219 = r315217 / r315218;
        return r315219;
}

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

    \[\leadsto \color{blue}{\frac{1}{1 + \tan x \cdot \tan x} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\]
  4. Using strategy rm
  5. Applied frac-sub0.4

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

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

Reproduce

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