Average Error: 0.3 → 0.4
Time: 10.4s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \sqrt{\frac{\tan x \cdot \sin x}{\cos x}} \cdot \sqrt{\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 - \sqrt{\frac{\tan x \cdot \sin x}{\cos x}} \cdot \sqrt{\frac{\tan x \cdot \sin x}{\cos x}}}{1 + \tan x \cdot \tan x}
double f(double x) {
        double r11298 = 1.0;
        double r11299 = x;
        double r11300 = tan(r11299);
        double r11301 = r11300 * r11300;
        double r11302 = r11298 - r11301;
        double r11303 = r11298 + r11301;
        double r11304 = r11302 / r11303;
        return r11304;
}

double f(double x) {
        double r11305 = 1.0;
        double r11306 = x;
        double r11307 = tan(r11306);
        double r11308 = sin(r11306);
        double r11309 = r11307 * r11308;
        double r11310 = cos(r11306);
        double r11311 = r11309 / r11310;
        double r11312 = sqrt(r11311);
        double r11313 = r11312 * r11312;
        double r11314 = r11305 - r11313;
        double r11315 = r11307 * r11307;
        double r11316 = r11305 + r11315;
        double r11317 = r11314 / r11316;
        return r11317;
}

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 add-sqr-sqrt0.4

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

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

Reproduce

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