Average Error: 0.3 → 0.4
Time: 28.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\frac{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)\right)}{1 - \tan x \cdot \tan x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\frac{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)\right)}{1 - \tan x \cdot \tan x}}
double f(double x) {
        double r2831496 = 1.0;
        double r2831497 = x;
        double r2831498 = tan(r2831497);
        double r2831499 = r2831498 * r2831498;
        double r2831500 = r2831496 - r2831499;
        double r2831501 = r2831496 + r2831499;
        double r2831502 = r2831500 / r2831501;
        return r2831502;
}

double f(double x) {
        double r2831503 = 1.0;
        double r2831504 = r2831503 * r2831503;
        double r2831505 = x;
        double r2831506 = tan(r2831505);
        double r2831507 = r2831506 * r2831506;
        double r2831508 = r2831507 * r2831507;
        double r2831509 = r2831504 - r2831508;
        double r2831510 = r2831503 + r2831507;
        double r2831511 = r2831510 * r2831509;
        double r2831512 = r2831503 - r2831507;
        double r2831513 = r2831511 / r2831512;
        double r2831514 = r2831509 / r2831513;
        return r2831514;
}

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 flip--0.4

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

    \[\leadsto \color{blue}{\frac{1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right)}{\left(1 + \tan x \cdot \tan x\right) \cdot \left(1 + \tan x \cdot \tan x\right)}}\]
  5. Using strategy rm
  6. Applied flip-+0.4

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

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

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

Reproduce

herbie shell --seed 2019173 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))