Average Error: 0.0 → 0.0
Time: 1.6s
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 r29637 = x;
        double r29638 = y;
        double r29639 = r29637 + r29638;
        double r29640 = 1.0;
        double r29641 = z;
        double r29642 = r29640 - r29641;
        double r29643 = r29639 * r29642;
        return r29643;
}

double f(double x, double y, double z) {
        double r29644 = 1.0;
        double r29645 = x;
        double r29646 = y;
        double r29647 = r29644 * r29646;
        double r29648 = fma(r29644, r29645, r29647);
        double r29649 = z;
        double r29650 = -r29649;
        double r29651 = r29650 * r29645;
        double r29652 = r29650 * r29646;
        double r29653 = r29651 + r29652;
        double r29654 = r29648 + r29653;
        return r29654;
}

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