Average Error: 0.4 → 0.5
Time: 54.4s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left(e^{\left(x + x\right) + x} + 1\right) + \log \left(\frac{1}{\left(e^{x} \cdot e^{x} - e^{x}\right) + 1}\right)\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\log \left(e^{\left(x + x\right) + x} + 1\right) + \log \left(\frac{1}{\left(e^{x} \cdot e^{x} - e^{x}\right) + 1}\right)\right) - x \cdot y
double f(double x, double y) {
        double r19610338 = 1.0;
        double r19610339 = x;
        double r19610340 = exp(r19610339);
        double r19610341 = r19610338 + r19610340;
        double r19610342 = log(r19610341);
        double r19610343 = y;
        double r19610344 = r19610339 * r19610343;
        double r19610345 = r19610342 - r19610344;
        return r19610345;
}

double f(double x, double y) {
        double r19610346 = x;
        double r19610347 = r19610346 + r19610346;
        double r19610348 = r19610347 + r19610346;
        double r19610349 = exp(r19610348);
        double r19610350 = 1.0;
        double r19610351 = r19610349 + r19610350;
        double r19610352 = log(r19610351);
        double r19610353 = exp(r19610346);
        double r19610354 = r19610353 * r19610353;
        double r19610355 = r19610354 - r19610353;
        double r19610356 = r19610355 + r19610350;
        double r19610357 = r19610350 / r19610356;
        double r19610358 = log(r19610357);
        double r19610359 = r19610352 + r19610358;
        double r19610360 = y;
        double r19610361 = r19610346 * r19610360;
        double r19610362 = r19610359 - r19610361;
        return r19610362;
}

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.4
Target0.1
Herbie0.5
\[\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.4

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

    \[\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. Using strategy rm
  5. Applied div-inv0.5

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

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

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

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

Reproduce

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