Average Error: 28.8 → 0.0
Time: 1.2m
Precision: 64
Internal Precision: 1344
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;e^{x \cdot -2} + 1 \le 1.9332077667223637 \lor \neg \left(e^{x \cdot -2} + 1 \le 2.0000647776950835\right):\\ \;\;\;\;e^{\log 2 - \log_* (1 + e^{x \cdot -2})} - 1\\ \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 3 regimes
  2. if (+ 1 (exp (* -2 x))) < 1.9332077667223637

    1. Initial program 0.0

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

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

      \[\leadsto e^{\color{blue}{\log 2 - \log_* (1 + e^{-2 \cdot x})}} - 1\]

    if 1.9332077667223637 < (+ 1 (exp (* -2 x))) < 2.0000647776950835

    1. Initial program 59.0

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

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

    if 2.0000647776950835 < (+ 1 (exp (* -2 x)))

    1. Initial program 0.1

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

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

      \[\leadsto e^{\color{blue}{\log 2 - \log_* (1 + e^{-2 \cdot x})}} - 1\]
  3. Recombined 3 regimes into one program.
  4. Applied simplify0.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;e^{x \cdot -2} + 1 \le 1.9332077667223637 \lor \neg \left(e^{x \cdot -2} + 1 \le 2.0000647776950835\right):\\ \;\;\;\;e^{\log 2 - \log_* (1 + e^{x \cdot -2})} - 1\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \end{array}}\]

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1072936661 1621281212 3440817831 3219514234 460296804 1258167384)' +o rules:numerics
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))