?

Average Error: 0.2% → 0.2%
Time: 9.9s
Precision: binary64
Cost: 19584

?

\[x \cdot \cos y - z \cdot \sin y \]
\[\mathsf{fma}\left(\cos y, x, z \cdot \left(-\sin y\right)\right) \]
(FPCore (x y z) :precision binary64 (- (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (fma (cos y) x (* z (- (sin 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(cos(y), x, (z * -sin(y)));
}
function code(x, y, z)
	return Float64(Float64(x * cos(y)) - Float64(z * sin(y)))
end
function code(x, y, z)
	return fma(cos(y), x, Float64(z * Float64(-sin(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[Cos[y], $MachinePrecision] * x + N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
x \cdot \cos y - z \cdot \sin y
\mathsf{fma}\left(\cos y, x, z \cdot \left(-\sin y\right)\right)

Error?

Derivation?

  1. Initial program 0.2

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Applied egg-rr0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, x, z \cdot \left(-\sin y\right)\right)} \]
  3. Final simplification0.2

    \[\leadsto \mathsf{fma}\left(\cos y, x, z \cdot \left(-\sin y\right)\right) \]

Alternatives

Alternative 1
Error0.2%
Cost13248
\[\cos y \cdot x - z \cdot \sin y \]
Alternative 2
Error27.53%
Cost7448
\[\begin{array}{l} t_0 := \cos y \cdot x\\ t_1 := z \cdot \left(-\sin y\right)\\ \mathbf{if}\;x \leq -3.4 \cdot 10^{-15}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-113}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-10}:\\ \;\;\;\;x - y \cdot z\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error13.83%
Cost6985
\[\begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{-15} \lor \neg \left(z \leq 2.95 \cdot 10^{-92}\right):\\ \;\;\;\;x - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \]
Alternative 4
Error25.47%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00028 \lor \neg \left(y \leq 8.4 \cdot 10^{-14}\right):\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot z\\ \end{array} \]
Alternative 5
Error59.37%
Cost520
\[\begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{-287}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error48.29%
Cost320
\[x - y \cdot z \]
Alternative 7
Error61.32%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023115 
(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))))