Average Error: 0.0 → 0.0
Time: 1.5s
Precision: 64
\[\left(x + y\right) \cdot \left(1 - z\right)\]
\[\mathsf{fma}\left(x, -z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right) + y \cdot \left(-z\right)\]
\left(x + y\right) \cdot \left(1 - z\right)
\mathsf{fma}\left(x, -z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right) + y \cdot \left(-z\right)
double f(double x, double y, double z) {
        double r44465 = x;
        double r44466 = y;
        double r44467 = r44465 + r44466;
        double r44468 = 1.0;
        double r44469 = z;
        double r44470 = r44468 - r44469;
        double r44471 = r44467 * r44470;
        return r44471;
}

double f(double x, double y, double z) {
        double r44472 = x;
        double r44473 = z;
        double r44474 = -r44473;
        double r44475 = 1.0;
        double r44476 = y;
        double r44477 = r44475 * r44476;
        double r44478 = fma(r44475, r44472, r44477);
        double r44479 = fma(r44472, r44474, r44478);
        double r44480 = r44476 * r44474;
        double r44481 = r44479 + r44480;
        return r44481;
}

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(1 - z\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.0

    \[\leadsto \left(x + y\right) \cdot \color{blue}{\left(1 + \left(-z\right)\right)}\]
  4. Applied distribute-lft-in0.0

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

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

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

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

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

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

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

Reproduce

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