Average Error: 29.0 → 0.3
Time: 23.3s
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 -2.7755575615628914 \cdot 10^{-17}:\\ \;\;\;\;\frac{2}{1 + e^{-2 \cdot x}} - 1\\ \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 8.353037248554074 \cdot 10^{-07}:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{1 + e^{-2 \cdot x}} - 1\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Split input into 2 regimes
  2. if (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < -2.7755575615628914e-17 or 8.353037248554074e-07 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1)

    1. Initial program 0.6

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

    if -2.7755575615628914e-17 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < 8.353037248554074e-07

    1. Initial program 60.2

      \[\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.

Runtime

Time bar (total: 23.3s)Debug logProfile

herbie shell --seed '#(1071852389 864846987 1238109217 3425890003 4124793586 650694553)' 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))