Average Error: 0.5 → 0.5
Time: 6.1s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right)\right) - x \cdot y\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \log \left(1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)\right)\right) - x \cdot y
double f(double x, double y) {
        double r144661 = 1.0;
        double r144662 = x;
        double r144663 = exp(r144662);
        double r144664 = r144661 + r144663;
        double r144665 = log(r144664);
        double r144666 = y;
        double r144667 = r144662 * r144666;
        double r144668 = r144665 - r144667;
        return r144668;
}

double f(double x, double y) {
        double r144669 = 1.0;
        double r144670 = 3.0;
        double r144671 = pow(r144669, r144670);
        double r144672 = x;
        double r144673 = exp(r144672);
        double r144674 = pow(r144673, r144670);
        double r144675 = r144671 + r144674;
        double r144676 = log(r144675);
        double r144677 = r144669 * r144669;
        double r144678 = r144673 * r144673;
        double r144679 = r144669 * r144673;
        double r144680 = r144678 - r144679;
        double r144681 = r144677 + r144680;
        double r144682 = log(r144681);
        double r144683 = r144676 - r144682;
        double r144684 = y;
        double r144685 = r144672 * r144684;
        double r144686 = r144683 - r144685;
        return r144686;
}

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
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. Applied log-div0.5

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

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

Reproduce

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