Average Error: 2.7 → 1.3
Time: 3.7s
Precision: binary64
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
\[\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\right) \]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\right)
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
(FPCore (x y z t a b c i)
 :precision binary64
 (fma c i (fma a b (fma t z (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(c, i, fma(a, b, fma(t, z, (y * x))));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus i

Derivation

  1. Initial program 2.7

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Simplified1.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)} \]
  3. Applied add-sqr-sqrt_binary6432.8

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \color{blue}{\sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)} \cdot \sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)}}\right)\right) \]
  4. Applied *-un-lft-identity_binary6432.8

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \sqrt{\color{blue}{1 \cdot \mathsf{fma}\left(x, y, z \cdot t\right)}} \cdot \sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)}\right)\right) \]
  5. Applied sqrt-prod_binary6432.8

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \color{blue}{\left(\sqrt{1} \cdot \sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)}\right)} \cdot \sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)}\right)\right) \]
  6. Applied associate-*l*_binary6432.8

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \color{blue}{\sqrt{1} \cdot \left(\sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)} \cdot \sqrt{\mathsf{fma}\left(x, y, z \cdot t\right)}\right)}\right)\right) \]
  7. Simplified1.3

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \sqrt{1} \cdot \color{blue}{\mathsf{fma}\left(t, z, y \cdot x\right)}\right)\right) \]
  8. Final simplification1.3

    \[\leadsto \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\right) \]

Reproduce

herbie shell --seed 2022088 
(FPCore (x y z t a b c i)
  :name "Linear.V4:$cdot from linear-1.19.1.3, C"
  :precision binary64
  (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))