Average Error: 0.4 → 1.0
Time: 16.8s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\sqrt[3]{\log \left(\sqrt{1 + e^{x}}\right) \cdot \left(\log \left(\sqrt{1 + e^{x}}\right) \cdot \log \left(\sqrt{1 + e^{x}}\right)\right)} + \log \left(\sqrt{{\left(e^{x}\right)}^{3} + 1}\right)\right) - \left(\log \left(\sqrt{\left(-1 + e^{x}\right) \cdot e^{x} - -1}\right) + x \cdot y\right)\]
\log \left(1 + e^{x}\right) - x \cdot y
\left(\sqrt[3]{\log \left(\sqrt{1 + e^{x}}\right) \cdot \left(\log \left(\sqrt{1 + e^{x}}\right) \cdot \log \left(\sqrt{1 + e^{x}}\right)\right)} + \log \left(\sqrt{{\left(e^{x}\right)}^{3} + 1}\right)\right) - \left(\log \left(\sqrt{\left(-1 + e^{x}\right) \cdot e^{x} - -1}\right) + x \cdot y\right)
double f(double x, double y) {
        double r5189248 = 1.0;
        double r5189249 = x;
        double r5189250 = exp(r5189249);
        double r5189251 = r5189248 + r5189250;
        double r5189252 = log(r5189251);
        double r5189253 = y;
        double r5189254 = r5189249 * r5189253;
        double r5189255 = r5189252 - r5189254;
        return r5189255;
}

double f(double x, double y) {
        double r5189256 = 1.0;
        double r5189257 = x;
        double r5189258 = exp(r5189257);
        double r5189259 = r5189256 + r5189258;
        double r5189260 = sqrt(r5189259);
        double r5189261 = log(r5189260);
        double r5189262 = r5189261 * r5189261;
        double r5189263 = r5189261 * r5189262;
        double r5189264 = cbrt(r5189263);
        double r5189265 = 3.0;
        double r5189266 = pow(r5189258, r5189265);
        double r5189267 = r5189266 + r5189256;
        double r5189268 = sqrt(r5189267);
        double r5189269 = log(r5189268);
        double r5189270 = r5189264 + r5189269;
        double r5189271 = -1.0;
        double r5189272 = r5189271 + r5189258;
        double r5189273 = r5189272 * r5189258;
        double r5189274 = r5189273 - r5189271;
        double r5189275 = sqrt(r5189274);
        double r5189276 = log(r5189275);
        double r5189277 = y;
        double r5189278 = r5189257 * r5189277;
        double r5189279 = r5189276 + r5189278;
        double r5189280 = r5189270 - r5189279;
        return r5189280;
}

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
Herbie1.0
\[\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 add-sqr-sqrt1.2

    \[\leadsto \log \color{blue}{\left(\sqrt{1 + e^{x}} \cdot \sqrt{1 + e^{x}}\right)} - x \cdot y\]
  4. Applied log-prod0.9

    \[\leadsto \color{blue}{\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)\right)} - x \cdot y\]
  5. Using strategy rm
  6. Applied flip3-+1.0

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

    \[\leadsto \left(\log \left(\sqrt{1 + e^{x}}\right) + \log \color{blue}{\left(\frac{\sqrt{{1}^{3} + {\left(e^{x}\right)}^{3}}}{\sqrt{1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)}}\right)}\right) - x \cdot y\]
  8. Applied log-div1.0

    \[\leadsto \left(\log \left(\sqrt{1 + e^{x}}\right) + \color{blue}{\left(\log \left(\sqrt{{1}^{3} + {\left(e^{x}\right)}^{3}}\right) - \log \left(\sqrt{1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)}\right)\right)}\right) - x \cdot y\]
  9. Applied associate-+r-1.0

    \[\leadsto \color{blue}{\left(\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{{1}^{3} + {\left(e^{x}\right)}^{3}}\right)\right) - \log \left(\sqrt{1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)}\right)\right)} - x \cdot y\]
  10. Applied associate--l-1.0

    \[\leadsto \color{blue}{\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{{1}^{3} + {\left(e^{x}\right)}^{3}}\right)\right) - \left(\log \left(\sqrt{1 \cdot 1 + \left(e^{x} \cdot e^{x} - 1 \cdot e^{x}\right)}\right) + x \cdot y\right)}\]
  11. Simplified1.0

    \[\leadsto \left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{{1}^{3} + {\left(e^{x}\right)}^{3}}\right)\right) - \color{blue}{\left(\log \left(\sqrt{\left(e^{x} + -1\right) \cdot e^{x} - -1}\right) + y \cdot x\right)}\]
  12. Using strategy rm
  13. Applied add-cbrt-cube1.0

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

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

Reproduce

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