Average Error: 0.4 → 0.5
Time: 11.8s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)\right) - x \cdot y
double f(double x, double y) {
        double r120462 = 1.0;
        double r120463 = x;
        double r120464 = exp(r120463);
        double r120465 = r120462 + r120464;
        double r120466 = log(r120465);
        double r120467 = y;
        double r120468 = r120463 * r120467;
        double r120469 = r120466 - r120468;
        return r120469;
}

double f(double x, double y) {
        double r120470 = 1.0;
        double r120471 = 3.0;
        double r120472 = pow(r120470, r120471);
        double r120473 = x;
        double r120474 = exp(r120473);
        double r120475 = pow(r120474, r120471);
        double r120476 = r120472 + r120475;
        double r120477 = log(r120476);
        double r120478 = r120474 - r120470;
        double r120479 = r120474 * r120478;
        double r120480 = r120470 * r120470;
        double r120481 = r120479 + r120480;
        double r120482 = log(r120481);
        double r120483 = r120477 - r120482;
        double r120484 = y;
        double r120485 = r120473 * r120484;
        double r120486 = r120483 - r120485;
        return r120486;
}

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.1
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;x \le 0.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.4

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

    \[\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.5

    \[\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. Simplified0.5

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

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

Reproduce

herbie shell --seed 2019208 
(FPCore (x y)
  :name "Logistic regression 2"
  :precision binary64

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

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