| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
\[x \cdot \cos y - z \cdot \sin y
\]
(FPCore (x y z) :precision binary64 (- (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (+ (fma (- z) (sin y) t_0) (- (* x (cos y)) t_0))))
double code(double x, double y, double z) {
return (x * cos(y)) - (z * sin(y));
}
double code(double x, double y, double z) {
double t_0 = z * sin(y);
return fma(-z, sin(y), t_0) + ((x * cos(y)) - t_0);
}
function code(x, y, z) return Float64(Float64(x * cos(y)) - Float64(z * sin(y))) end
function code(x, y, z) t_0 = Float64(z * sin(y)) return Float64(fma(Float64(-z), sin(y), t_0) + Float64(Float64(x * cos(y)) - t_0)) 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_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, N[(N[((-z) * N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision] + N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]]
x \cdot \cos y - z \cdot \sin y
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathsf{fma}\left(-z, \sin y, t_0\right) + \left(x \cdot \cos y - t_0\right)
\end{array}
Initial program 99.8%
Applied egg-rr99.8%
[Start]99.8 | \[ x \cdot \cos y - z \cdot \sin y
\] |
|---|---|
*-commutative [=>]99.8 | \[ x \cdot \cos y - \color{blue}{\sin y \cdot z}
\] |
prod-diff [=>]99.8 | \[ \color{blue}{\mathsf{fma}\left(x, \cos y, -z \cdot \sin y\right) + \mathsf{fma}\left(-z, \sin y, z \cdot \sin y\right)}
\] |
fma-neg [<=]99.8 | \[ \color{blue}{\left(x \cdot \cos y - z \cdot \sin y\right)} + \mathsf{fma}\left(-z, \sin y, z \cdot \sin y\right)
\] |
+-commutative [=>]99.8 | \[ \color{blue}{\mathsf{fma}\left(-z, \sin y, z \cdot \sin y\right) + \left(x \cdot \cos y - z \cdot \sin y\right)}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13248 |
| Alternative 2 | |
|---|---|
| Accuracy | 75.2% |
| Cost | 7580 |
| Alternative 3 | |
|---|---|
| Accuracy | 86.1% |
| Cost | 6985 |
| Alternative 4 | |
|---|---|
| Accuracy | 74.2% |
| Cost | 6857 |
| Alternative 5 | |
|---|---|
| Accuracy | 40.5% |
| Cost | 520 |
| Alternative 6 | |
|---|---|
| Accuracy | 51.9% |
| Cost | 320 |
| Alternative 7 | |
|---|---|
| Accuracy | 39.0% |
| Cost | 64 |
herbie shell --seed 2023133
(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))))