?

Average Accuracy: 99.9% → 100.0%
Time: 13.3s
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(t, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\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 (/ z 16.0) (fma x y (- c (* b (/ a 4.0))))))
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, (z / 16.0), fma(x, y, (c - (b * (a / 4.0)))));
}
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 fma(t, Float64(z / 16.0), fma(x, y, Float64(c - Float64(b * Float64(a / 4.0)))))
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[(t * N[(z / 16.0), $MachinePrecision] + N[(x * y + N[(c - N[(b * N[(a / 4.0), $MachinePrecision]), $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, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\right)\right)

Error?

Derivation?

  1. Initial program 99.9%

    \[\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(t, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\right)\right)} \]
    Proof

    [Start]99.9

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

    associate-+l- [=>]99.9

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

    +-commutative [=>]99.9

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

    associate--l+ [=>]99.9

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

    associate-*l/ [<=]99.9

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

    *-commutative [=>]99.9

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

    fma-def [=>]99.9

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

    fma-neg [=>]99.9

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

    neg-sub0 [=>]99.9

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

    associate-+l- [<=]99.9

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

    neg-sub0 [<=]99.9

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

    +-commutative [=>]99.9

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

    unsub-neg [=>]99.9

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

    *-commutative [=>]99.9

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

    associate-*r/ [<=]100.0

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

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

Alternatives

Alternative 1
Accuracy67.9%
Cost1748
\[\begin{array}{l} t_1 := c + t \cdot \left(z \cdot 0.0625\right)\\ t_2 := c + a \cdot \left(b \cdot -0.25\right)\\ t_3 := c + x \cdot y\\ \mathbf{if}\;b \cdot a \leq -5 \cdot 10^{+53}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \cdot a \leq -1.2 \cdot 10^{-60}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \cdot a \leq 10^{-43}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \cdot a \leq 2000000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+62}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Accuracy66.1%
Cost1368
\[\begin{array}{l} t_1 := x \cdot y - \left(b \cdot a\right) \cdot 0.25\\ t_2 := c + t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{if}\;c \leq -3.9 \cdot 10^{-57}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -2.2 \cdot 10^{-234}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-282}:\\ \;\;\;\;x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{elif}\;c \leq 7.2 \cdot 10^{-47}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.05 \cdot 10^{+18}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq 1.4 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
Alternative 3
Accuracy90.8%
Cost1352
\[\begin{array}{l} t_1 := \left(b \cdot a\right) \cdot 0.25\\ t_2 := 0.0625 \cdot \left(t \cdot z\right)\\ \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54}:\\ \;\;\;\;\left(c + x \cdot y\right) - t_1\\ \mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+84}:\\ \;\;\;\;c + \left(x \cdot y + t_2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(c + t_2\right) - t_1\\ \end{array} \]
Alternative 4
Accuracy86.7%
Cost1225
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54} \lor \neg \left(b \cdot a \leq 2 \cdot 10^{+136}\right):\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\right)\\ \end{array} \]
Alternative 5
Accuracy91.4%
Cost1225
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54} \lor \neg \left(b \cdot a \leq 2000000000000\right):\\ \;\;\;\;\left(c + x \cdot y\right) - \left(b \cdot a\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\right)\\ \end{array} \]
Alternative 6
Accuracy44.2%
Cost1116
\[\begin{array}{l} t_1 := t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{if}\;c \leq -0.00335:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -2.6 \cdot 10^{-73}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.55 \cdot 10^{-214}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq -1.18 \cdot 10^{-275}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.9 \cdot 10^{-199}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-61}:\\ \;\;\;\;\left(b \cdot a\right) \cdot -0.25\\ \mathbf{elif}\;c \leq 1.55 \cdot 10^{+92}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 7
Accuracy99.9%
Cost1088
\[c + \left(\left(\frac{t \cdot z}{16} + x \cdot y\right) - \frac{b \cdot a}{4}\right) \]
Alternative 8
Accuracy67.8%
Cost969
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54} \lor \neg \left(b \cdot a \leq 5 \cdot 10^{+62}\right):\\ \;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
Alternative 9
Accuracy44.1%
Cost852
\[\begin{array}{l} t_1 := t \cdot \left(z \cdot 0.0625\right)\\ \mathbf{if}\;c \leq -1.35:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq -2.3 \cdot 10^{-73}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -4.2 \cdot 10^{-214}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;c \leq -2.65 \cdot 10^{-275}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.7 \cdot 10^{+88}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 10
Accuracy63.0%
Cost841
\[\begin{array}{l} \mathbf{if}\;b \cdot a \leq -4.8 \cdot 10^{+98} \lor \neg \left(b \cdot a \leq 2.35 \cdot 10^{+111}\right):\\ \;\;\;\;\left(b \cdot a\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
Alternative 11
Accuracy43.8%
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -1.85 \cdot 10^{-54}:\\ \;\;\;\;c\\ \mathbf{elif}\;c \leq 2.3 \cdot 10^{+87}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
Alternative 12
Accuracy31.9%
Cost64
\[c \]

Error

Reproduce?

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