Average Error: 28.9 → 0.1
Time: 49.9s
Precision: 64
Internal Precision: 1408
\[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
\[\begin{array}{l} \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le -7.186194153768397 \cdot 10^{-07}:\\ \;\;\;\;\left(\sqrt[3]{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} + 1} \cdot \sqrt[3]{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} + 1}\right) \cdot \left(\frac{\sqrt[3]{\frac{2}{1 + e^{-2 \cdot x}} - 1}}{\sqrt[3]{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} - 1}} \cdot \left(\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} - 1\right)\right)\\ \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 0.004251288864552949:\\ \;\;\;\;\left(\frac{2}{15} \cdot {x}^{5} + x\right) - \frac{1}{3} \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{2}{1 + e^{-2 \cdot x}} - 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.186194153768397e-07

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} \cdot \sqrt{\frac{2}{1 + e^{-2 \cdot x}}}} - 1\]
    4. Applied difference-of-sqr-10.2

      \[\leadsto \color{blue}{\left(\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} + 1\right) \cdot \left(\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} - 1\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt0.2

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} + 1} \cdot \sqrt[3]{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} + 1}\right) \cdot \left(\sqrt[3]{\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} + 1} \cdot \left(\sqrt{\frac{2}{1 + e^{-2 \cdot x}}} - 1\right)\right)}\]
    8. Using strategy rm
    9. Applied flip-+0.2

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

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

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

    if -7.186194153768397e-07 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < 0.004251288864552949

    1. Initial program 59.2

      \[\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.004251288864552949 < (- (/ 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-log-exp0.0

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

Runtime

Time bar (total: 49.9s)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))