| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 13632 |
\[\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 x y (fma b (* -0.25 a) (fma z (/ t 16.0) 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, fma(b, (-0.25 * a), fma(z, (t / 16.0), 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(x, y, fma(b, Float64(-0.25 * a), fma(z, Float64(t / 16.0), 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[(x * y + N[(b * N[(-0.25 * a), $MachinePrecision] + N[(z * N[(t / 16.0), $MachinePrecision] + 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(x, y, \mathsf{fma}\left(b, -0.25 \cdot a, \mathsf{fma}\left(z, \frac{t}{16}, 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)}
\] |
+-commutative [=>]99.8 | \[ \color{blue}{\left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right) + \frac{z \cdot t}{16}}
\] |
associate-+l- [=>]99.8 | \[ \color{blue}{x \cdot y - \left(\left(\frac{a \cdot b}{4} - c\right) - \frac{z \cdot t}{16}\right)}
\] |
fma-neg [=>]99.9 | \[ \color{blue}{\mathsf{fma}\left(x, y, -\left(\left(\frac{a \cdot b}{4} - c\right) - \frac{z \cdot t}{16}\right)\right)}
\] |
neg-sub0 [=>]99.9 | \[ \mathsf{fma}\left(x, y, \color{blue}{0 - \left(\left(\frac{a \cdot b}{4} - c\right) - \frac{z \cdot t}{16}\right)}\right)
\] |
associate--l- [=>]99.9 | \[ \mathsf{fma}\left(x, y, 0 - \color{blue}{\left(\frac{a \cdot b}{4} - \left(c + \frac{z \cdot t}{16}\right)\right)}\right)
\] |
associate-+l- [<=]99.9 | \[ \mathsf{fma}\left(x, y, \color{blue}{\left(0 - \frac{a \cdot b}{4}\right) + \left(c + \frac{z \cdot t}{16}\right)}\right)
\] |
neg-sub0 [<=]99.9 | \[ \mathsf{fma}\left(x, y, \color{blue}{\left(-\frac{a \cdot b}{4}\right)} + \left(c + \frac{z \cdot t}{16}\right)\right)
\] |
*-commutative [=>]99.9 | \[ \mathsf{fma}\left(x, y, \left(-\frac{\color{blue}{b \cdot a}}{4}\right) + \left(c + \frac{z \cdot t}{16}\right)\right)
\] |
associate-*r/ [<=]99.9 | \[ \mathsf{fma}\left(x, y, \left(-\color{blue}{b \cdot \frac{a}{4}}\right) + \left(c + \frac{z \cdot t}{16}\right)\right)
\] |
distribute-rgt-neg-in [=>]99.9 | \[ \mathsf{fma}\left(x, y, \color{blue}{b \cdot \left(-\frac{a}{4}\right)} + \left(c + \frac{z \cdot t}{16}\right)\right)
\] |
fma-def [=>]99.9 | \[ \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(b, -\frac{a}{4}, c + \frac{z \cdot t}{16}\right)}\right)
\] |
distribute-frac-neg [<=]99.9 | \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(b, \color{blue}{\frac{-a}{4}}, c + \frac{z \cdot t}{16}\right)\right)
\] |
neg-mul-1 [=>]99.9 | \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(b, \frac{\color{blue}{-1 \cdot a}}{4}, c + \frac{z \cdot t}{16}\right)\right)
\] |
associate-/l* [=>]99.9 | \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(b, \color{blue}{\frac{-1}{\frac{4}{a}}}, c + \frac{z \cdot t}{16}\right)\right)
\] |
associate-/r/ [=>]99.9 | \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(b, \color{blue}{\frac{-1}{4} \cdot a}, c + \frac{z \cdot t}{16}\right)\right)
\] |
metadata-eval [=>]99.9 | \[ \mathsf{fma}\left(x, y, \mathsf{fma}\left(b, \color{blue}{-0.25} \cdot a, c + \frac{z \cdot t}{16}\right)\right)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 13632 |
| Alternative 2 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 7360 |
| Alternative 3 | |
|---|---|
| Accuracy | 65.4% |
| Cost | 3048 |
| Alternative 4 | |
|---|---|
| Accuracy | 61.8% |
| Cost | 2788 |
| Alternative 5 | |
|---|---|
| Accuracy | 66.5% |
| Cost | 2528 |
| Alternative 6 | |
|---|---|
| Accuracy | 33.3% |
| Cost | 2300 |
| Alternative 7 | |
|---|---|
| Accuracy | 57.9% |
| Cost | 1880 |
| Alternative 8 | |
|---|---|
| Accuracy | 67.9% |
| Cost | 1748 |
| Alternative 9 | |
|---|---|
| Accuracy | 86.7% |
| Cost | 1745 |
| Alternative 10 | |
|---|---|
| Accuracy | 85.2% |
| Cost | 1744 |
| Alternative 11 | |
|---|---|
| Accuracy | 91.4% |
| Cost | 1352 |
| Alternative 12 | |
|---|---|
| Accuracy | 91.3% |
| Cost | 1225 |
| Alternative 13 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 1088 |
| Alternative 14 | |
|---|---|
| Accuracy | 43.9% |
| Cost | 848 |
| Alternative 15 | |
|---|---|
| Accuracy | 45.8% |
| Cost | 456 |
| Alternative 16 | |
|---|---|
| Accuracy | 32.3% |
| Cost | 64 |
herbie shell --seed 2023151
(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))