?

Average Accuracy: 99.8% → 100.0%
Time: 17.4s
Precision: binary64
Cost: 13632

?

\[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
\[\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, z \cdot 0.0625, c\right)\right) + x \cdot y \]
(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 a (* b -0.25) (fma t (* z 0.0625) c)) (* x y)))
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(a, (b * -0.25), fma(t, (z * 0.0625), c)) + (x * y);
}
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(a, Float64(b * -0.25), fma(t, Float64(z * 0.0625), c)) + Float64(x * y))
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[(a * N[(b * -0.25), $MachinePrecision] + N[(t * N[(z * 0.0625), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, z \cdot 0.0625, c\right)\right) + x \cdot y

Error?

Derivation?

  1. Initial program 99.8%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, \frac{z}{16}, c\right)\right)\right)} \]
    Proof

    [Start]99.8

    \[ \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]

    associate--l+ [=>]99.8

    \[ \color{blue}{\left(x \cdot y + \left(\frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)\right)} + c \]

    associate-+l+ [=>]99.8

    \[ \color{blue}{x \cdot y + \left(\left(\frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right) + c\right)} \]

    fma-def [=>]99.8

    \[ \color{blue}{\mathsf{fma}\left(x, y, \left(\frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right) + c\right)} \]

    +-commutative [=>]99.8

    \[ \mathsf{fma}\left(x, y, \color{blue}{c + \left(\frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)}\right) \]

    sub-neg [=>]99.8

    \[ \mathsf{fma}\left(x, y, c + \color{blue}{\left(\frac{z \cdot t}{16} + \left(-\frac{a \cdot b}{4}\right)\right)}\right) \]

    associate-+r+ [=>]99.8

    \[ \mathsf{fma}\left(x, y, \color{blue}{\left(c + \frac{z \cdot t}{16}\right) + \left(-\frac{a \cdot b}{4}\right)}\right) \]

    +-commutative [<=]99.8

    \[ \mathsf{fma}\left(x, y, \color{blue}{\left(-\frac{a \cdot b}{4}\right) + \left(c + \frac{z \cdot t}{16}\right)}\right) \]

    distribute-neg-frac [=>]99.8

    \[ \mathsf{fma}\left(x, y, \color{blue}{\frac{-a \cdot b}{4}} + \left(c + \frac{z \cdot t}{16}\right)\right) \]

    distribute-rgt-neg-in [=>]99.8

    \[ \mathsf{fma}\left(x, y, \frac{\color{blue}{a \cdot \left(-b\right)}}{4} + \left(c + \frac{z \cdot t}{16}\right)\right) \]

    associate-*r/ [<=]99.9

    \[ \mathsf{fma}\left(x, y, \color{blue}{a \cdot \frac{-b}{4}} + \left(c + \frac{z \cdot t}{16}\right)\right) \]

    fma-def [=>]99.9

    \[ \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(a, \frac{-b}{4}, c + \frac{z \cdot t}{16}\right)}\right) \]

    mul-1-neg [<=]99.9

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, \frac{\color{blue}{-1 \cdot b}}{4}, c + \frac{z \cdot t}{16}\right)\right) \]

    associate-/l* [=>]99.8

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{\frac{4}{b}}}, c + \frac{z \cdot t}{16}\right)\right) \]

    associate-/r/ [=>]99.9

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{4} \cdot b}, c + \frac{z \cdot t}{16}\right)\right) \]

    *-commutative [<=]99.9

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, \color{blue}{b \cdot \frac{-1}{4}}, c + \frac{z \cdot t}{16}\right)\right) \]

    metadata-eval [=>]99.9

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot \color{blue}{-0.25}, c + \frac{z \cdot t}{16}\right)\right) \]

    +-commutative [=>]99.9

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\frac{z \cdot t}{16} + c}\right)\right) \]

    associate-*l/ [<=]100.0

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\frac{z}{16} \cdot t} + c\right)\right) \]

    *-commutative [=>]100.0

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{t \cdot \frac{z}{16}} + c\right)\right) \]

    fma-def [=>]100.0

    \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot -0.25, \color{blue}{\mathsf{fma}\left(t, \frac{z}{16}, c\right)}\right)\right) \]
  3. Applied egg-rr100.0%

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

    [Start]100.0

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

    fma-udef [=>]100.0

    \[ \color{blue}{x \cdot y + \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, \frac{z}{16}, c\right)\right)} \]

    +-commutative [=>]100.0

    \[ \color{blue}{\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, \frac{z}{16}, c\right)\right) + x \cdot y} \]

    div-inv [=>]100.0

    \[ \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, \color{blue}{z \cdot \frac{1}{16}}, c\right)\right) + x \cdot y \]

    metadata-eval [=>]100.0

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

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

