Average Error: 28.4 → 0.3
Time: 7.4s
Precision: 64
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;-2 \cdot x \le -14131.766076203403 \lor \neg \left(-2 \cdot x \le 2.49198511218982953 \cdot 10^{-4}\right):\\ \;\;\;\;\log \left(e^{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}} - 1}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x - \left(5.55112 \cdot 10^{-17} \cdot {x}^{4} + 0.33333333333333337 \cdot {x}^{3}\right)\\ \end{array}\]
\frac{2}{1 + e^{-2 \cdot x}} - 1
\begin{array}{l}
\mathbf{if}\;-2 \cdot x \le -14131.766076203403 \lor \neg \left(-2 \cdot x \le 2.49198511218982953 \cdot 10^{-4}\right):\\
\;\;\;\;\log \left(e^{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}} - 1}\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot x - \left(5.55112 \cdot 10^{-17} \cdot {x}^{4} + 0.33333333333333337 \cdot {x}^{3}\right)\\

\end{array}
double f(double x, double __attribute__((unused)) y) {
        double r63299 = 2.0;
        double r63300 = 1.0;
        double r63301 = -2.0;
        double r63302 = x;
        double r63303 = r63301 * r63302;
        double r63304 = exp(r63303);
        double r63305 = r63300 + r63304;
        double r63306 = r63299 / r63305;
        double r63307 = r63306 - r63300;
        return r63307;
}

double f(double x, double __attribute__((unused)) y) {
        double r63308 = -2.0;
        double r63309 = x;
        double r63310 = r63308 * r63309;
        double r63311 = -14131.766076203403;
        bool r63312 = r63310 <= r63311;
        double r63313 = 0.00024919851121898295;
        bool r63314 = r63310 <= r63313;
        double r63315 = !r63314;
        bool r63316 = r63312 || r63315;
        double r63317 = 1.0;
        double r63318 = 1.0;
        double r63319 = exp(r63310);
        double r63320 = r63318 + r63319;
        double r63321 = cbrt(r63320);
        double r63322 = fabs(r63321);
        double r63323 = sqrt(r63320);
        double r63324 = cbrt(r63323);
        double r63325 = r63324 * r63324;
        double r63326 = r63322 * r63325;
        double r63327 = r63317 / r63326;
        double r63328 = 2.0;
        double r63329 = sqrt(r63321);
        double r63330 = r63328 / r63329;
        double r63331 = r63330 / r63324;
        double r63332 = r63327 * r63331;
        double r63333 = r63332 - r63318;
        double r63334 = exp(r63333);
        double r63335 = log(r63334);
        double r63336 = r63318 * r63309;
        double r63337 = 5.551115123125783e-17;
        double r63338 = 4.0;
        double r63339 = pow(r63309, r63338);
        double r63340 = r63337 * r63339;
        double r63341 = 0.33333333333333337;
        double r63342 = 3.0;
        double r63343 = pow(r63309, r63342);
        double r63344 = r63341 * r63343;
        double r63345 = r63340 + r63344;
        double r63346 = r63336 - r63345;
        double r63347 = r63316 ? r63335 : r63346;
        return r63347;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (* -2.0 x) < -14131.766076203403 or 0.00024919851121898295 < (* -2.0 x)

    1. Initial program 0.0

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.0

      \[\leadsto \frac{2}{\color{blue}{\sqrt{1 + e^{-2 \cdot x}} \cdot \sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    4. Applied associate-/r*0.0

      \[\leadsto \color{blue}{\frac{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}{\sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    5. Using strategy rm
    6. Applied add-cube-cbrt0.0

      \[\leadsto \frac{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}{\sqrt{\color{blue}{\left(\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}\right) \cdot \sqrt[3]{1 + e^{-2 \cdot x}}}}} - 1\]
    7. Applied sqrt-prod0.0

      \[\leadsto \frac{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}{\color{blue}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}} \cdot \sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}} - 1\]
    8. Applied add-cube-cbrt0.0

      \[\leadsto \frac{\frac{2}{\color{blue}{\left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right) \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}} \cdot \sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}} - 1\]
    9. Applied *-un-lft-identity0.0

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot 2}}{\left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right) \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}} \cdot \sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}} - 1\]
    10. Applied times-frac0.0

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}} \cdot \frac{2}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}} \cdot \sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}} - 1\]
    11. Applied times-frac0.0

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}}} \cdot \frac{\frac{2}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}} - 1\]
    12. Simplified0.0

      \[\leadsto \color{blue}{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)}} \cdot \frac{\frac{2}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}} - 1\]
    13. Simplified0.0

      \[\leadsto \frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \color{blue}{\frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}} - 1\]
    14. Using strategy rm
    15. Applied add-log-exp0.0

      \[\leadsto \frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}} - \color{blue}{\log \left(e^{1}\right)}\]
    16. Applied add-log-exp0.0

      \[\leadsto \color{blue}{\log \left(e^{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}\right)} - \log \left(e^{1}\right)\]
    17. Applied diff-log0.0

      \[\leadsto \color{blue}{\log \left(\frac{e^{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}}}}{e^{1}}\right)}\]
    18. Simplified0.0

      \[\leadsto \log \color{blue}{\left(e^{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}} - 1}\right)}\]

    if -14131.766076203403 < (* -2.0 x) < 0.00024919851121898295

    1. Initial program 58.6

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Taylor expanded around 0 0.5

      \[\leadsto \color{blue}{1 \cdot x - \left(5.55112 \cdot 10^{-17} \cdot {x}^{4} + 0.33333333333333337 \cdot {x}^{3}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;-2 \cdot x \le -14131.766076203403 \lor \neg \left(-2 \cdot x \le 2.49198511218982953 \cdot 10^{-4}\right):\\ \;\;\;\;\log \left(e^{\frac{1}{\left|\sqrt[3]{1 + e^{-2 \cdot x}}\right| \cdot \left(\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}} \cdot \sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}\right)} \cdot \frac{\frac{2}{\sqrt{\sqrt[3]{1 + e^{-2 \cdot x}}}}}{\sqrt[3]{\sqrt{1 + e^{-2 \cdot x}}}} - 1}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x - \left(5.55112 \cdot 10^{-17} \cdot {x}^{4} + 0.33333333333333337 \cdot {x}^{3}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020025 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  :precision binary64
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))