Average Error: 0.0 → 0.0
Time: 5.8s
Precision: 64
\[x \cdot y - z \cdot t\]
\[\mathsf{fma}\left(x, y, -t \cdot z\right)\]
x \cdot y - z \cdot t
\mathsf{fma}\left(x, y, -t \cdot z\right)
double f(double x, double y, double z, double t) {
        double r79266 = x;
        double r79267 = y;
        double r79268 = r79266 * r79267;
        double r79269 = z;
        double r79270 = t;
        double r79271 = r79269 * r79270;
        double r79272 = r79268 - r79271;
        return r79272;
}

double f(double x, double y, double z, double t) {
        double r79273 = x;
        double r79274 = y;
        double r79275 = t;
        double r79276 = z;
        double r79277 = r79275 * r79276;
        double r79278 = -r79277;
        double r79279 = fma(r79273, r79274, r79278);
        return r79279;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 0.0

    \[x \cdot y - z \cdot t\]
  2. Using strategy rm
  3. Applied fma-neg0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}\]
  4. Simplified0.0

    \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{-t \cdot z}\right)\]
  5. Final simplification0.0

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

Reproduce

herbie shell --seed 2019198 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.V3:cross from linear-1.19.1.3"
  (- (* x y) (* z t)))