Average Error: 0.5 → 0.6
Time: 4.5s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left(\frac{{1}^{3} + {\left(e^{x}\right)}^{3}}{e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1}\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left(\frac{{1}^{3} + {\left(e^{x}\right)}^{3}}{e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1}\right) - x \cdot y
double f(double x, double y) {
        double r172577 = 1.0;
        double r172578 = x;
        double r172579 = exp(r172578);
        double r172580 = r172577 + r172579;
        double r172581 = log(r172580);
        double r172582 = y;
        double r172583 = r172578 * r172582;
        double r172584 = r172581 - r172583;
        return r172584;
}

double f(double x, double y) {
        double r172585 = 1.0;
        double r172586 = 3.0;
        double r172587 = pow(r172585, r172586);
        double r172588 = x;
        double r172589 = exp(r172588);
        double r172590 = pow(r172589, r172586);
        double r172591 = r172587 + r172590;
        double r172592 = r172589 - r172585;
        double r172593 = r172589 * r172592;
        double r172594 = r172585 * r172585;
        double r172595 = r172593 + r172594;
        double r172596 = r172591 / r172595;
        double r172597 = log(r172596);
        double r172598 = y;
        double r172599 = r172588 * r172598;
        double r172600 = r172597 - r172599;
        return r172600;
}

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

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

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

Reproduce

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