Average Error: 0.5 → 0.6
Time: 4.6s
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 r142984 = 1.0;
        double r142985 = x;
        double r142986 = exp(r142985);
        double r142987 = r142984 + r142986;
        double r142988 = log(r142987);
        double r142989 = y;
        double r142990 = r142985 * r142989;
        double r142991 = r142988 - r142990;
        return r142991;
}

double f(double x, double y) {
        double r142992 = 1.0;
        double r142993 = 3.0;
        double r142994 = pow(r142992, r142993);
        double r142995 = x;
        double r142996 = exp(r142995);
        double r142997 = pow(r142996, r142993);
        double r142998 = r142994 + r142997;
        double r142999 = log(r142998);
        double r143000 = r142992 * r142992;
        double r143001 = r142996 * r142996;
        double r143002 = r142992 * r142996;
        double r143003 = r143001 - r143002;
        double r143004 = r143000 + r143003;
        double r143005 = log(r143004);
        double r143006 = r142999 - r143005;
        double r143007 = y;
        double r143008 = r142995 * r143007;
        double r143009 = r143006 - r143008;
        return r143009;
}

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

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

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

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