Average Error: 0.6 → 1.2
Time: 12.4s
Precision: 64
\[\log \left(1 + e^{x}\right)\]
\[\log \left(\sqrt{1 + e^{x}}\right) + \log \left(1 + e^{x}\right) \cdot \frac{1}{2}\]
\log \left(1 + e^{x}\right)
\log \left(\sqrt{1 + e^{x}}\right) + \log \left(1 + e^{x}\right) \cdot \frac{1}{2}
double f(double x) {
        double r31933829 = 1.0;
        double r31933830 = x;
        double r31933831 = exp(r31933830);
        double r31933832 = r31933829 + r31933831;
        double r31933833 = log(r31933832);
        return r31933833;
}

double f(double x) {
        double r31933834 = 1.0;
        double r31933835 = x;
        double r31933836 = exp(r31933835);
        double r31933837 = r31933834 + r31933836;
        double r31933838 = sqrt(r31933837);
        double r31933839 = log(r31933838);
        double r31933840 = log(r31933837);
        double r31933841 = 0.5;
        double r31933842 = r31933840 * r31933841;
        double r31933843 = r31933839 + r31933842;
        return r31933843;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.6

    \[\log \left(1 + e^{x}\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt1.6

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

    \[\leadsto \color{blue}{\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)}\]
  5. Using strategy rm
  6. Applied pow1/21.2

    \[\leadsto \log \color{blue}{\left({\left(1 + e^{x}\right)}^{\frac{1}{2}}\right)} + \log \left(\sqrt{1 + e^{x}}\right)\]
  7. Applied log-pow1.2

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \log \left(1 + e^{x}\right)} + \log \left(\sqrt{1 + e^{x}}\right)\]
  8. Final simplification1.2

    \[\leadsto \log \left(\sqrt{1 + e^{x}}\right) + \log \left(1 + e^{x}\right) \cdot \frac{1}{2}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "log(1 + exp(x))"
  (log (+ 1.0 (exp x))))