Average Error: 0.1 → 0.1
Time: 14.6s
Precision: binary64
Cost: 7360
\[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
\[\left(\mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right) + z \cdot \left(t \cdot 0.0625\right)\right) + c \]
(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 x y (* (* a b) -0.25)) (* z (* t 0.0625))) c))
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(x, y, ((a * b) * -0.25)) + (z * (t * 0.0625))) + c;
}
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(Float64(fma(x, y, Float64(Float64(a * b) * -0.25)) + Float64(z * Float64(t * 0.0625))) + c)
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[(x * y + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\left(\mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right) + z \cdot \left(t \cdot 0.0625\right)\right) + c

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 \color{blue}{\left(z \cdot \left(t \cdot 0.0625\right) + \mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right)\right)} + c \]
  3. Final simplification0.1

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

Alternatives

Alternative 1
Error31.1
Cost1768
\[\begin{array}{l} t_1 := \left(a \cdot b\right) \cdot -0.25\\ t_2 := c + z \cdot \left(t \cdot 0.0625\right)\\ t_3 := c + x \cdot y\\ \mathbf{if}\;a \leq -5.2 \cdot 10^{+225}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -3.8 \cdot 10^{+164}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{+148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{+112}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -2.3 \cdot 10^{+82}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq -2.471107756728202 \cdot 10^{+32}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -7.362954760483954 \cdot 10^{-71}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 6.306334043006772 \cdot 10^{-226}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 3.768756689219377 \cdot 10^{-108}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 2.6715433241117683 \cdot 10^{-52}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error21.7
Cost1488
\[\begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{if}\;a \cdot b \leq -0.004:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 10^{-276}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{-107}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right) + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+132}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error36.2
Cost1376
\[\begin{array}{l} t_1 := \left(a \cdot b\right) \cdot -0.25\\ t_2 := 0.0625 \cdot \left(z \cdot t\right)\\ \mathbf{if}\;c \leq -2.5782063796243405 \cdot 10^{+79}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -1.4465633422366057 \cdot 10^{-79}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.9809121217740214 \cdot 10^{-205}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq -5.060133980753096 \cdot 10^{-213}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.405 \cdot 10^{-251}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 1.1646438868516092 \cdot 10^{-138}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 1.8164749068948907 \cdot 10^{-135}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 2.1310447316832408 \cdot 10^{+95}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 4
Error20.8
Cost1228
\[\begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{if}\;a \cdot b \leq -0.004:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-201}:\\ \;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+132}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error8.4
Cost1224
\[\begin{array}{l} t_1 := c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+145}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error6.2
Cost1224
\[\begin{array}{l} t_1 := c + \left(x \cdot y + \left(a \cdot b\right) \cdot -0.25\right)\\ \mathbf{if}\;a \cdot b \leq -4000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-37}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(z \cdot t\right) + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error6.3
Cost1224
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(z \cdot t\right)\\ t_2 := \left(a \cdot b\right) \cdot -0.25\\ \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{-40}:\\ \;\;\;\;c + \left(t_1 + t_2\right)\\ \mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-37}:\\ \;\;\;\;c + \left(t_1 + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + t_2\right)\\ \end{array} \]
Alternative 8
Error36.0
Cost1112
\[\begin{array}{l} t_1 := \left(a \cdot b\right) \cdot -0.25\\ \mathbf{if}\;c \leq -2.5782063796243405 \cdot 10^{+79}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -1.4465633422366057 \cdot 10^{-79}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.9809121217740214 \cdot 10^{-205}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 2.4079706131776403 \cdot 10^{-251}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 1.8827461551199224 \cdot 10^{-81}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 2.1310447316832408 \cdot 10^{+95}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 9
Error0.1
Cost1088
\[c + \left(\left(\frac{z \cdot t}{16} + x \cdot y\right) - \frac{a \cdot b}{4}\right) \]
Alternative 10
Error24.1
Cost840
\[\begin{array}{l} t_1 := \left(a \cdot b\right) \cdot -0.25\\ \mathbf{if}\;a \cdot b \leq -2099715899163.9316:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.8502545911314142 \cdot 10^{+132}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error35.9
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -7.749278650994567 \cdot 10^{+101}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 3.152139323994346 \cdot 10^{+48}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 12
Error43.6
Cost64
\[c \]

Error

Reproduce

herbie shell --seed 2022295 
(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))