Average Error: 0.0 → 0.0
Time: 1.6s
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 r28340 = x;
        double r28341 = y;
        double r28342 = r28340 + r28341;
        double r28343 = z;
        double r28344 = 1.0;
        double r28345 = r28343 + r28344;
        double r28346 = r28342 * r28345;
        return r28346;
}

double f(double x, double y, double z) {
        double r28347 = z;
        double r28348 = x;
        double r28349 = y;
        double r28350 = r28348 + r28349;
        double r28351 = r28347 * r28350;
        double r28352 = 1.0;
        double r28353 = r28352 * r28349;
        double r28354 = fma(r28352, r28348, r28353);
        double r28355 = r28351 + r28354;
        return r28355;
}

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 2019353 +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)))