Average Error: 0.1 → 0.1
Time: 7.3s
Precision: binary64
\[x \cdot \cos y + z \cdot \sin y \]
\[\mathsf{fma}\left(z, \sin y, x \cdot \cos y\right) \]
(FPCore (x y z) :precision binary64 (+ (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (fma z (sin y) (* 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(z, sin(y), (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(z, sin(y), 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[(z * N[Sin[y], $MachinePrecision] + N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \cos y + z \cdot \sin y
\mathsf{fma}\left(z, \sin y, x \cdot \cos y\right)

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

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

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{z}\right)}^{2}, \sqrt[3]{z} \cdot \sin y, x \cdot \cos y\right)} \]
  3. Applied egg-rr0.1

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

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

Reproduce

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