Average Error: 0.0 → 0.0
Time: 1.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 r28204 = x;
        double r28205 = y;
        double r28206 = r28204 + r28205;
        double r28207 = 1.0;
        double r28208 = z;
        double r28209 = r28207 - r28208;
        double r28210 = r28206 * r28209;
        return r28210;
}

double f(double x, double y, double z) {
        double r28211 = x;
        double r28212 = z;
        double r28213 = -r28212;
        double r28214 = 1.0;
        double r28215 = y;
        double r28216 = r28214 * r28215;
        double r28217 = fma(r28214, r28211, r28216);
        double r28218 = fma(r28211, r28213, r28217);
        double r28219 = r28213 * r28215;
        double r28220 = r28218 + r28219;
        return r28220;
}

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