?

Average Error: 0.1 → 0.1
Time: 12.3s
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.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
Cost19520
\[\mathsf{fma}\left(x, \cos y, \sin y \cdot z\right) \]
Alternative 2
Error0.1
Cost13248
\[\sin y \cdot z + x \cdot \cos y \]
Alternative 3
Error15.9
Cost7641
\[\begin{array}{l} t_0 := \sin y \cdot z\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -3.5 \cdot 10^{+240}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.0105:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;y \leq 9.6 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+137} \lor \neg \left(y \leq 1.08 \cdot 10^{+230}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\frac{1}{\cos y}}\\ \end{array} \]
Alternative 4
Error16.0
Cost7641
\[\begin{array}{l} t_0 := \sin y \cdot z\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -2.7 \cdot 10^{+239}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.009:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.75 \cdot 10^{-6}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+138} \lor \neg \left(y \leq 7.5 \cdot 10^{+221}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{x}}{\cos y}}\\ \end{array} \]
Alternative 5
Error15.9
Cost7641
\[\begin{array}{l} t_0 := \sin y \cdot z\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -2 \cdot 10^{+250}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.0142:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{-5}:\\ \;\;\;\;x + \left(-0.16666666666666666 \cdot \left(z \cdot {y}^{3}\right) + y \cdot z\right)\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+118}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+137} \lor \neg \left(y \leq 4.6 \cdot 10^{+226}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{x}}{\cos y}}\\ \end{array} \]
Alternative 6
Error15.9
Cost7385
\[\begin{array}{l} t_0 := \sin y \cdot z\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -2.4 \cdot 10^{+234}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.009:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-5}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+119} \lor \neg \left(y \leq 1.35 \cdot 10^{+137}\right) \land y \leq 3.7 \cdot 10^{+229}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error15.9
Cost7385
\[\begin{array}{l} t_0 := \sin y \cdot z\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -5.5 \cdot 10^{+245}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.0095:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+121} \lor \neg \left(y \leq 8.6 \cdot 10^{+137}\right) \land y \leq 3.05 \cdot 10^{+230}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error15.9
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.006 \lor \neg \left(y \leq 160\right):\\ \;\;\;\;\sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 9
Error37.2
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-142}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-107}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error30.5
Cost320
\[x + y \cdot z \]
Alternative 11
Error38.9
Cost64
\[x \]

Error

Reproduce?

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