Average Error: 29.7 → 0.0
Time: 1.3m
Precision: 64
Internal Precision: 128
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.007927766621862379 \lor \neg \left(x \le 0.007917620489949815\right):\\ \;\;\;\;\log \left(e^{\frac{2}{\sqrt[3]{\left(\left(e^{-2 \cdot x} + 1\right) \cdot \left(e^{-2 \cdot x} + 1\right)\right) \cdot \left(e^{-2 \cdot x} + 1\right)}} - 1}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + {x}^{5} \cdot \frac{2}{15}\right) - {x}^{3} \cdot \frac{1}{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 x < -0.007927766621862379 or 0.007917620489949815 < x

    1. Initial program 0.0

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Initial simplification0.0

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

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

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

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

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

    if -0.007927766621862379 < x < 0.007917620489949815

    1. Initial program 59.1

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Initial simplification59.1

      \[\leadsto \frac{2}{1 + e^{-2 \cdot x}} - 1\]
    3. Taylor expanded around inf 59.1

      \[\leadsto \color{blue}{2 \cdot \frac{1}{e^{-2 \cdot x} + 1} - 1}\]
    4. Simplified59.1

      \[\leadsto \color{blue}{\frac{2}{1 + e^{-2 \cdot x}} - 1}\]
    5. 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. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Runtime

Time bar (total: 1.3m)Debug logProfile

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