Average Error: 0.3 → 0.3
Time: 5.7s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r13230 = 1.0;
        double r13231 = x;
        double r13232 = tan(r13231);
        double r13233 = r13232 * r13232;
        double r13234 = r13230 - r13233;
        double r13235 = r13230 + r13233;
        double r13236 = r13234 / r13235;
        return r13236;
}

double f(double x) {
        double r13237 = 1.0;
        double r13238 = x;
        double r13239 = tan(r13238);
        double r13240 = r13239 * r13239;
        double r13241 = r13237 - r13240;
        double r13242 = r13237 + r13240;
        double r13243 = r13241 / r13242;
        return r13243;
}

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{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  4. Applied add-sqr-sqrt0.3

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \tan x \cdot \tan x}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  5. Applied difference-of-squares0.4

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

    \[\leadsto \color{blue}{\frac{\sqrt{1} + \tan x}{1} \cdot \frac{\sqrt{1} - \tan x}{1 + \tan x \cdot \tan x}}\]
  7. Simplified0.4

    \[\leadsto \color{blue}{\left(\sqrt{1} + \tan x\right)} \cdot \frac{\sqrt{1} - \tan x}{1 + \tan x \cdot \tan x}\]
  8. Using strategy rm
  9. Applied associate-*r/0.4

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

    \[\leadsto \frac{\color{blue}{1 - \tan x \cdot \tan x}}{1 + \tan x \cdot \tan x}\]
  11. Final simplification0.3

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

Reproduce

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