Average Error: 0.1 → 0.0
Time: 22.5s
Precision: binary64
Cost: 7360
\[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
\[\mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right) + \left(c + a \cdot \left(b \cdot -0.25\right)\right) \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
(FPCore (x y z t a b c)
 :precision binary64
 (+ (fma (* t 0.0625) z (* x y)) (+ c (* a (* b -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
double code(double x, double y, double z, double t, double a, double b, double c) {
	return fma((t * 0.0625), z, (x * y)) + (c + (a * (b * -0.25)));
}
function code(x, y, z, t, a, b, c)
	return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c)
end
function code(x, y, z, t, a, b, c)
	return Float64(fma(Float64(t * 0.0625), z, Float64(x * y)) + Float64(c + Float64(a * Float64(b * -0.25))))
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right) + \left(c + a \cdot \left(b \cdot -0.25\right)\right)

Error

Derivation

  1. Initial program 0.1

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Applied egg-rr0.1

    \[\leadsto \left(\left(x \cdot y + \color{blue}{z \cdot \frac{1}{\frac{16}{t}}}\right) - \frac{a \cdot b}{4}\right) + c \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right) - \left(a \cdot \left(b \cdot 0.25\right) - c\right)} \]
  4. Final simplification0.0

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

Alternatives

Alternative 1
Error26.3
Cost2820
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ t_2 := c + t_1\\ t_3 := t_1 + x \cdot y\\ t_4 := c + x \cdot y\\ t_5 := c - 0.25 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;b \leq -1.2987453547291494 \cdot 10^{-86}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq -5.364182254767133 \cdot 10^{-149}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq -1.2946100271417533 \cdot 10^{-173}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq -4.12864049024514 \cdot 10^{-261}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 7.384472346071348 \cdot 10^{-245}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;b \leq 9.190712936077055 \cdot 10^{-203}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 3.821531832807862 \cdot 10^{-164}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 1.3911728253042036 \cdot 10^{-77}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 1.8837413499125972 \cdot 10^{-44}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;b \leq 3.4758380748173857 \cdot 10^{-19}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 2.706009555921357 \cdot 10^{+36}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq 1.9024280512488363 \cdot 10^{+42}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{+58}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+89}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{+157}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{+179}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 10^{+183}:\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;t_5\\ \end{array} \]
Alternative 2
Error26.1
Cost2424
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ t_2 := c + t_1\\ t_3 := t_1 + x \cdot y\\ t_4 := c + x \cdot y\\ t_5 := c - 0.25 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;b \leq -1.2987453547291494 \cdot 10^{-86}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq -5.364182254767133 \cdot 10^{-149}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq -1.2946100271417533 \cdot 10^{-173}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq -4.12864049024514 \cdot 10^{-261}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 7.384472346071348 \cdot 10^{-245}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;b \leq 9.190712936077055 \cdot 10^{-203}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 3.821531832807862 \cdot 10^{-164}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 1.3911728253042036 \cdot 10^{-77}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 1.8837413499125972 \cdot 10^{-44}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;b \leq 3.4758380748173857 \cdot 10^{-19}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 2.706009555921357 \cdot 10^{+36}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq 1.9024280512488363 \cdot 10^{+42}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{+58}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+89}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_5\\ \end{array} \]
Alternative 3
Error21.6
Cost1496
\[\begin{array}{l} t_1 := z \cdot \left(t \cdot 0.0625\right) - 0.25 \cdot \left(a \cdot b\right)\\ t_2 := 0.0625 \cdot \left(t \cdot z\right)\\ t_3 := c + t_2\\ t_4 := x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{if}\;c \leq -3.28232405770701 \cdot 10^{+39}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq -3.716056712115128 \cdot 10^{-92}:\\ \;\;\;\;t_2 + x \cdot y\\ \mathbf{elif}\;c \leq 2.0557031136162108 \cdot 10^{-249}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;c \leq 3.292461836243325 \cdot 10^{-92}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 0.7191279938191585:\\ \;\;\;\;t_4\\ \mathbf{elif}\;c \leq 1.9913662539765917 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 4
Error20.1
Cost1488
\[\begin{array}{l} t_1 := c + 0.0625 \cdot \left(t \cdot z\right)\\ t_2 := c - 0.25 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-199}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-211}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 10^{+58}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error6.0
Cost1352
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ t_2 := \left(c + t_1\right) - 0.25 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{-37}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 10^{-57}:\\ \;\;\;\;c + \left(t_1 + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error9.8
Cost1232
\[\begin{array}{l} t_1 := c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+105}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.29423652477263 \cdot 10^{+73}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right) - 0.25 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq -20662836900509.79:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.9632342818096837 \cdot 10^{-90}:\\ \;\;\;\;\left(c + x \cdot y\right) + \left(a \cdot b\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error8.7
Cost1224
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+164}:\\ \;\;\;\;c - 0.25 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+104}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + \left(a \cdot b\right) \cdot -0.25\\ \end{array} \]
Alternative 8
Error32.1
Cost1112
\[\begin{array}{l} t_1 := c + x \cdot y\\ t_2 := z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{if}\;z \leq -1.12 \cdot 10^{+136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+110}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.99079298141293 \cdot 10^{+69}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.7083445663031756 \cdot 10^{-203}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.5827221426213424 \cdot 10^{-163}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;z \leq 1.0049222002112832 \cdot 10^{-100}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error0.0
Cost1088
\[c + \left(\left(t \cdot \frac{z}{16} + x \cdot y\right) - \frac{a \cdot b}{4}\right) \]
Alternative 10
Error25.0
Cost976
\[\begin{array}{l} t_1 := c + x \cdot y\\ t_2 := c + 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{if}\;z \leq -1.6976854288864487 \cdot 10^{-12}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.7083445663031756 \cdot 10^{-203}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.5827221426213424 \cdot 10^{-163}:\\ \;\;\;\;b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;z \leq 1.5025986277931082 \cdot 10^{-127}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 11
Error31.2
Cost848
\[\begin{array}{l} t_1 := c + x \cdot y\\ t_2 := z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{if}\;z \leq -1.12 \cdot 10^{+136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+110}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.99079298141293 \cdot 10^{+69}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.0049222002112832 \cdot 10^{-100}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 12
Error35.5
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -3.28232405770701 \cdot 10^{+39}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 7.332192028611549 \cdot 10^{+46}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 13
Error29.6
Cost320
\[c + x \cdot y \]
Alternative 14
Error43.6
Cost64
\[c \]

Error

Reproduce

herbie shell --seed 2022308 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, C"
  :precision binary64
  (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))