Average Error: 0.3 → 0.4
Time: 18.6s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\tan x \cdot \tan x + 1} \cdot \left(1 - \tan x \cdot \tan x\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\tan x \cdot \tan x + 1} \cdot \left(1 - \tan x \cdot \tan x\right)
double f(double x) {
        double r478877 = 1.0;
        double r478878 = x;
        double r478879 = tan(r478878);
        double r478880 = r478879 * r478879;
        double r478881 = r478877 - r478880;
        double r478882 = r478877 + r478880;
        double r478883 = r478881 / r478882;
        return r478883;
}

double f(double x) {
        double r478884 = 1.0;
        double r478885 = x;
        double r478886 = tan(r478885);
        double r478887 = r478886 * r478886;
        double r478888 = r478887 + r478884;
        double r478889 = r478884 / r478888;
        double r478890 = r478884 - r478887;
        double r478891 = r478889 * r478890;
        return r478891;
}

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

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

    \[\leadsto \frac{1}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}} - \left(\tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}\]
  7. Applied *-un-lft-identity0.4

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

    \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{1}{1 + \tan x \cdot \tan x}} - \left(\tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}\]
  9. Applied distribute-rgt-out--0.4

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

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

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

Reproduce

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