Average Error: 0.5 → 1.0
Time: 14.3s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left(\sqrt{1 + e^{x}}\right) + e^{\log \left(\log \left(\sqrt{1 + e^{x}}\right)\right)}\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\log \left(\sqrt{1 + e^{x}}\right) + e^{\log \left(\log \left(\sqrt{1 + e^{x}}\right)\right)}\right) - x \cdot y
double f(double x, double y) {
        double r95403 = 1.0;
        double r95404 = x;
        double r95405 = exp(r95404);
        double r95406 = r95403 + r95405;
        double r95407 = log(r95406);
        double r95408 = y;
        double r95409 = r95404 * r95408;
        double r95410 = r95407 - r95409;
        return r95410;
}

double f(double x, double y) {
        double r95411 = 1.0;
        double r95412 = x;
        double r95413 = exp(r95412);
        double r95414 = r95411 + r95413;
        double r95415 = sqrt(r95414);
        double r95416 = log(r95415);
        double r95417 = log(r95416);
        double r95418 = exp(r95417);
        double r95419 = r95416 + r95418;
        double r95420 = y;
        double r95421 = r95412 * r95420;
        double r95422 = r95419 - r95421;
        return r95422;
}

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
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. Using strategy rm
  3. Applied add-sqr-sqrt1.4

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

    \[\leadsto \color{blue}{\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)\right)} - x \cdot y\]
  5. Using strategy rm
  6. Applied add-exp-log1.0

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

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

Reproduce

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