Average Error: 0.3 → 0.4
Time: 7.3s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\log \left(e^{\sqrt{1} + \tan x}\right) \cdot \left(\sqrt{1} - \tan x\right)}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{\log \left(e^{\sqrt{1} + \tan x}\right) \cdot \left(\sqrt{1} - \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r21350 = 1.0;
        double r21351 = x;
        double r21352 = tan(r21351);
        double r21353 = r21352 * r21352;
        double r21354 = r21350 - r21353;
        double r21355 = r21350 + r21353;
        double r21356 = r21354 / r21355;
        return r21356;
}

double f(double x) {
        double r21357 = 1.0;
        double r21358 = sqrt(r21357);
        double r21359 = x;
        double r21360 = tan(r21359);
        double r21361 = r21358 + r21360;
        double r21362 = exp(r21361);
        double r21363 = log(r21362);
        double r21364 = r21358 - r21360;
        double r21365 = r21363 * r21364;
        double r21366 = r21360 * r21360;
        double r21367 = r21357 + r21366;
        double r21368 = r21365 / r21367;
        return r21368;
}

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. Using strategy rm
  6. Applied add-log-exp0.4

    \[\leadsto \frac{\left(\sqrt{1} + \color{blue}{\log \left(e^{\tan x}\right)}\right) \cdot \left(\sqrt{1} - \tan x\right)}{1 + \tan x \cdot \tan x}\]
  7. Applied add-log-exp0.4

    \[\leadsto \frac{\left(\color{blue}{\log \left(e^{\sqrt{1}}\right)} + \log \left(e^{\tan x}\right)\right) \cdot \left(\sqrt{1} - \tan x\right)}{1 + \tan x \cdot \tan x}\]
  8. Applied sum-log0.4

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

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

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

Reproduce

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