Average Error: 0.3 → 0.4
Time: 5.2s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\frac{1 + \tan x \cdot \tan 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{1 + \tan x \cdot \tan x}{1 - \frac{\tan x \cdot \sin x}{\cos x}}}
double f(double x) {
        double r11081 = 1.0;
        double r11082 = x;
        double r11083 = tan(r11082);
        double r11084 = r11083 * r11083;
        double r11085 = r11081 - r11084;
        double r11086 = r11081 + r11084;
        double r11087 = r11085 / r11086;
        return r11087;
}

double f(double x) {
        double r11088 = 1.0;
        double r11089 = 1.0;
        double r11090 = x;
        double r11091 = tan(r11090);
        double r11092 = r11091 * r11091;
        double r11093 = r11089 + r11092;
        double r11094 = sin(r11090);
        double r11095 = r11091 * r11094;
        double r11096 = cos(r11090);
        double r11097 = r11095 / r11096;
        double r11098 = r11089 - r11097;
        double r11099 = r11093 / r11098;
        double r11100 = r11088 / r11099;
        return r11100;
}

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 clear-num0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}}\]
  4. Using strategy rm
  5. Applied tan-quot0.4

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

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

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

Reproduce

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