Average Error: 0.5 → 0.5
Time: 11.4s
Precision: 64
\[\log \left(1 + e^{x}\right) - x \cdot y\]
\[\left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \left(\sqrt[3]{\log \left(\sqrt{e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1}\right) + \log \left(\sqrt{e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1}\right)} \cdot \sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)}\right) \cdot \sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\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) - \left(\sqrt[3]{\log \left(\sqrt{e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1}\right) + \log \left(\sqrt{e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1}\right)} \cdot \sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)}\right) \cdot \sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)}\right) - x \cdot y
double f(double x, double y) {
        double r237930 = 1.0;
        double r237931 = x;
        double r237932 = exp(r237931);
        double r237933 = r237930 + r237932;
        double r237934 = log(r237933);
        double r237935 = y;
        double r237936 = r237931 * r237935;
        double r237937 = r237934 - r237936;
        return r237937;
}

double f(double x, double y) {
        double r237938 = 1.0;
        double r237939 = 3.0;
        double r237940 = pow(r237938, r237939);
        double r237941 = x;
        double r237942 = exp(r237941);
        double r237943 = pow(r237942, r237939);
        double r237944 = r237940 + r237943;
        double r237945 = log(r237944);
        double r237946 = r237942 - r237938;
        double r237947 = r237942 * r237946;
        double r237948 = r237938 * r237938;
        double r237949 = r237947 + r237948;
        double r237950 = sqrt(r237949);
        double r237951 = log(r237950);
        double r237952 = r237951 + r237951;
        double r237953 = cbrt(r237952);
        double r237954 = log(r237949);
        double r237955 = cbrt(r237954);
        double r237956 = r237953 * r237955;
        double r237957 = r237956 * r237955;
        double r237958 = r237945 - r237957;
        double r237959 = y;
        double r237960 = r237941 * r237959;
        double r237961 = r237958 - r237960;
        return r237961;
}

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. Simplified0.5

    \[\leadsto \left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \color{blue}{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)}\right) - x \cdot y\]
  6. Using strategy rm
  7. Applied add-cube-cbrt0.5

    \[\leadsto \left(\log \left({1}^{3} + {\left(e^{x}\right)}^{3}\right) - \color{blue}{\left(\sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)} \cdot \sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)}\right) \cdot \sqrt[3]{\log \left(e^{x} \cdot \left(e^{x} - 1\right) + 1 \cdot 1\right)}}\right) - x \cdot y\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt0.5

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

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

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

Reproduce

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