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{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 r10100 = 1.0;
        double r10101 = x;
        double r10102 = tan(r10101);
        double r10103 = r10102 * r10102;
        double r10104 = r10100 - r10103;
        double r10105 = r10100 + r10103;
        double r10106 = r10104 / r10105;
        return r10106;
}

double f(double x) {
        double r10107 = 1.0;
        double r10108 = x;
        double r10109 = tan(r10108);
        double r10110 = r10109 * r10109;
        double r10111 = r10107 + r10110;
        double r10112 = r10107 / r10111;
        double r10113 = r10110 / r10111;
        double r10114 = r10112 - r10113;
        return r10114;
}

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