Average Error: 0.3 → 0.4
Time: 26.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(1 - \frac{\sin x \cdot \tan x}{\cos x}\right) \cdot \left(1 + \tan x \cdot \tan x\right)}{1 \cdot \left(1 + \tan x \cdot \tan x\right) + \left(\tan x \cdot \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 - \frac{\sin x \cdot \tan x}{\cos x}\right) \cdot \left(1 + \tan x \cdot \tan x\right)}{1 \cdot \left(1 + \tan x \cdot \tan x\right) + \left(\tan x \cdot \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}
double f(double x) {
        double r1042825 = 1.0;
        double r1042826 = x;
        double r1042827 = tan(r1042826);
        double r1042828 = r1042827 * r1042827;
        double r1042829 = r1042825 - r1042828;
        double r1042830 = r1042825 + r1042828;
        double r1042831 = r1042829 / r1042830;
        return r1042831;
}

double f(double x) {
        double r1042832 = 1.0;
        double r1042833 = x;
        double r1042834 = sin(r1042833);
        double r1042835 = tan(r1042833);
        double r1042836 = r1042834 * r1042835;
        double r1042837 = cos(r1042833);
        double r1042838 = r1042836 / r1042837;
        double r1042839 = r1042832 - r1042838;
        double r1042840 = r1042835 * r1042835;
        double r1042841 = r1042832 + r1042840;
        double r1042842 = r1042839 * r1042841;
        double r1042843 = r1042832 * r1042841;
        double r1042844 = r1042840 * r1042841;
        double r1042845 = r1042843 + r1042844;
        double r1042846 = r1042842 / r1042845;
        return r1042846;
}

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-inv0.4

    \[\leadsto \color{blue}{\left(1 - \tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}}\]
  4. Using strategy rm
  5. Applied flip--0.4

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

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

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

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

    \[\leadsto \frac{\left(1 - \color{blue}{\frac{\sin x \cdot \tan x}{\cos x}}\right) \cdot \left(1 + \tan x \cdot \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  11. Using strategy rm
  12. Applied distribute-rgt-in0.4

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

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

Reproduce

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