Average Error: 0.3 → 0.4
Time: 5.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 r15515 = 1.0;
        double r15516 = x;
        double r15517 = tan(r15516);
        double r15518 = r15517 * r15517;
        double r15519 = r15515 - r15518;
        double r15520 = r15515 + r15518;
        double r15521 = r15519 / r15520;
        return r15521;
}

double f(double x) {
        double r15522 = 1.0;
        double r15523 = sqrt(r15522);
        double r15524 = x;
        double r15525 = tan(r15524);
        double r15526 = r15523 + r15525;
        double r15527 = r15523 - r15525;
        double r15528 = r15526 * r15527;
        double r15529 = r15525 * r15525;
        double r15530 = r15522 + r15529;
        double r15531 = r15528 / r15530;
        return r15531;
}

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 2019352 
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))