Average Error: 0.3 → 0.4
Time: 22.9s
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 r650979 = 1.0;
        double r650980 = x;
        double r650981 = tan(r650980);
        double r650982 = r650981 * r650981;
        double r650983 = r650979 - r650982;
        double r650984 = r650979 + r650982;
        double r650985 = r650983 / r650984;
        return r650985;
}

double f(double x) {
        double r650986 = 1.0;
        double r650987 = x;
        double r650988 = tan(r650987);
        double r650989 = sin(r650987);
        double r650990 = r650988 * r650989;
        double r650991 = cos(r650987);
        double r650992 = r650990 / r650991;
        double r650993 = r650986 - r650992;
        double r650994 = r650988 * r650988;
        double r650995 = r650986 + r650994;
        double r650996 = r650993 / r650995;
        return r650996;
}

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 2019130 
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))