Average Error: 0.5 → 0.5
Time: 10.0s
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 r183060 = 1.0;
        double r183061 = x;
        double r183062 = exp(r183061);
        double r183063 = r183060 + r183062;
        double r183064 = log(r183063);
        double r183065 = y;
        double r183066 = r183061 * r183065;
        double r183067 = r183064 - r183066;
        return r183067;
}

double f(double x, double y) {
        double r183068 = 1.0;
        double r183069 = 3.0;
        double r183070 = pow(r183068, r183069);
        double r183071 = x;
        double r183072 = exp(r183071);
        double r183073 = pow(r183072, r183069);
        double r183074 = r183070 + r183073;
        double r183075 = log(r183074);
        double r183076 = r183072 - r183068;
        double r183077 = r183072 * r183076;
        double r183078 = r183068 * r183068;
        double r183079 = r183077 + r183078;
        double r183080 = sqrt(r183079);
        double r183081 = log(r183080);
        double r183082 = r183081 + r183081;
        double r183083 = cbrt(r183082);
        double r183084 = log(r183079);
        double r183085 = cbrt(r183084);
        double r183086 = r183083 * r183085;
        double r183087 = r183086 * r183085;
        double r183088 = r183075 - r183087;
        double r183089 = y;
        double r183090 = r183071 * r183089;
        double r183091 = r183088 - r183090;
        return r183091;
}

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