Average Error: 0.0 → 0.0
Time: 13.0s
Precision: 64
\[d1 \cdot d2 + d1 \cdot d3\]
\[\mathsf{fma}\left(d1, d2, \left(d1 \cdot d3\right)\right)\]
d1 \cdot d2 + d1 \cdot d3
\mathsf{fma}\left(d1, d2, \left(d1 \cdot d3\right)\right)
double f(double d1, double d2, double d3) {
        double r7263692 = d1;
        double r7263693 = d2;
        double r7263694 = r7263692 * r7263693;
        double r7263695 = d3;
        double r7263696 = r7263692 * r7263695;
        double r7263697 = r7263694 + r7263696;
        return r7263697;
}

double f(double d1, double d2, double d3) {
        double r7263698 = d1;
        double r7263699 = d2;
        double r7263700 = d3;
        double r7263701 = r7263698 * r7263700;
        double r7263702 = fma(r7263698, r7263699, r7263701);
        return r7263702;
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Target

Original0.0
Target0.0
Herbie0.0
\[d1 \cdot \left(d2 + d3\right)\]

Derivation

  1. Initial program 0.0

    \[d1 \cdot d2 + d1 \cdot d3\]
  2. Using strategy rm
  3. Applied fma-def0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(d1, d2, \left(d1 \cdot d3\right)\right)}\]
  4. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(d1, d2, \left(d1 \cdot d3\right)\right)\]

Reproduce

herbie shell --seed 2019130 +o rules:numerics
(FPCore (d1 d2 d3)
  :name "FastMath dist"

  :herbie-target
  (* d1 (+ d2 d3))

  (+ (* d1 d2) (* d1 d3)))