Average Error: 0.4 → 0.4
Time: 1.0m
Precision: 64
Internal Precision: 576
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\begin{array}{l} \mathbf{if}\;\log \left(1 + e^{x}\right) - y \cdot x \le 0.49429716277312463 \lor \neg \left(\log \left(1 + e^{x}\right) - y \cdot x \le 31.001698259014866\right):\\ \;\;\;\;\left(\log \left(\sqrt[3]{1 + e^{x}}\right) + \log \left(\sqrt[3]{1 + e^{x}} \cdot \sqrt[3]{1 + e^{x}}\right)\right) - y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1 + e^{x}}{e^{y \cdot x}}\right)\\ \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

Target

Original0.4
Target0.0
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;x \le 0:\\ \;\;\;\;\log \left(1 + e^{x}\right) - x \cdot y\\ \mathbf{else}:\\ \;\;\;\;\log \left(1 + e^{-x}\right) - \left(-x\right) \cdot \left(1 - y\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (- (log (+ 1 (exp x))) (* x y)) < 0.49429716277312463 or 31.001698259014866 < (- (log (+ 1 (exp x))) (* x y))

    1. Initial program 0.9

      \[\log \left(1 + e^{x}\right) - x \cdot y\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.9

      \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{1 + e^{x}} \cdot \sqrt[3]{1 + e^{x}}\right) \cdot \sqrt[3]{1 + e^{x}}\right)} - x \cdot y\]
    4. Applied log-prod0.9

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

    if 0.49429716277312463 < (- (log (+ 1 (exp x))) (* x y)) < 31.001698259014866

    1. Initial program 0.0

      \[\log \left(1 + e^{x}\right) - x \cdot y\]
    2. Using strategy rm
    3. Applied add-log-exp0.0

      \[\leadsto \log \left(1 + e^{x}\right) - \color{blue}{\log \left(e^{x \cdot y}\right)}\]
    4. Applied diff-log0.0

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\log \left(1 + e^{x}\right) - y \cdot x \le 0.49429716277312463 \lor \neg \left(\log \left(1 + e^{x}\right) - y \cdot x \le 31.001698259014866\right):\\ \;\;\;\;\left(\log \left(\sqrt[3]{1 + e^{x}}\right) + \log \left(\sqrt[3]{1 + e^{x}} \cdot \sqrt[3]{1 + e^{x}}\right)\right) - y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1 + e^{x}}{e^{y \cdot x}}\right)\\ \end{array}}\]

Runtime

Time bar (total: 1.0m)Debug logProfile

herbie shell --seed 2018207 
(FPCore (x y)
  :name "Logistic regression 2"

  :herbie-target
  (if (<= x 0) (- (log (+ 1 (exp x))) (* x y)) (- (log (+ 1 (exp (- x)))) (* (- x) (- 1 y))))

  (- (log (+ 1 (exp x))) (* x y)))