| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 13632 |
\[\mathsf{fma}\left(x, y, \mathsf{fma}\left(t, \frac{z}{16}, c - a \cdot \frac{b}{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 z (/ t 16.0) (fma b (* -0.25 a) (fma x y 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(z, (t / 16.0), fma(b, (-0.25 * a), fma(x, y, 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 fma(z, Float64(t / 16.0), fma(b, Float64(-0.25 * a), fma(x, y, 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[(z * N[(t / 16.0), $MachinePrecision] + N[(b * N[(-0.25 * a), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, -0.25 \cdot a, \mathsf{fma}\left(x, y, c\right)\right)\right)
Initial program 99.8%
Simplified100.0%
[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 + \frac{z \cdot t}{16}\right) - \left(\frac{a \cdot b}{4} - c\right)}
\] |
+-commutative [=>]99.8 | \[ \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right)
\] |
associate--l+ [=>]99.8 | \[ \color{blue}{\frac{z \cdot t}{16} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)}
\] |
associate-*r/ [<=]99.9 | \[ \color{blue}{z \cdot \frac{t}{16}} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)
\] |
*-commutative [<=]99.9 | \[ \color{blue}{\frac{t}{16} \cdot z} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)
\] |
*-commutative [=>]99.9 | \[ \color{blue}{z \cdot \frac{t}{16}} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)
\] |
fma-def [=>]99.9 | \[ \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)}
\] |
associate--r- [=>]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(x \cdot y - \frac{a \cdot b}{4}\right) + c}\right)
\] |
+-commutative [=>]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{c + \left(x \cdot y - \frac{a \cdot b}{4}\right)}\right)
\] |
associate-+r- [=>]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(c + x \cdot y\right) - \frac{a \cdot b}{4}}\right)
\] |
sub-neg [=>]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(c + x \cdot y\right) + \left(-\frac{a \cdot b}{4}\right)}\right)
\] |
+-commutative [<=]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(-\frac{a \cdot b}{4}\right) + \left(c + x \cdot y\right)}\right)
\] |
neg-mul-1 [=>]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{-1 \cdot \frac{a \cdot b}{4}} + \left(c + x \cdot y\right)\right)
\] |
associate-*l/ [<=]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, -1 \cdot \color{blue}{\left(\frac{a}{4} \cdot b\right)} + \left(c + x \cdot y\right)\right)
\] |
associate-*r* [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(-1 \cdot \frac{a}{4}\right) \cdot b} + \left(c + x \cdot y\right)\right)
\] |
*-commutative [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{b \cdot \left(-1 \cdot \frac{a}{4}\right)} + \left(c + x \cdot y\right)\right)
\] |
fma-def [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\mathsf{fma}\left(b, -1 \cdot \frac{a}{4}, c + x \cdot y\right)}\right)
\] |
associate-*r/ [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, \color{blue}{\frac{-1 \cdot a}{4}}, c + x \cdot y\right)\right)
\] |
associate-/l* [=>]99.9 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, \color{blue}{\frac{-1}{\frac{4}{a}}}, c + x \cdot y\right)\right)
\] |
associate-/r/ [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, \color{blue}{\frac{-1}{4} \cdot a}, c + x \cdot y\right)\right)
\] |
metadata-eval [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, \color{blue}{-0.25} \cdot a, c + x \cdot y\right)\right)
\] |
+-commutative [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, -0.25 \cdot a, \color{blue}{x \cdot y + c}\right)\right)
\] |
fma-def [=>]100.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \mathsf{fma}\left(b, -0.25 \cdot a, \color{blue}{\mathsf{fma}\left(x, y, c\right)}\right)\right)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 13632 |
| Alternative 2 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 7424 |
| Alternative 3 | |
|---|---|
| Accuracy | 67.5% |
| Cost | 1876 |
| Alternative 4 | |
|---|---|
| Accuracy | 63.8% |
| Cost | 1748 |
| Alternative 5 | |
|---|---|
| Accuracy | 68.3% |
| Cost | 1748 |
| Alternative 6 | |
|---|---|
| Accuracy | 90.8% |
| Cost | 1225 |
| Alternative 7 | |
|---|---|
| Accuracy | 87.3% |
| Cost | 1224 |
| Alternative 8 | |
|---|---|
| Accuracy | 43.1% |
| Cost | 1112 |
| Alternative 9 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 1088 |
| Alternative 10 | |
|---|---|
| Accuracy | 44.2% |
| Cost | 980 |
| Alternative 11 | |
|---|---|
| Accuracy | 64.8% |
| Cost | 841 |
| Alternative 12 | |
|---|---|
| Accuracy | 45.2% |
| Cost | 456 |
| Alternative 13 | |
|---|---|
| Accuracy | 32.1% |
| Cost | 64 |
herbie shell --seed 2023122
(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))