Average Error: 0.0 → 0.0
Time: 1.3s
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 r35197 = x;
        double r35198 = y;
        double r35199 = r35197 + r35198;
        double r35200 = 1.0;
        double r35201 = z;
        double r35202 = r35200 - r35201;
        double r35203 = r35199 * r35202;
        return r35203;
}

double f(double x, double y, double z) {
        double r35204 = x;
        double r35205 = z;
        double r35206 = -r35205;
        double r35207 = 1.0;
        double r35208 = y;
        double r35209 = r35207 * r35208;
        double r35210 = fma(r35207, r35204, r35209);
        double r35211 = fma(r35204, r35206, r35210);
        double r35212 = r35206 * r35208;
        double r35213 = r35211 + r35212;
        return r35213;
}

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