Average Error: 0.3 → 0.4
Time: 4.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{1 + \tan x \cdot \tan x} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{1 + \tan x \cdot \tan x} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r9438 = 1.0;
        double r9439 = x;
        double r9440 = tan(r9439);
        double r9441 = r9440 * r9440;
        double r9442 = r9438 - r9441;
        double r9443 = r9438 + r9441;
        double r9444 = r9442 / r9443;
        return r9444;
}

double f(double x) {
        double r9445 = 1.0;
        double r9446 = x;
        double r9447 = tan(r9446);
        double r9448 = r9447 * r9447;
        double r9449 = r9445 + r9448;
        double r9450 = r9445 / r9449;
        double r9451 = r9448 / r9449;
        double r9452 = r9450 - r9451;
        return r9452;
}

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

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

    \[\leadsto \frac{1}{1 + \tan x \cdot \tan x} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]

Reproduce

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