Average Error: 29.8 → 0.1
Time: 15.0s
Precision: 64
Internal Precision: 1344
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le -7.201441643009355 \cdot 10^{-05} \lor \neg \left(\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 1.7103594264185684 \cdot 10^{-08}\right):\\ \;\;\;\;\log \left(\sqrt{e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}}\right) + \log \left(\sqrt{e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \end{array}\]

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 (+ 1 (exp (* -2 x)))) 1) < -7.201441643009355e-05 or 1.7103594264185684e-08 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1)

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\log \left(e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}\right)}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.2

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

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

    if -7.201441643009355e-05 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < 1.7103594264185684e-08

    1. Initial program 59.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le -7.201441643009355 \cdot 10^{-05} \lor \neg \left(\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 1.7103594264185684 \cdot 10^{-08}\right):\\ \;\;\;\;\log \left(\sqrt{e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}}\right) + \log \left(\sqrt{e^{\frac{2}{1 + e^{-2 \cdot x}} - 1}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \end{array}\]

Runtime

Time bar (total: 15.0s)Debug logProfile

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