Alternatives

Alternative 1
Accuracy63.5%
Cost2528
\[\begin{array}{l} t_1 := c + 0.0625 \cdot \left(t \cdot z\right)\\ t_2 := c + x \cdot y\\ t_3 := -0.25 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;a \cdot b \leq -1.3 \cdot 10^{+101}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -2.3 \cdot 10^{-124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq -3.7 \cdot 10^{-308}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 4.3 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.5 \cdot 10^{-59}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 3.05 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 1.95 \cdot 10^{+65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 5.6 \cdot 10^{+158}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Accuracy44.9%
Cost2300
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ t_2 := -0.25 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;c \leq -3.2 \cdot 10^{+46}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -7.2 \cdot 10^{-78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.9 \cdot 10^{-173}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq -5.4 \cdot 10^{-226}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.9 \cdot 10^{-299}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 7.7 \cdot 10^{-205}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 1.2 \cdot 10^{-164}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 4 \cdot 10^{-148}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 9.6 \cdot 10^{-94}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 3.05 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 4 \cdot 10^{-39}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 3.6 \cdot 10^{-24}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 3
Accuracy69.2%
Cost2268
\[\begin{array}{l} t_1 := c + x \cdot y\\ t_2 := c + 0.0625 \cdot \left(t \cdot z\right)\\ t_3 := c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+50}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-123}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-308}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 10^{+27}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 4
Accuracy68.5%
Cost2268
\[\begin{array}{l} t_1 := c + x \cdot y\\ t_2 := 0.0625 \cdot \left(t \cdot z\right)\\ t_3 := c + t_2\\ t_4 := c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+54}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-43}:\\ \;\;\;\;t_2 + x \cdot y\\ \mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-123}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-308}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-154}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \cdot b \leq 10^{+27}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 5
Accuracy52.0%
Cost1508
\[\begin{array}{l} t_1 := -0.25 \cdot \left(a \cdot b\right)\\ t_2 := 0.0625 \cdot \left(t \cdot z\right)\\ t_3 := c + x \cdot y\\ \mathbf{if}\;c \leq -2.7 \cdot 10^{+44}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq -9 \cdot 10^{-81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -7 \cdot 10^{-192}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq -1.35 \cdot 10^{-226}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -2.3 \cdot 10^{-299}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.25 \cdot 10^{-204}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 1.35 \cdot 10^{-164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.3 \cdot 10^{-150}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 3.1 \cdot 10^{-112}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 6
Accuracy66.9%
Cost1500
\[\begin{array}{l} t_1 := x \cdot y + -0.25 \cdot \left(a \cdot b\right)\\ t_2 := 0.0625 \cdot \left(t \cdot z\right)\\ t_3 := t_2 + x \cdot y\\ \mathbf{if}\;c \leq -3 \cdot 10^{+47}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;c \leq -7.6 \cdot 10^{-227}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq -8 \cdot 10^{-307}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{-203}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq 1.35 \cdot 10^{-164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.4 \cdot 10^{-105}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;c \leq 5.6 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c + t_2\\ \end{array} \]
Alternative 7
Accuracy44.9%
Cost1376
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{if}\;c \leq -2.3 \cdot 10^{+54}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -3.5 \cdot 10^{-81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.3 \cdot 10^{-181}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-295}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.8 \cdot 10^{-148}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 7.5 \cdot 10^{-112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 1.18 \cdot 10^{-23}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 2 \cdot 10^{+57}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 8
Accuracy91.7%
Cost1353
\[\begin{array}{l} t_1 := 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+50} \lor \neg \left(a \cdot b \leq 10^{+42}\right):\\ \;\;\;\;\left(c + t_1\right) + -0.25 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(t_1 + x \cdot y\right)\\ \end{array} \]
Alternative 9
Accuracy87.5%
Cost1225
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -1.1 \cdot 10^{+78} \lor \neg \left(a \cdot b \leq 10^{+42}\right):\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)\\ \end{array} \]
Alternative 10
Accuracy91.1%
Cost1225
\[\begin{array}{l} \mathbf{if}\;a \cdot b \leq -100000 \lor \neg \left(a \cdot b \leq 10^{+27}\right):\\ \;\;\;\;\left(c + x \cdot y\right) + -0.25 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)\\ \end{array} \]
Alternative 11
Accuracy99.8%
Cost1088
\[c + \left(\left(\frac{t \cdot z}{16} + x \cdot y\right) - \frac{a \cdot b}{4}\right) \]
Alternative 12
Accuracy44.4%
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -7.4 \cdot 10^{+15}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 1.2 \cdot 10^{-11}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 13
Accuracy31.9%
Cost64
\[c \]

Error

Reproduce?

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