Average Error: 0.3 → 0.4
Time: 19.2s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}
double f(double x) {
        double r18378 = 1.0;
        double r18379 = x;
        double r18380 = tan(r18379);
        double r18381 = r18380 * r18380;
        double r18382 = r18378 - r18381;
        double r18383 = r18378 + r18381;
        double r18384 = r18382 / r18383;
        return r18384;
}

double f(double x) {
        double r18385 = 1.0;
        double r18386 = x;
        double r18387 = sin(r18386);
        double r18388 = 2.0;
        double r18389 = pow(r18387, r18388);
        double r18390 = cos(r18386);
        double r18391 = pow(r18390, r18388);
        double r18392 = r18389 / r18391;
        double r18393 = r18385 - r18392;
        double r18394 = r18392 + r18385;
        double r18395 = r18393 / r18394;
        return r18395;
}

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. Simplified0.3

    \[\leadsto \color{blue}{\frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.3

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\color{blue}{1 \cdot \mathsf{fma}\left(\tan x, \tan x, 1\right)}}\]
  5. Applied associate-/r*0.3

    \[\leadsto \color{blue}{\frac{\frac{1 - \tan x \cdot \tan x}{1}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}}\]
  6. Simplified0.3

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-\tan x, \tan x, 1\right)}}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\]
  7. Taylor expanded around inf 0.4

    \[\leadsto \color{blue}{\frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}}\]
  8. Final simplification0.4

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

Reproduce

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