Average Error: 0.6 → 0.7
Time: 8.7s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \left(\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right) + x \cdot y\right)\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \left(\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right) + x \cdot y\right)
double f(double x, double y) {
        double r263581 = 1.0;
        double r263582 = x;
        double r263583 = exp(r263582);
        double r263584 = r263581 + r263583;
        double r263585 = log(r263584);
        double r263586 = y;
        double r263587 = r263582 * r263586;
        double r263588 = r263585 - r263587;
        return r263588;
}

double f(double x, double y) {
        double r263589 = 1.0;
        double r263590 = 3.0;
        double r263591 = pow(r263589, r263590);
        double r263592 = x;
        double r263593 = exp(r263592);
        double r263594 = pow(r263593, r263590);
        double r263595 = r263591 + r263594;
        double r263596 = log(r263595);
        double r263597 = r263593 - r263589;
        double r263598 = r263593 * r263597;
        double r263599 = r263589 * r263589;
        double r263600 = r263598 + r263599;
        double r263601 = log(r263600);
        double r263602 = y;
        double r263603 = r263592 * r263602;
        double r263604 = r263601 + r263603;
        double r263605 = r263596 - r263604;
        return r263605;
}

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.1
Herbie0.7
\[\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.6

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

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

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

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

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

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

Reproduce

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