Average Error: 5.7 → 0
Time: 4.3s
Precision: 64
\[e^{\log a + \log b}\]
\[a \cdot b\]
double f(double a, double b) {
        double r21910887 = a;
        double r21910888 = log(r21910887);
        double r21910889 = b;
        double r21910890 = log(r21910889);
        double r21910891 = r21910888 + r21910890;
        double r21910892 = exp(r21910891);
        return r21910892;
}

double f(double a, double b) {
        double r21910893 = a;
        double r21910894 = b;
        double r21910895 = r21910893 * r21910894;
        return r21910895;
}

e^{\log a + \log b}
a \cdot b

Error

Bits error versus a

Bits error versus b

Target

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

Derivation

  1. Initial program 5.7

    \[e^{\log a + \log b}\]
  2. Simplified0

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

    \[\leadsto a \cdot b\]

Reproduce

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

  :herbie-target
  (* a b)

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