Average Error: 0.6 → 0.6
Time: 35.3s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left(\left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x}\right) \cdot e^{\left(x + x\right) + x} + 1\right) - \left(\log \left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x} + \left(1 - e^{\left(x + x\right) + x}\right)\right) + \left(x \cdot y + \log \left(\left(e^{x} \cdot e^{x} - e^{x}\right) + 1\right)\right)\right)\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left(\left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x}\right) \cdot e^{\left(x + x\right) + x} + 1\right) - \left(\log \left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x} + \left(1 - e^{\left(x + x\right) + x}\right)\right) + \left(x \cdot y + \log \left(\left(e^{x} \cdot e^{x} - e^{x}\right) + 1\right)\right)\right)
double f(double x, double y) {
        double r77813510 = 1.0;
        double r77813511 = x;
        double r77813512 = exp(r77813511);
        double r77813513 = r77813510 + r77813512;
        double r77813514 = log(r77813513);
        double r77813515 = y;
        double r77813516 = r77813511 * r77813515;
        double r77813517 = r77813514 - r77813516;
        return r77813517;
}

double f(double x, double y) {
        double r77813518 = x;
        double r77813519 = r77813518 + r77813518;
        double r77813520 = r77813519 + r77813518;
        double r77813521 = exp(r77813520);
        double r77813522 = r77813521 * r77813521;
        double r77813523 = r77813522 * r77813521;
        double r77813524 = 1.0;
        double r77813525 = r77813523 + r77813524;
        double r77813526 = log(r77813525);
        double r77813527 = r77813524 - r77813521;
        double r77813528 = r77813522 + r77813527;
        double r77813529 = log(r77813528);
        double r77813530 = y;
        double r77813531 = r77813518 * r77813530;
        double r77813532 = exp(r77813518);
        double r77813533 = r77813532 * r77813532;
        double r77813534 = r77813533 - r77813532;
        double r77813535 = r77813534 + r77813524;
        double r77813536 = log(r77813535);
        double r77813537 = r77813531 + r77813536;
        double r77813538 = r77813529 + r77813537;
        double r77813539 = r77813526 - r77813538;
        return r77813539;
}

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.6
Target0.0
Herbie0.6
\[\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. Initial program 0.6

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

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

    \[\leadsto \color{blue}{\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right)\right)} - x \cdot y\]
  5. Applied associate--l-0.6

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

    \[\leadsto \color{blue}{\log \left(e^{\left(x + x\right) + x} + 1\right)} - \left(\log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right) + x \cdot y\right)\]
  7. Using strategy rm
  8. Applied flip3-+0.6

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

    \[\leadsto \color{blue}{\left(\log \left({\left(e^{\left(x + x\right) + x}\right)}^{3} + {1}^{3}\right) - \log \left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x} + \left(1 \cdot 1 - e^{\left(x + x\right) + x} \cdot 1\right)\right)\right)} - \left(\log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right) + x \cdot y\right)\]
  10. Applied associate--l-0.6

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

    \[\leadsto \color{blue}{\log \left(\left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x}\right) \cdot e^{\left(x + x\right) + x} + 1\right)} - \left(\log \left(e^{\left(x + x\right) + x} \cdot e^{\left(x + x\right) + x} + \left(1 \cdot 1 - e^{\left(x + x\right) + x} \cdot 1\right)\right) + \left(\log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right) + x \cdot y\right)\right)\]
  12. Final simplification0.6

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

Reproduce

herbie shell --seed 2019120 
(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)))