Average Error: 0.0 → 0.0
Time: 1.4s
Precision: 64
\[\left(x + y\right) \cdot \left(z + 1\right)\]
\[\mathsf{fma}\left(z, x, \mathsf{fma}\left(y, z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)\right)\]
\left(x + y\right) \cdot \left(z + 1\right)
\mathsf{fma}\left(z, x, \mathsf{fma}\left(y, z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)\right)
double f(double x, double y, double z) {
        double r41649 = x;
        double r41650 = y;
        double r41651 = r41649 + r41650;
        double r41652 = z;
        double r41653 = 1.0;
        double r41654 = r41652 + r41653;
        double r41655 = r41651 * r41654;
        return r41655;
}

double f(double x, double y, double z) {
        double r41656 = z;
        double r41657 = x;
        double r41658 = y;
        double r41659 = 1.0;
        double r41660 = r41659 * r41658;
        double r41661 = fma(r41659, r41657, r41660);
        double r41662 = fma(r41658, r41656, r41661);
        double r41663 = fma(r41656, r41657, r41662);
        return r41663;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) \cdot \left(z + 1\right)\]
  2. Using strategy rm
  3. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(x + y\right) \cdot z + \left(x + y\right) \cdot 1}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{z \cdot \left(x + y\right)} + \left(x + y\right) \cdot 1\]
  5. Simplified0.0

    \[\leadsto z \cdot \left(x + y\right) + \color{blue}{\mathsf{fma}\left(1, x, 1 \cdot y\right)}\]
  6. Using strategy rm
  7. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(z \cdot x + z \cdot y\right)} + \mathsf{fma}\left(1, x, 1 \cdot y\right)\]
  8. Applied associate-+l+0.0

    \[\leadsto \color{blue}{z \cdot x + \left(z \cdot y + \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)}\]
  9. Simplified0.0

    \[\leadsto z \cdot x + \color{blue}{\mathsf{fma}\left(y, z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)}\]
  10. Using strategy rm
  11. Applied fma-def0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, x, \mathsf{fma}\left(y, z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)\right)}\]
  12. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(z, x, \mathsf{fma}\left(y, z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)\right)\]

Reproduce

herbie shell --seed 2020065 +o rules:numerics
(FPCore (x y z)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
  :precision binary64
  (* (+ x y) (+ z 1)))