Average Error: 0.3 → 0.4
Time: 9.3s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{\sin x \cdot \tan x}{\cos x}}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{\sin x \cdot \tan x}{\cos x}}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r12007 = 1.0;
        double r12008 = x;
        double r12009 = tan(r12008);
        double r12010 = r12009 * r12009;
        double r12011 = r12007 - r12010;
        double r12012 = r12007 + r12010;
        double r12013 = r12011 / r12012;
        return r12013;
}

double f(double x) {
        double r12014 = 1.0;
        double r12015 = x;
        double r12016 = sin(r12015);
        double r12017 = tan(r12015);
        double r12018 = r12016 * r12017;
        double r12019 = cos(r12015);
        double r12020 = r12018 / r12019;
        double r12021 = r12014 - r12020;
        double r12022 = r12017 * r12017;
        double r12023 = r12014 + r12022;
        double r12024 = r12021 / r12023;
        return r12024;
}

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 tan-quot0.4

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

    \[\leadsto \frac{1 - \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  5. Simplified0.4

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

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

Reproduce

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