Average Error: 5.7 → 0
Time: 8.4s
Precision: 64
\[e^{\log a + \log b}\]
\[a \cdot b\]
e^{\log a + \log b}
a \cdot b
double f(double a, double b) {
        double r120424 = a;
        double r120425 = log(r120424);
        double r120426 = b;
        double r120427 = log(r120426);
        double r120428 = r120425 + r120427;
        double r120429 = exp(r120428);
        return r120429;
}

double f(double a, double b) {
        double r120430 = a;
        double r120431 = b;
        double r120432 = r120430 * r120431;
        return r120432;
}

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.7
Target0
Herbie0
\[a \cdot b\]

Derivation

  1. Initial program 5.7

    \[e^{\log a + \log b}\]
  2. Taylor expanded around -inf 64.0

    \[\leadsto \color{blue}{e^{2 \cdot \log -1 - \left(\log \left(\frac{-1}{b}\right) + \log \left(\frac{-1}{a}\right)\right)}}\]
  3. Simplified0

    \[\leadsto \color{blue}{1 \cdot \left(a \cdot b\right)}\]
  4. Final simplification0

    \[\leadsto a \cdot b\]

Reproduce

herbie shell --seed 2019297 
(FPCore (a b)
  :name "Exp of sum of logs"
  :precision binary64

  :herbie-target
  (* a b)

  (exp (+ (log a) (log b))))