Average Error: 0.3 → 0.4
Time: 5.2s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\sqrt{1} + \tan x}{\frac{1 + \tan x \cdot \tan x}{\sqrt{1} - \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\sqrt{1} + \tan x}{\frac{1 + \tan x \cdot \tan x}{\sqrt{1} - \tan x}}
double f(double x) {
        double r15114 = 1.0;
        double r15115 = x;
        double r15116 = tan(r15115);
        double r15117 = r15116 * r15116;
        double r15118 = r15114 - r15117;
        double r15119 = r15114 + r15117;
        double r15120 = r15118 / r15119;
        return r15120;
}

double f(double x) {
        double r15121 = 1.0;
        double r15122 = sqrt(r15121);
        double r15123 = x;
        double r15124 = tan(r15123);
        double r15125 = r15122 + r15124;
        double r15126 = r15124 * r15124;
        double r15127 = r15121 + r15126;
        double r15128 = r15122 - r15124;
        double r15129 = r15127 / r15128;
        double r15130 = r15125 / r15129;
        return r15130;
}

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-sqr-sqrt0.3

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied difference-of-squares0.3

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

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

    \[\leadsto \frac{\sqrt{1} + \tan x}{\frac{1 + \tan x \cdot \tan x}{\sqrt{1} - \tan x}}\]

Reproduce

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