Average Error: 0.1 → 0.1
Time: 11.0s
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
Cost13248
\[\sin y \cdot z + x \cdot \cos y \]
Alternative 2
Error16.6
Cost7384
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := \sin y \cdot z\\ \mathbf{if}\;y \leq -7.47855548357234 \cdot 10^{+139}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.0334180033719905 \cdot 10^{+58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.8631468672212416 \cdot 10^{+29}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.00013607478070912725:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.236350086383115 \cdot 10^{-18}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;y \leq 3.0838474813585634 \cdot 10^{+193}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error9.5
Cost7248
\[\begin{array}{l} t_0 := x + \sin y \cdot z\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;z \leq -7.374097473638935 \cdot 10^{+21}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.541180730348711 \cdot 10^{-174}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.6218222859138105 \cdot 10^{-133}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.818004494593688 \cdot 10^{-60}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error16.6
Cost6856
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -3.511397279149462:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.236350086383115 \cdot 10^{-18}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error30.8
Cost6592
\[\mathsf{fma}\left(z, y, x\right) \]
Alternative 6
Error38.2
Cost324
\[\begin{array}{l} \mathbf{if}\;z \leq -3.8163805910584736 \cdot 10^{+124}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error30.8
Cost320
\[x + y \cdot z \]
Alternative 8
Error39.0
Cost64
\[x \]

Error

Reproduce

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