Average Error: 28.6 → 0.1
Time: 2.5m
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 -1.6888443106222433 \cdot 10^{-07}:\\ \;\;\;\;\frac{\log \left(e^{\frac{2}{1 + e^{-2 \cdot x}} \cdot \frac{2}{1 + e^{-2 \cdot x}}}\right) - 1}{\frac{2}{1 + e^{-2 \cdot x}} + 1}\\ \mathbf{if}\;\frac{2}{1 + e^{-2 \cdot x}} - 1 \le 0.0032654260743848235:\\ \;\;\;\;\left(x + \frac{2}{15} \cdot {x}^{5}\right) - \frac{1}{3} \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{\frac{2 \cdot 2}{\left(1 + e^{-2 \cdot x}\right) \cdot \left(1 + e^{-2 \cdot x}\right)} - 1}\right)}{\frac{2}{1 + e^{-2 \cdot x}} + 1}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\frac{\frac{2}{1 + e^{-2 \cdot x}} \cdot \frac{2}{1 + e^{-2 \cdot x}} - 1 \cdot 1}{\frac{2}{1 + e^{-2 \cdot x}} + 1}}\]
    4. Applied simplify0.2

      \[\leadsto \frac{\color{blue}{\frac{2}{1 + e^{-2 \cdot x}} \cdot \frac{2}{1 + e^{-2 \cdot x}} - 1}}{\frac{2}{1 + e^{-2 \cdot x}} + 1}\]
    5. Using strategy rm
    6. Applied add-log-exp0.2

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

    if -1.6888443106222433e-07 < (- (/ 2 (+ 1 (exp (* -2 x)))) 1) < 0.0032654260743848235

    1. Initial program 59.1

      \[\frac{2}{1 + e^{-2 \cdot x}} - 1\]
    2. Taylor expanded around 0 0.0

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

    if 0.0032654260743848235 < (- (/ 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 flip--0.0

      \[\leadsto \color{blue}{\frac{\frac{2}{1 + e^{-2 \cdot x}} \cdot \frac{2}{1 + e^{-2 \cdot x}} - 1 \cdot 1}{\frac{2}{1 + e^{-2 \cdot x}} + 1}}\]
    4. Applied simplify0.0

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

      \[\leadsto \frac{\color{blue}{\frac{2 \cdot 2}{\left(1 + e^{-2 \cdot x}\right) \cdot \left(1 + e^{-2 \cdot x}\right)}} - 1}{\frac{2}{1 + e^{-2 \cdot x}} + 1}\]
    7. Using strategy rm
    8. Applied add-log-exp0.0

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

Runtime

Time bar (total: 2.5m)Debug logProfile

herbie shell --seed 2018296 
(FPCore (x y)
  :name "Logistic function from Lakshay Garg"
  (- (/ 2 (+ 1 (exp (* -2 x)))) 1))