Average Error: 0.0 → 0.0
Time: 1.2s
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 r24112 = x;
        double r24113 = y;
        double r24114 = r24112 + r24113;
        double r24115 = 1.0;
        double r24116 = z;
        double r24117 = r24115 - r24116;
        double r24118 = r24114 * r24117;
        return r24118;
}

double f(double x, double y, double z) {
        double r24119 = 1.0;
        double r24120 = x;
        double r24121 = y;
        double r24122 = r24119 * r24121;
        double r24123 = fma(r24119, r24120, r24122);
        double r24124 = z;
        double r24125 = -r24124;
        double r24126 = r24125 * r24120;
        double r24127 = r24125 * r24121;
        double r24128 = r24126 + r24127;
        double r24129 = r24123 + r24128;
        return r24129;
}

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