Average Error: 29.5 → 0.0
Time: 34.6s
Precision: 64
Internal Precision: 1408
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.006624720756341694:\\ \;\;\;\;\frac{2}{1 + e^{-2 \cdot x}} - 1\\ \mathbf{if}\;x \le 0.007170758193253034:\\ \;\;\;\;\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 x < -0.006624720756341694 or 0.007170758193253034 < x

    1. Initial program 0.0

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

    if -0.006624720756341694 < x < 0.007170758193253034

    1. Initial program 58.9

      \[\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}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 34.6s)Debug log

herbie shell --seed '#(3839645869 2681072915 4128260615 1960373807 1759250524 63511647)' 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))