Average Error: 0.3 → 0.4
Time: 17.8s
Precision: 64
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\right)\right)\]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - \tan x \cdot \tan x}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\right)\right)
double f(double x) {
        double r272353 = 1.0;
        double r272354 = x;
        double r272355 = tan(r272354);
        double r272356 = r272355 * r272355;
        double r272357 = r272353 - r272356;
        double r272358 = r272353 + r272356;
        double r272359 = r272357 / r272358;
        return r272359;
}

double f(double x) {
        double r272360 = 1.0;
        double r272361 = x;
        double r272362 = tan(r272361);
        double r272363 = r272362 * r272362;
        double r272364 = r272360 - r272363;
        double r272365 = fma(r272362, r272362, r272360);
        double r272366 = r272364 / r272365;
        double r272367 = log1p(r272366);
        double r272368 = expm1(r272367);
        return r272368;
}

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 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 *-un-lft-identity0.4

    \[\leadsto \frac{1}{\frac{1 + \tan x \cdot \tan x}{\color{blue}{1 \cdot \left(1 - \tan x \cdot \tan x\right)}}}\]
  6. Applied *-un-lft-identity0.4

    \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot \left(1 + \tan x \cdot \tan x\right)}}{1 \cdot \left(1 - \tan x \cdot \tan x\right)}}\]
  7. Applied times-frac0.4

    \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}}\]
  8. Applied add-cube-cbrt0.4

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}\]
  9. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}}\]
  10. Simplified0.4

    \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{1 + \tan x \cdot \tan x}{1 - \tan x \cdot \tan x}}\]
  11. Simplified0.3

    \[\leadsto 1 \cdot \color{blue}{\frac{1 \cdot \left(1 - \tan x \cdot \tan x\right)}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}}\]
  12. Using strategy rm
  13. Applied expm1-log1p-u0.4

    \[\leadsto 1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 \cdot \left(1 - \tan x \cdot \tan x\right)}{\mathsf{fma}\left(\tan x, \tan x, 1\right)}\right)\right)}\]
  14. Simplified0.4

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

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

Reproduce

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