Average Error: 0.3 → 0.4
Time: 4.9s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(\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{\left(\sqrt{1} + \tan x\right) \cdot \left(\sqrt{1} - \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r10424 = 1.0;
        double r10425 = x;
        double r10426 = tan(r10425);
        double r10427 = r10426 * r10426;
        double r10428 = r10424 - r10427;
        double r10429 = r10424 + r10427;
        double r10430 = r10428 / r10429;
        return r10430;
}

double f(double x) {
        double r10431 = 1.0;
        double r10432 = sqrt(r10431);
        double r10433 = x;
        double r10434 = tan(r10433);
        double r10435 = r10432 + r10434;
        double r10436 = r10432 - r10434;
        double r10437 = r10435 * r10436;
        double r10438 = r10434 * r10434;
        double r10439 = r10431 + r10438;
        double r10440 = r10437 / r10439;
        return r10440;
}

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

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

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

Reproduce

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