Average Error: 0.5 → 0.5
Time: 4.7s
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 r166233 = 1.0;
        double r166234 = x;
        double r166235 = exp(r166234);
        double r166236 = r166233 + r166235;
        double r166237 = log(r166236);
        double r166238 = y;
        double r166239 = r166234 * r166238;
        double r166240 = r166237 - r166239;
        return r166240;
}

double f(double x, double y) {
        double r166241 = 1.0;
        double r166242 = 3.0;
        double r166243 = pow(r166241, r166242);
        double r166244 = x;
        double r166245 = exp(r166244);
        double r166246 = pow(r166245, r166242);
        double r166247 = r166243 + r166246;
        double r166248 = r166245 - r166241;
        double r166249 = r166245 * r166248;
        double r166250 = r166241 * r166241;
        double r166251 = r166249 + r166250;
        double r166252 = r166247 / r166251;
        double r166253 = log(r166252);
        double r166254 = y;
        double r166255 = r166244 * r166254;
        double r166256 = r166253 - r166255;
        return r166256;
}

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)))