?

Average Error: 0.2% → 0.19%
Time: 11.2s
Precision: binary64
Cost: 19520

?

\[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), 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.2

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

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

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

Alternatives

Alternative 1
Error0.19%
Cost19520
\[\mathsf{fma}\left(x, \cos y, \sin y \cdot z\right) \]
Alternative 2
Error14.65%
Cost13257
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{+96} \lor \neg \left(x \leq 105\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, z, x\right)\\ \end{array} \]
Alternative 3
Error0.2%
Cost13248
\[\sin y \cdot z + x \cdot \cos y \]
Alternative 4
Error26.36%
Cost7122
\[\begin{array}{l} \mathbf{if}\;x \leq -6600000000 \lor \neg \left(x \leq -1.45 \cdot 10^{-59} \lor \neg \left(x \leq -2.55 \cdot 10^{-82}\right) \land x \leq 1.45 \cdot 10^{-71}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;\sin y \cdot z\\ \end{array} \]
Alternative 5
Error14.64%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+91} \lor \neg \left(x \leq 400\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + \sin y \cdot z\\ \end{array} \]
Alternative 6
Error25.5%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.004 \lor \neg \left(y \leq 0.0072\right):\\ \;\;\;\;\sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 7
Error58.24%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{-133}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-216}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error47.69%
Cost320
\[x + y \cdot z \]
Alternative 9
Error61.42%
Cost64
\[x \]

Error

Reproduce?

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