Average Error: 0.3 → 0.4
Time: 52.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)}{1 + \tan x \cdot \tan x}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r2153979 = 1.0;
        double r2153980 = x;
        double r2153981 = tan(r2153980);
        double r2153982 = r2153981 * r2153981;
        double r2153983 = r2153979 - r2153982;
        double r2153984 = r2153979 + r2153982;
        double r2153985 = r2153983 / r2153984;
        return r2153985;
}

double f(double x) {
        double r2153986 = 1.0;
        double r2153987 = x;
        double r2153988 = cos(r2153987);
        double r2153989 = r2153986 / r2153988;
        double r2153990 = sin(r2153987);
        double r2153991 = tan(r2153987);
        double r2153992 = r2153990 * r2153991;
        double r2153993 = r2153989 * r2153992;
        double r2153994 = r2153986 - r2153993;
        double r2153995 = r2153991 * r2153991;
        double r2153996 = r2153986 + r2153995;
        double r2153997 = r2153994 / r2153996;
        return r2153997;
}

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 - \color{blue}{\frac{\sin x}{\cos x}} \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  4. Applied associate-*l/0.4

    \[\leadsto \frac{1 - \color{blue}{\frac{\sin x \cdot \tan x}{\cos x}}}{1 + \tan x \cdot \tan x}\]
  5. Using strategy rm
  6. Applied div-inv0.4

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

    \[\leadsto \frac{1 - \frac{1}{\cos x} \cdot \left(\sin x \cdot \tan x\right)}{1 + \tan x \cdot \tan x}\]

Reproduce

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