| Alternative 1 | |
|---|---|
| Error | 0.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 0.1
Simplified0.0
[Start]0.1 | \[ \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\] |
|---|---|
associate-+l- [=>]0.1 | \[ \color{blue}{\left(x \cdot y + \frac{z \cdot t}{16}\right) - \left(\frac{a \cdot b}{4} - c\right)}
\] |
+-commutative [=>]0.1 | \[ \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right)
\] |
associate--l+ [=>]0.1 | \[ \color{blue}{\frac{z \cdot t}{16} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)}
\] |
associate-*r/ [<=]0.0 | \[ \color{blue}{z \cdot \frac{t}{16}} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)
\] |
*-commutative [<=]0.0 | \[ \color{blue}{\frac{t}{16} \cdot z} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)
\] |
*-commutative [=>]0.0 | \[ \color{blue}{z \cdot \frac{t}{16}} + \left(x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)
\] |
fma-def [=>]0.0 | \[ \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, x \cdot y - \left(\frac{a \cdot b}{4} - c\right)\right)}
\] |
associate--r- [=>]0.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(x \cdot y - \frac{a \cdot b}{4}\right) + c}\right)
\] |
+-commutative [=>]0.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{c + \left(x \cdot y - \frac{a \cdot b}{4}\right)}\right)
\] |
associate-+r- [=>]0.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(c + x \cdot y\right) - \frac{a \cdot b}{4}}\right)
\] |
sub-neg [=>]0.0 | \[ \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\left(c + x \cdot y\right) + \left(-\frac{a \cdot b}{4}\right)}\right)
\] |
+-commutative [<=]0.0 | \[ \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 [=>]0.0 | \[ \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/ [<=]0.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* [=>]0.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 [=>]0.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 [=>]0.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/ [=>]0.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* [=>]0.0 | \[ \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/ [=>]0.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 [=>]0.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 [=>]0.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 [=>]0.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 simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13632 |
| Alternative 2 | |
|---|---|
| Error | 29.8 |
| Cost | 2164 |
| Alternative 3 | |
|---|---|
| Error | 21.2 |
| Cost | 1768 |
| Alternative 4 | |
|---|---|
| Error | 21.3 |
| Cost | 1748 |
| Alternative 5 | |
|---|---|
| Error | 20.3 |
| Cost | 1488 |
| Alternative 6 | |
|---|---|
| Error | 10.1 |
| Cost | 1364 |
| Alternative 7 | |
|---|---|
| Error | 5.7 |
| Cost | 1353 |
| Alternative 8 | |
|---|---|
| Error | 8.2 |
| Cost | 1225 |
| Alternative 9 | |
|---|---|
| Error | 32.3 |
| Cost | 1112 |
| Alternative 10 | |
|---|---|
| Error | 0.1 |
| Cost | 1088 |
| Alternative 11 | |
|---|---|
| Error | 35.3 |
| Cost | 980 |
| Alternative 12 | |
|---|---|
| Error | 35.2 |
| Cost | 980 |
| Alternative 13 | |
|---|---|
| Error | 35.1 |
| Cost | 456 |
| Alternative 14 | |
|---|---|
| Error | 43.2 |
| Cost | 64 |
herbie shell --seed 2022356
(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))