Average Error: 0.3 → 0.4
Time: 23.6s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}
double f(double x) {
        double r916211 = 1.0;
        double r916212 = x;
        double r916213 = tan(r916212);
        double r916214 = r916213 * r916213;
        double r916215 = r916211 - r916214;
        double r916216 = r916211 + r916214;
        double r916217 = r916215 / r916216;
        return r916217;
}

double f(double x) {
        double r916218 = 1.0;
        double r916219 = x;
        double r916220 = tan(r916219);
        double r916221 = r916220 * r916220;
        double r916222 = r916221 + r916218;
        double r916223 = r916218 / r916222;
        double r916224 = r916221 / r916222;
        double r916225 = r916223 - r916224;
        return r916225;
}

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}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]

Reproduce

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