Average Error: 0.1 → 0.1
Time: 8.4s
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
Error0.1
Cost13248
\[x \cdot \cos y - \sin y \cdot z \]
Alternative 2
Error16.7
Cost7184
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := \sin y \cdot \left(-z\right)\\ \mathbf{if}\;x \leq -1.9113227494595571 \cdot 10^{-93}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.8268026029328564 \cdot 10^{-188}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.885534198897788 \cdot 10^{-177}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.1208151972197477 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error8.8
Cost6984
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;x \leq -5.77061478139967 \cdot 10^{+18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 4.817244721917213 \cdot 10^{+60}:\\ \;\;\;\;x - \sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error16.3
Cost6856
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -4263165837013070:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.5368325926291956:\\ \;\;\;\;x + y \cdot \left(-0.5 \cdot \left(y \cdot x\right) - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error38.4
Cost784
\[\begin{array}{l} t_0 := y \cdot \left(-z\right)\\ \mathbf{if}\;x \leq -1.2736310184995873 \cdot 10^{-169}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -5.007372374707489 \cdot 10^{-242}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -4.5486852416693705 \cdot 10^{-280}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 0.0945866483674307:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error30.7
Cost320
\[x - y \cdot z \]
Alternative 7
Error38.9
Cost64
\[x \]

Error

Reproduce

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