Average Error: 0.1 → 0.1
Time: 23.2s
Precision: binary64
Cost: 19584
\[x \cdot \cos y - z \cdot \sin y \]
\[\mathsf{fma}\left(\cos y, x, \left(-z\right) \cdot \sin y\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(Float64(-z) * 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, \left(-z\right) \cdot \sin y\right)

Error

Derivation

  1. Initial program 0.1

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

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

Alternatives

Alternative 1
Error0.1
Cost13248
\[x \cdot \cos y - z \cdot \sin y \]
Alternative 2
Error16.5
Cost7712
\[\begin{array}{l} t_0 := \cos y \cdot x\\ t_1 := \left(-z\right) \cdot \sin y\\ \mathbf{if}\;y \leq -9 \cdot 10^{+212}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{+104}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.085:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-6}:\\ \;\;\;\;x - \left(\left(z \cdot \left(-0.16666666666666666 \cdot \left(y \cdot y\right)\right)\right) \cdot y + y \cdot z\right)\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+277}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+302}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error10.3
Cost7380
\[\begin{array}{l} t_0 := x - z \cdot \sin y\\ t_1 := \cos y \cdot x\\ \mathbf{if}\;z \leq -7.4 \cdot 10^{-38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-100}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-114}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-198}:\\ \;\;\;\;x \cdot \cos y - y \cdot z\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+46}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error9.9
Cost6984
\[\begin{array}{l} t_0 := x - z \cdot \sin y\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{-37}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+46}:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error16.2
Cost6856
\[\begin{array}{l} t_0 := \cos y \cdot x\\ \mathbf{if}\;y \leq -0.066:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-6}:\\ \;\;\;\;x - \left(\left(z \cdot \left(-0.16666666666666666 \cdot \left(y \cdot y\right)\right)\right) \cdot y + y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error38.0
Cost520
\[\begin{array}{l} t_0 := -y \cdot z\\ \mathbf{if}\;z \leq -1.4 \cdot 10^{+107}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+164}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error31.1
Cost320
\[x - y \cdot z \]
Alternative 8
Error39.4
Cost64
\[x \]

Error

Reproduce

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