Average Error: 0.0 → 0.0
Time: 1.3s
Precision: 64
\[\left(x + y\right) \cdot \left(z + 1\right)\]
\[\mathsf{fma}\left(x, z, \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(x, z, \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 r34828 = x;
        double r34829 = y;
        double r34830 = r34828 + r34829;
        double r34831 = z;
        double r34832 = 1.0;
        double r34833 = r34831 + r34832;
        double r34834 = r34830 * r34833;
        return r34834;
}

double f(double x, double y, double z) {
        double r34835 = x;
        double r34836 = z;
        double r34837 = y;
        double r34838 = 1.0;
        double r34839 = r34838 * r34837;
        double r34840 = fma(r34838, r34835, r34839);
        double r34841 = fma(r34837, r34836, r34840);
        double r34842 = fma(r34835, r34836, r34841);
        return r34842;
}

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-rgt-in0.0

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

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

    \[\leadsto x \cdot z + \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(x, z, \mathsf{fma}\left(y, z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right)\right)}\]
  12. Final simplification0.0

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

Reproduce

herbie shell --seed 2020100 +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)))