Average Error: 0.3 → 0.4
Time: 45.9s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{fma}\left(-\frac{\sin x}{\cos x}, \tan x, \tan x \cdot \frac{\sin x}{\cos x}\right) + \mathsf{fma}\left(1, 1, \frac{\sin x}{\cos x} \cdot \left(-\tan x\right)\right)}{\tan x \cdot \tan x + 1}\right)\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{fma}\left(-\frac{\sin x}{\cos x}, \tan x, \tan x \cdot \frac{\sin x}{\cos x}\right) + \mathsf{fma}\left(1, 1, \frac{\sin x}{\cos x} \cdot \left(-\tan x\right)\right)}{\tan x \cdot \tan x + 1}\right)\right)
double f(double x) {
        double r492323 = 1.0;
        double r492324 = x;
        double r492325 = tan(r492324);
        double r492326 = r492325 * r492325;
        double r492327 = r492323 - r492326;
        double r492328 = r492323 + r492326;
        double r492329 = r492327 / r492328;
        return r492329;
}

double f(double x) {
        double r492330 = x;
        double r492331 = sin(r492330);
        double r492332 = cos(r492330);
        double r492333 = r492331 / r492332;
        double r492334 = -r492333;
        double r492335 = tan(r492330);
        double r492336 = r492335 * r492333;
        double r492337 = fma(r492334, r492335, r492336);
        double r492338 = 1.0;
        double r492339 = -r492335;
        double r492340 = r492333 * r492339;
        double r492341 = fma(r492338, r492338, r492340);
        double r492342 = r492337 + r492341;
        double r492343 = r492335 * r492335;
        double r492344 = r492343 + r492338;
        double r492345 = r492342 / r492344;
        double r492346 = expm1(r492345);
        double r492347 = log1p(r492346);
        return r492347;
}

Error

Bits error versus x

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 log1p-expm1-u0.4

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\right)\right)}\]
  4. Using strategy rm
  5. Applied tan-quot0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 - \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\right)\right)\]
  6. Applied associate-*r/0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 - \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\right)\right)\]
  7. Using strategy rm
  8. Applied *-un-lft-identity0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 - \frac{\tan x \cdot \sin x}{\color{blue}{1 \cdot \cos x}}}{1 + \tan x \cdot \tan x}\right)\right)\]
  9. Applied times-frac0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 - \color{blue}{\frac{\tan x}{1} \cdot \frac{\sin x}{\cos x}}}{1 + \tan x \cdot \tan x}\right)\right)\]
  10. Applied *-un-lft-identity0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\color{blue}{1 \cdot 1} - \frac{\tan x}{1} \cdot \frac{\sin x}{\cos x}}{1 + \tan x \cdot \tan x}\right)\right)\]
  11. Applied prod-diff0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\color{blue}{\mathsf{fma}\left(1, 1, -\frac{\sin x}{\cos x} \cdot \frac{\tan x}{1}\right) + \mathsf{fma}\left(-\frac{\sin x}{\cos x}, \frac{\tan x}{1}, \frac{\sin x}{\cos x} \cdot \frac{\tan x}{1}\right)}}{1 + \tan x \cdot \tan x}\right)\right)\]
  12. Final simplification0.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{fma}\left(-\frac{\sin x}{\cos x}, \tan x, \tan x \cdot \frac{\sin x}{\cos x}\right) + \mathsf{fma}\left(1, 1, \frac{\sin x}{\cos x} \cdot \left(-\tan x\right)\right)}{\tan x \cdot \tan x + 1}\right)\right)\]

Reproduce

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