Average Error: 5.7 → 0
Time: 2.3s
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 r142666 = a;
        double r142667 = log(r142666);
        double r142668 = b;
        double r142669 = log(r142668);
        double r142670 = r142667 + r142669;
        double r142671 = exp(r142670);
        return r142671;
}

double f(double a, double b) {
        double r142672 = a;
        double r142673 = b;
        double r142674 = r142672 * r142673;
        return r142674;
}

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. Using strategy rm
  3. Applied exp-sum5.5

    \[\leadsto \color{blue}{e^{\log a} \cdot e^{\log b}}\]
  4. Simplified4.8

    \[\leadsto \color{blue}{a} \cdot e^{\log b}\]
  5. Simplified0

    \[\leadsto a \cdot \color{blue}{b}\]
  6. Final simplification0

    \[\leadsto a \cdot b\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (a b)
  :name "Exp of sum of logs"
  :precision binary64

  :herbie-target
  (* a b)

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