Average Error: 0.3 → 0.4
Time: 5.0s
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 + \tan x \cdot \tan 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 + \tan x \cdot \tan x}
double f(double x) {
        double r12918 = 1.0;
        double r12919 = x;
        double r12920 = tan(r12919);
        double r12921 = r12920 * r12920;
        double r12922 = r12918 - r12921;
        double r12923 = r12918 + r12921;
        double r12924 = r12922 / r12923;
        return r12924;
}

double f(double x) {
        double r12925 = 1.0;
        double r12926 = x;
        double r12927 = tan(r12926);
        double r12928 = sin(r12926);
        double r12929 = r12927 * r12928;
        double r12930 = cos(r12926);
        double r12931 = r12929 / r12930;
        double r12932 = r12925 - r12931;
        double r12933 = r12927 * r12927;
        double r12934 = r12925 + r12933;
        double r12935 = r12932 / r12934;
        return r12935;
}

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. Final simplification0.4

    \[\leadsto \frac{1 - \frac{\tan x \cdot \sin 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)))))