Average Error: 0.0 → 0.0
Time: 1.3s
Precision: 64
\[\left(x + y\right) \cdot \left(1 - z\right)\]
\[\mathsf{fma}\left(1, x, 1 \cdot y\right) + \left(\left(-z\right) \cdot x + \left(-z\right) \cdot y\right)\]
\left(x + y\right) \cdot \left(1 - z\right)
\mathsf{fma}\left(1, x, 1 \cdot y\right) + \left(\left(-z\right) \cdot x + \left(-z\right) \cdot y\right)
double f(double x, double y, double z) {
        double r38511 = x;
        double r38512 = y;
        double r38513 = r38511 + r38512;
        double r38514 = 1.0;
        double r38515 = z;
        double r38516 = r38514 - r38515;
        double r38517 = r38513 * r38516;
        return r38517;
}

double f(double x, double y, double z) {
        double r38518 = 1.0;
        double r38519 = x;
        double r38520 = y;
        double r38521 = r38518 * r38520;
        double r38522 = fma(r38518, r38519, r38521);
        double r38523 = z;
        double r38524 = -r38523;
        double r38525 = r38524 * r38519;
        double r38526 = r38524 * r38520;
        double r38527 = r38525 + r38526;
        double r38528 = r38522 + r38527;
        return r38528;
}

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. Final simplification0.0

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

Reproduce

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