Average Error: 28.7 → 0.3
Time: 35.7s
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 -7.418111132777761 \cdot 10^{-143}:\\ \;\;\;\;(\left(\frac{\sqrt{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{1}}\right) \cdot \left(\frac{\sqrt{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{1 + e^{-2 \cdot x}}}\right) + \left(-1\right))_*\\ \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 0.013247066843095467:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;(\left(\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}\right) \cdot \left(\frac{1}{\sqrt{1 + e^{-2 \cdot x}}}\right) + \left(-1\right))_*\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Split input into 3 regimes
  2. if (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < -7.418111132777761e-143

    1. Initial program 1.1

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

      \[\leadsto \frac{2}{\color{blue}{\sqrt{1 + e^{-2 \cdot x}} \cdot \sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    4. Applied associate-/r*1.1

      \[\leadsto \color{blue}{\frac{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}{\sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.1

      \[\leadsto \frac{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}{\sqrt{\color{blue}{1 \cdot \left(1 + e^{-2 \cdot x}\right)}}} - 1\]
    7. Applied sqrt-prod1.1

      \[\leadsto \frac{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}{\color{blue}{\sqrt{1} \cdot \sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    8. Applied add-sqr-sqrt1.1

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}} \cdot \sqrt{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}}}{\sqrt{1} \cdot \sqrt{1 + e^{-2 \cdot x}}} - 1\]
    9. Applied times-frac1.1

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{1}} \cdot \frac{\sqrt{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}}}{\sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    10. Applied fma-neg1.1

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

    if -7.418111132777761e-143 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < 0.013247066843095467

    1. Initial program 59.8

      \[\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 0.013247066843095467 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1)

    1. Initial program 0.0

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

      \[\leadsto \frac{2}{\color{blue}{\sqrt{1 + e^{-2 \cdot x}} \cdot \sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    4. Applied associate-/r*0.0

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

      \[\leadsto \color{blue}{\frac{2}{\sqrt{1 + e^{-2 \cdot x}}} \cdot \frac{1}{\sqrt{1 + e^{-2 \cdot x}}}} - 1\]
    7. Applied fma-neg0.0

      \[\leadsto \color{blue}{(\left(\frac{2}{\sqrt{1 + e^{-2 \cdot x}}}\right) \cdot \left(\frac{1}{\sqrt{1 + e^{-2 \cdot x}}}\right) + \left(-1\right))_*}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 35.7s)Debug logProfile

herbie shell --seed '#(1071725047 233389029 2036512464 3988615230 2972226563 1111574017)' +o rules:numerics
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))