Average Error: 0.3 → 0.4
Time: 14.0s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{{\left(\sin x\right)}^{2}}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\cos x\right)}^{2}\right)\right)}}{\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}}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\cos x\right)}^{2}\right)\right)}}{\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}} + 1}
double f(double x) {
        double r21534 = 1.0;
        double r21535 = x;
        double r21536 = tan(r21535);
        double r21537 = r21536 * r21536;
        double r21538 = r21534 - r21537;
        double r21539 = r21534 + r21537;
        double r21540 = r21538 / r21539;
        return r21540;
}

double f(double x) {
        double r21541 = 1.0;
        double r21542 = x;
        double r21543 = sin(r21542);
        double r21544 = 2.0;
        double r21545 = pow(r21543, r21544);
        double r21546 = cos(r21542);
        double r21547 = pow(r21546, r21544);
        double r21548 = log1p(r21547);
        double r21549 = expm1(r21548);
        double r21550 = r21545 / r21549;
        double r21551 = r21541 - r21550;
        double r21552 = r21545 / r21547;
        double r21553 = r21552 + r21541;
        double r21554 = r21551 / r21553;
        return r21554;
}

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. 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}}\]
  4. Using strategy rm
  5. Applied expm1-log1p-u0.4

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

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

Reproduce

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