Average Error: 0.5 → 0.5
Time: 5.0s
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 r174535 = 1.0;
        double r174536 = x;
        double r174537 = exp(r174536);
        double r174538 = r174535 + r174537;
        double r174539 = log(r174538);
        double r174540 = y;
        double r174541 = r174536 * r174540;
        double r174542 = r174539 - r174541;
        return r174542;
}

double f(double x, double y) {
        double r174543 = 1.0;
        double r174544 = 3.0;
        double r174545 = pow(r174543, r174544);
        double r174546 = x;
        double r174547 = exp(r174546);
        double r174548 = pow(r174547, r174544);
        double r174549 = r174545 + r174548;
        double r174550 = r174547 - r174543;
        double r174551 = r174547 * r174550;
        double r174552 = r174543 * r174543;
        double r174553 = r174551 + r174552;
        double r174554 = r174549 / r174553;
        double r174555 = log(r174554);
        double r174556 = y;
        double r174557 = r174546 * r174556;
        double r174558 = r174555 - r174557;
        return r174558;
}

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

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

    \[\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 2020056 
(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)))