Average Error: 29.4 → 0.0
Time: 41.7s
Precision: 64
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.00728224630144218:\\ \;\;\;\;\left(\sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)} \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\right) \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\\ \mathbf{elif}\;x \le 0.007640382299006293:\\ \;\;\;\;\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{3}\right)\right) + {x}^{5} \cdot \frac{2}{15}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)} \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\right) \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\\ \end{array}\]
\frac{2}{1 + e^{-2 \cdot x}} - 1
\begin{array}{l}
\mathbf{if}\;x \le -0.00728224630144218:\\
\;\;\;\;\left(\sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)} \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\right) \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\\

\mathbf{elif}\;x \le 0.007640382299006293:\\
\;\;\;\;\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{3}\right)\right) + {x}^{5} \cdot \frac{2}{15}\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)} \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\right) \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\\

\end{array}
double f(double x, double __attribute__((unused)) y) {
        double r7312998 = 2.0;
        double r7312999 = 1.0;
        double r7313000 = -2.0;
        double r7313001 = x;
        double r7313002 = r7313000 * r7313001;
        double r7313003 = exp(r7313002);
        double r7313004 = r7312999 + r7313003;
        double r7313005 = r7312998 / r7313004;
        double r7313006 = r7313005 - r7312999;
        return r7313006;
}

double f(double x, double __attribute__((unused)) y) {
        double r7313007 = x;
        double r7313008 = -0.00728224630144218;
        bool r7313009 = r7313007 <= r7313008;
        double r7313010 = 2.0;
        double r7313011 = -2.0;
        double r7313012 = r7313011 * r7313007;
        double r7313013 = exp(r7313012);
        double r7313014 = 1.0;
        double r7313015 = r7313013 + r7313014;
        double r7313016 = r7313010 / r7313015;
        double r7313017 = r7313016 - r7313014;
        double r7313018 = exp(r7313017);
        double r7313019 = log(r7313018);
        double r7313020 = cbrt(r7313019);
        double r7313021 = r7313020 * r7313020;
        double r7313022 = r7313021 * r7313020;
        double r7313023 = 0.007640382299006293;
        bool r7313024 = r7313007 <= r7313023;
        double r7313025 = r7313007 * r7313007;
        double r7313026 = -0.3333333333333333;
        double r7313027 = r7313025 * r7313026;
        double r7313028 = r7313007 * r7313027;
        double r7313029 = r7313007 + r7313028;
        double r7313030 = 5.0;
        double r7313031 = pow(r7313007, r7313030);
        double r7313032 = 0.13333333333333333;
        double r7313033 = r7313031 * r7313032;
        double r7313034 = r7313029 + r7313033;
        double r7313035 = r7313024 ? r7313034 : r7313022;
        double r7313036 = r7313009 ? r7313022 : r7313035;
        return r7313036;
}

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 x < -0.00728224630144218 or 0.007640382299006293 < x

    1. Initial program 0.0

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

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

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

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

      \[\leadsto \log \color{blue}{\left(e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}\right)}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt0.0

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

    if -0.00728224630144218 < x < 0.007640382299006293

    1. Initial program 59.0

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

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

      \[\leadsto \color{blue}{\left(\left(\left(x \cdot x\right) \cdot \frac{-1}{3}\right) \cdot x + x\right) + {x}^{5} \cdot \frac{2}{15}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.00728224630144218:\\ \;\;\;\;\left(\sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)} \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\right) \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\\ \mathbf{elif}\;x \le 0.007640382299006293:\\ \;\;\;\;\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{3}\right)\right) + {x}^{5} \cdot \frac{2}{15}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)} \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\right) \cdot \sqrt[3]{\log \left(e^{\frac{2}{e^{-2 \cdot x} + 1} - 1}\right)}\\ \end{array}\]

Reproduce

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