Average Error: 0.3 → 0.4
Time: 20.6s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\left(1 - \tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\left(1 - \tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r18768 = 1.0;
        double r18769 = x;
        double r18770 = tan(r18769);
        double r18771 = r18770 * r18770;
        double r18772 = r18768 - r18771;
        double r18773 = r18768 + r18771;
        double r18774 = r18772 / r18773;
        return r18774;
}

double f(double x) {
        double r18775 = 1.0;
        double r18776 = x;
        double r18777 = tan(r18776);
        double r18778 = r18777 * r18777;
        double r18779 = r18775 - r18778;
        double r18780 = 1.0;
        double r18781 = r18775 + r18778;
        double r18782 = r18780 / r18781;
        double r18783 = r18779 * r18782;
        return r18783;
}

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 add-log-exp0.4

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

    \[\leadsto \log \left(e^{\frac{1 - \tan x \cdot \tan x}{\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}}}}\right)\]
  6. Applied associate-/r/0.5

    \[\leadsto \log \left(e^{\color{blue}{\frac{1 - \tan x \cdot \tan x}{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)} \cdot \left(1 - \tan x \cdot \tan x\right)}}\right)\]
  7. Applied exp-prod0.9

    \[\leadsto \log \color{blue}{\left({\left(e^{\frac{1 - \tan x \cdot \tan x}{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}}\right)}^{\left(1 - \tan x \cdot \tan x\right)}\right)}\]
  8. Applied log-pow0.9

    \[\leadsto \color{blue}{\left(1 - \tan x \cdot \tan x\right) \cdot \log \left(e^{\frac{1 - \tan x \cdot \tan x}{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}}\right)}\]
  9. Simplified0.4

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

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

Reproduce

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