?

Average Error: 0.21% → 0.21%
Time: 10.2s
Precision: binary64
Cost: 19520

?

\[x \cdot \sin y + z \cdot \cos y \]
\[\mathsf{fma}\left(\cos y, z, x \cdot \sin y\right) \]
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
(FPCore (x y z) :precision binary64 (fma (cos y) z (* x (sin y))))
double code(double x, double y, double z) {
	return (x * sin(y)) + (z * cos(y));
}
double code(double x, double y, double z) {
	return fma(cos(y), z, (x * sin(y)));
}
function code(x, y, z)
	return Float64(Float64(x * sin(y)) + Float64(z * cos(y)))
end
function code(x, y, z)
	return fma(cos(y), z, Float64(x * sin(y)))
end
code[x_, y_, z_] := N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \sin y + z \cdot \cos y
\mathsf{fma}\left(\cos y, z, x \cdot \sin y\right)

Error?

Derivation?

  1. Initial program 0.21

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

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

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

Alternatives

Alternative 1
Error0.21%
Cost13248
\[x \cdot \sin y + \cos y \cdot z \]
Alternative 2
Error13.92%
Cost7250
\[\begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{+57} \lor \neg \left(z \leq 1.05 \cdot 10^{-8}\right) \land \left(z \leq 35000000 \lor \neg \left(z \leq 6.2 \cdot 10^{+60}\right)\right):\\ \;\;\;\;\cos y \cdot z\\ \mathbf{else}:\\ \;\;\;\;z + x \cdot \sin y\\ \end{array} \]
Alternative 3
Error24.66%
Cost7121
\[\begin{array}{l} t_0 := \cos y \cdot z\\ \mathbf{if}\;y \leq -0.09:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.0044:\\ \;\;\;\;z + y \cdot x\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+168} \lor \neg \left(y \leq 1.8 \cdot 10^{+254}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \sin y\\ \end{array} \]
Alternative 4
Error24.93%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.09 \lor \neg \left(y \leq 0.0049\right):\\ \;\;\;\;\cos y \cdot z\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot x\\ \end{array} \]
Alternative 5
Error58.3%
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{-158}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-179}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 6
Error47.5%
Cost320
\[z + y \cdot x \]
Alternative 7
Error60.95%
Cost64
\[z \]

Error

Reproduce?

herbie shell --seed 2023125 
(FPCore (x y z)
  :name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, B"
  :precision binary64
  (+ (* x (sin y)) (* z (cos y))))