Average Error: 0.3 → 0.4
Time: 4.5s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{1 + \frac{\tan x \cdot \sin x}{\cos 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 + \frac{\tan x \cdot \sin x}{\cos x}} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r9190 = 1.0;
        double r9191 = x;
        double r9192 = tan(r9191);
        double r9193 = r9192 * r9192;
        double r9194 = r9190 - r9193;
        double r9195 = r9190 + r9193;
        double r9196 = r9194 / r9195;
        return r9196;
}

double f(double x) {
        double r9197 = 1.0;
        double r9198 = x;
        double r9199 = tan(r9198);
        double r9200 = sin(r9198);
        double r9201 = r9199 * r9200;
        double r9202 = cos(r9198);
        double r9203 = r9201 / r9202;
        double r9204 = r9197 + r9203;
        double r9205 = r9197 / r9204;
        double r9206 = r9199 * r9199;
        double r9207 = r9197 + r9206;
        double r9208 = r9206 / r9207;
        double r9209 = r9205 - r9208;
        return r9209;
}

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. Using strategy rm
  5. Applied tan-quot0.4

    \[\leadsto \frac{1}{1 + \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  6. Applied associate-*r/0.4

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

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

Reproduce

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