Average Error: 0.3 → 0.4
Time: 1.5m
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(1 - \tan x\right) \cdot \left(\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)\right)}{\left(1 - \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\left(1 - \tan x\right) \cdot \left(\left(1 + \tan x\right) \cdot \left(1 - \tan x\right)\right)}{\left(1 - \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}
double f(double x) {
        double r740083 = 1.0;
        double r740084 = x;
        double r740085 = tan(r740084);
        double r740086 = r740085 * r740085;
        double r740087 = r740083 - r740086;
        double r740088 = r740083 + r740086;
        double r740089 = r740087 / r740088;
        return r740089;
}

double f(double x) {
        double r740090 = 1.0;
        double r740091 = x;
        double r740092 = tan(r740091);
        double r740093 = r740090 - r740092;
        double r740094 = r740090 + r740092;
        double r740095 = r740094 * r740093;
        double r740096 = r740093 * r740095;
        double r740097 = r740092 * r740092;
        double r740098 = r740090 + r740097;
        double r740099 = r740093 * r740098;
        double r740100 = r740096 / r740099;
        return r740100;
}

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 flip-+0.3

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \tan x \cdot \tan x}{1 - \tan x}} \cdot \left(1 - \tan x\right)}{1 + \tan x \cdot \tan x}\]
  7. Applied associate-*l/0.4

    \[\leadsto \frac{\color{blue}{\frac{\left(1 \cdot 1 - \tan x \cdot \tan x\right) \cdot \left(1 - \tan x\right)}{1 - \tan x}}}{1 + \tan x \cdot \tan x}\]
  8. Applied associate-/l/0.4

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

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

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

Reproduce

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