Average Error: 0.5 → 0.5
Time: 11.2s
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 r167931 = 1.0;
        double r167932 = x;
        double r167933 = exp(r167932);
        double r167934 = r167931 + r167933;
        double r167935 = log(r167934);
        double r167936 = y;
        double r167937 = r167932 * r167936;
        double r167938 = r167935 - r167937;
        return r167938;
}

double f(double x, double y) {
        double r167939 = 1.0;
        double r167940 = 3.0;
        double r167941 = pow(r167939, r167940);
        double r167942 = x;
        double r167943 = exp(r167942);
        double r167944 = pow(r167943, r167940);
        double r167945 = r167941 + r167944;
        double r167946 = log(r167945);
        double r167947 = r167943 - r167939;
        double r167948 = r167943 * r167947;
        double r167949 = r167939 * r167939;
        double r167950 = r167948 + r167949;
        double r167951 = sqrt(r167950);
        double r167952 = log(r167951);
        double r167953 = r167952 + r167952;
        double r167954 = cbrt(r167953);
        double r167955 = log(r167950);
        double r167956 = cbrt(r167955);
        double r167957 = r167954 * r167956;
        double r167958 = r167957 * r167956;
        double r167959 = r167946 - r167958;
        double r167960 = y;
        double r167961 = r167942 * r167960;
        double r167962 = r167959 - r167961;
        return r167962;
}

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