Average Error: 0.5 → 0.5
Time: 15.5s
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 r108700 = 1.0;
        double r108701 = x;
        double r108702 = exp(r108701);
        double r108703 = r108700 + r108702;
        double r108704 = log(r108703);
        double r108705 = y;
        double r108706 = r108701 * r108705;
        double r108707 = r108704 - r108706;
        return r108707;
}

double f(double x, double y) {
        double r108708 = 1.0;
        double r108709 = 3.0;
        double r108710 = pow(r108708, r108709);
        double r108711 = x;
        double r108712 = exp(r108711);
        double r108713 = pow(r108712, r108709);
        double r108714 = r108710 + r108713;
        double r108715 = log(r108714);
        double r108716 = r108712 - r108708;
        double r108717 = r108712 * r108716;
        double r108718 = r108708 * r108708;
        double r108719 = r108717 + r108718;
        double r108720 = log(r108719);
        double r108721 = r108715 - r108720;
        double r108722 = y;
        double r108723 = r108711 * r108722;
        double r108724 = r108721 - r108723;
        return r108724;
}

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

    \[\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 2019303 
(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)))