| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
\[x \cdot \cos y - \sin y \cdot z
\]
(FPCore (x y z) :precision binary64 (- (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (fma (sin y) (- z) (* x (cos y))))
double code(double x, double y, double z) {
return (x * cos(y)) - (z * sin(y));
}
double code(double x, double y, double z) {
return fma(sin(y), -z, (x * cos(y)));
}
function code(x, y, z) return Float64(Float64(x * cos(y)) - Float64(z * sin(y))) end
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x * cos(y))) end
code[x_, y_, z_] := N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \cos y - z \cdot \sin y
\mathsf{fma}\left(\sin y, -z, x \cdot \cos y\right)
Initial program 99.8%
Applied egg-rr99.8%
[Start]99.8 | \[ x \cdot \cos y - z \cdot \sin y
\] |
|---|---|
sub-neg [=>]99.8 | \[ \color{blue}{x \cdot \cos y + \left(-z \cdot \sin y\right)}
\] |
+-commutative [=>]99.8 | \[ \color{blue}{\left(-z \cdot \sin y\right) + x \cdot \cos y}
\] |
*-commutative [=>]99.8 | \[ \left(-\color{blue}{\sin y \cdot z}\right) + x \cdot \cos y
\] |
distribute-rgt-neg-in [=>]99.8 | \[ \color{blue}{\sin y \cdot \left(-z\right)} + x \cdot \cos y
\] |
fma-def [=>]99.8 | \[ \color{blue}{\mathsf{fma}\left(\sin y, -z, x \cdot \cos y\right)}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
| Alternative 2 | |
|---|---|
| Accuracy | 74.9% |
| Cost | 7316 |
| Alternative 3 | |
|---|---|
| Accuracy | 74.9% |
| Cost | 7316 |
| Alternative 4 | |
|---|---|
| Accuracy | 86.1% |
| Cost | 6985 |
| Alternative 5 | |
|---|---|
| Accuracy | 74.8% |
| Cost | 6857 |
| Alternative 6 | |
|---|---|
| Accuracy | 41.6% |
| Cost | 520 |
| Alternative 7 | |
|---|---|
| Accuracy | 52.3% |
| Cost | 320 |
| Alternative 8 | |
|---|---|
| Accuracy | 39.1% |
| Cost | 64 |
herbie shell --seed 2023146
(FPCore (x y z)
:name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, A"
:precision binary64
(- (* x (cos y)) (* z (sin y))))