Average Error: 0.0 → 0.0
Time: 2.4s
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) + \left(-z\right) \cdot y\]
\left(x + y\right) \cdot \left(1 - z\right)
\mathsf{fma}\left(x, -z, \mathsf{fma}\left(1, x, 1 \cdot y\right)\right) + \left(-z\right) \cdot y
double f(double x, double y, double z) {
        double r41514 = x;
        double r41515 = y;
        double r41516 = r41514 + r41515;
        double r41517 = 1.0;
        double r41518 = z;
        double r41519 = r41517 - r41518;
        double r41520 = r41516 * r41519;
        return r41520;
}

double f(double x, double y, double z) {
        double r41521 = x;
        double r41522 = z;
        double r41523 = -r41522;
        double r41524 = 1.0;
        double r41525 = y;
        double r41526 = r41524 * r41525;
        double r41527 = fma(r41524, r41521, r41526);
        double r41528 = fma(r41521, r41523, r41527);
        double r41529 = r41523 * r41525;
        double r41530 = r41528 + r41529;
        return r41530;
}

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

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

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

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

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

Reproduce

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