Average Error: 0.6 → 0.6
Time: 16.6s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\log \left(\log \left(e^{e^{x}} \cdot e\right)\right) - y \cdot x\]
\log \left(1 + e^{x}\right) - x \cdot y
\log \left(\log \left(e^{e^{x}} \cdot e\right)\right) - y \cdot x
double f(double x, double y) {
        double r4286398 = 1.0;
        double r4286399 = x;
        double r4286400 = exp(r4286399);
        double r4286401 = r4286398 + r4286400;
        double r4286402 = log(r4286401);
        double r4286403 = y;
        double r4286404 = r4286399 * r4286403;
        double r4286405 = r4286402 - r4286404;
        return r4286405;
}

double f(double x, double y) {
        double r4286406 = x;
        double r4286407 = exp(r4286406);
        double r4286408 = exp(r4286407);
        double r4286409 = exp(1.0);
        double r4286410 = r4286408 * r4286409;
        double r4286411 = log(r4286410);
        double r4286412 = log(r4286411);
        double r4286413 = y;
        double r4286414 = r4286413 * r4286406;
        double r4286415 = r4286412 - r4286414;
        return r4286415;
}

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.6
\[\begin{array}{l} \mathbf{if}\;x \le 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 add-log-exp0.6

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

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

    \[\leadsto \log \color{blue}{\left(\log \left(e^{1} \cdot e^{e^{x}}\right)\right)} - x \cdot y\]
  6. Simplified0.6

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

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

Reproduce

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

  :herbie-target
  (if (<= x 0) (- (log (+ 1 (exp x))) (* x y)) (- (log (+ 1 (exp (- x)))) (* (- x) (- 1 y))))

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