Average Error: 0.3 → 0.4
Time: 5.6s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\left(1 - \tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\left(1 - \tan x \cdot \tan x\right) \cdot \frac{1}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r12398 = 1.0;
        double r12399 = x;
        double r12400 = tan(r12399);
        double r12401 = r12400 * r12400;
        double r12402 = r12398 - r12401;
        double r12403 = r12398 + r12401;
        double r12404 = r12402 / r12403;
        return r12404;
}

double f(double x) {
        double r12405 = 1.0;
        double r12406 = x;
        double r12407 = tan(r12406);
        double r12408 = r12407 * r12407;
        double r12409 = r12405 - r12408;
        double r12410 = 1.0;
        double r12411 = r12405 + r12408;
        double r12412 = r12410 / r12411;
        double r12413 = r12409 * r12412;
        return r12413;
}

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

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

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

Reproduce

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