Average Error: 29.6 → 0.2
Time: 26.4s
Precision: 64
Internal Precision: 1408
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;1 + e^{-2 \cdot x} \le 1.99527027072904:\\ \;\;\;\;\frac{\frac{2}{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}}}{\sqrt[3]{1 + e^{-2 \cdot x}}} - 1\\ \mathbf{if}\;1 + e^{-2 \cdot x} \le 2.0000000000929075:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{2}{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}}}{\sqrt[3]{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 (+ 1 (exp (* -2 x))) < 1.99527027072904 or 2.0000000000929075 < (+ 1 (exp (* -2 x)))

    1. Initial program 0.3

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

      \[\leadsto \frac{2}{\color{blue}{\left(\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}\right) \cdot \sqrt[3]{1 + e^{-2 \cdot x}}}} - 1\]
    4. Applied associate-/r*0.3

      \[\leadsto \color{blue}{\frac{\frac{2}{\sqrt[3]{1 + e^{-2 \cdot x}} \cdot \sqrt[3]{1 + e^{-2 \cdot x}}}}{\sqrt[3]{1 + e^{-2 \cdot x}}}} - 1\]

    if 1.99527027072904 < (+ 1 (exp (* -2 x))) < 2.0000000000929075

    1. Initial program 59.5

      \[\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: 26.4s)Debug logProfile

herbie shell --seed '#(1070131407 1246090267 3027482374 2150728003 2026520792 2347815650)' 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))