Average Error: 0.3 → 0.3
Time: 19.4s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{\tan x \cdot \sin x}{\cos x}}{1 + \frac{\tan x \cdot \sin x}{\cos x}}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{\tan x \cdot \sin x}{\cos x}}{1 + \frac{\tan x \cdot \sin x}{\cos x}}
double f(double x) {
        double r19873 = 1.0;
        double r19874 = x;
        double r19875 = tan(r19874);
        double r19876 = r19875 * r19875;
        double r19877 = r19873 - r19876;
        double r19878 = r19873 + r19876;
        double r19879 = r19877 / r19878;
        return r19879;
}

double f(double x) {
        double r19880 = 1.0;
        double r19881 = x;
        double r19882 = tan(r19881);
        double r19883 = sin(r19881);
        double r19884 = r19882 * r19883;
        double r19885 = cos(r19881);
        double r19886 = r19884 / r19885;
        double r19887 = r19880 - r19886;
        double r19888 = r19880 + r19886;
        double r19889 = r19887 / r19888;
        return r19889;
}

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

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

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

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

Reproduce

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