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

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(\sin y, -z, x \cdot \cos y\right)} \]
  3. Final simplification0.1

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

Alternatives

Alternative 1
Error8.6
Cost13320
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;x \leq -9.022991087177669 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.896522597872772 \cdot 10^{+38}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.1
Cost13248
\[x \cdot \cos y - \sin y \cdot z \]
Alternative 3
Error16.0
Cost7448
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := \sin y \cdot \left(-z\right)\\ \mathbf{if}\;y \leq -3.5842381778848335 \cdot 10^{+280}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.73123433079739 \cdot 10^{+213}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.6551753127859233 \cdot 10^{+187}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.568392764912005 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -16478034.072394175:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.08839147709823608:\\ \;\;\;\;\mathsf{fma}\left(-y, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error16.0
Cost7384
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := \sin y \cdot \left(-z\right)\\ \mathbf{if}\;y \leq -3.5842381778848335 \cdot 10^{+280}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.73123433079739 \cdot 10^{+213}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.6551753127859233 \cdot 10^{+187}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.568392764912005 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -16478034.072394175:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.08839147709823608:\\ \;\;\;\;x - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error8.6
Cost6984
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;x \leq -9.022991087177669 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.896522597872772 \cdot 10^{+38}:\\ \;\;\;\;x - \sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error15.9
Cost6856
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -16478034.072394175:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.08839147709823608:\\ \;\;\;\;x - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error37.5
Cost388
\[\begin{array}{l} \mathbf{if}\;z \leq 2.5084330127203226 \cdot 10^{+66}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \end{array} \]
Alternative 8
Error29.6
Cost320
\[x - y \cdot z \]
Alternative 9
Error38.1
Cost64
\[x \]

Error

Reproduce

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