Average Error: 5.7 → 0
Time: 4.2s
Precision: 64
\[e^{\log a + \log b}\]
\[a \cdot b\]
double f(double a, double b) {
        double r5850344 = a;
        double r5850345 = log(r5850344);
        double r5850346 = b;
        double r5850347 = log(r5850346);
        double r5850348 = r5850345 + r5850347;
        double r5850349 = exp(r5850348);
        return r5850349;
}

double f(double a, double b) {
        double r5850350 = a;
        double r5850351 = b;
        double r5850352 = r5850350 * r5850351;
        return r5850352;
}

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 2019101 +o rules:numerics
(FPCore (a b)
  :name "Exp of sum of logs"

  :herbie-target
  (* a b)

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