Average Error: 0.5 → 1.0
Time: 13.8s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)\right) - x \cdot y
double f(double x, double y) {
        double r131994 = 1.0;
        double r131995 = x;
        double r131996 = exp(r131995);
        double r131997 = r131994 + r131996;
        double r131998 = log(r131997);
        double r131999 = y;
        double r132000 = r131995 * r131999;
        double r132001 = r131998 - r132000;
        return r132001;
}

double f(double x, double y) {
        double r132002 = 1.0;
        double r132003 = x;
        double r132004 = exp(r132003);
        double r132005 = r132002 + r132004;
        double r132006 = sqrt(r132005);
        double r132007 = log(r132006);
        double r132008 = r132007 + r132007;
        double r132009 = y;
        double r132010 = r132003 * r132009;
        double r132011 = r132008 - r132010;
        return r132011;
}

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

    \[\leadsto \color{blue}{\log \left(1 + e^{x}\right) - y \cdot x}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt1.3

    \[\leadsto \log \color{blue}{\left(\sqrt{1 + e^{x}} \cdot \sqrt{1 + e^{x}}\right)} - y \cdot x\]
  5. Applied log-prod1.0

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

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

Reproduce

herbie shell --seed 2019179 
(FPCore (x y)
  :name "Logistic regression 2"

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

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