Average Error: 0.0 → 0.0
Time: 1.2s
Precision: 64
\[\left(x + y\right) \cdot \left(z + 1\right)\]
\[z \cdot \left(x + y\right) + \mathsf{fma}\left(1, x, 1 \cdot y\right)\]
\left(x + y\right) \cdot \left(z + 1\right)
z \cdot \left(x + y\right) + \mathsf{fma}\left(1, x, 1 \cdot y\right)
double f(double x, double y, double z) {
        double r38074 = x;
        double r38075 = y;
        double r38076 = r38074 + r38075;
        double r38077 = z;
        double r38078 = 1.0;
        double r38079 = r38077 + r38078;
        double r38080 = r38076 * r38079;
        return r38080;
}

double f(double x, double y, double z) {
        double r38081 = z;
        double r38082 = x;
        double r38083 = y;
        double r38084 = r38082 + r38083;
        double r38085 = r38081 * r38084;
        double r38086 = 1.0;
        double r38087 = r38086 * r38083;
        double r38088 = fma(r38086, r38082, r38087);
        double r38089 = r38085 + r38088;
        return r38089;
}

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. Final simplification0.0

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

Reproduce

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