Average Error: 0.0 → 0.0
Time: 3.1s
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 r55068 = x;
        double r55069 = y;
        double r55070 = r55068 + r55069;
        double r55071 = 1.0;
        double r55072 = z;
        double r55073 = r55071 - r55072;
        double r55074 = r55070 * r55073;
        return r55074;
}

double f(double x, double y, double z) {
        double r55075 = x;
        double r55076 = z;
        double r55077 = -r55076;
        double r55078 = 1.0;
        double r55079 = y;
        double r55080 = r55078 * r55079;
        double r55081 = fma(r55078, r55075, r55080);
        double r55082 = fma(r55075, r55077, r55081);
        double r55083 = r55079 * r55077;
        double r55084 = r55082 + r55083;
        return r55084;
}

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