?

Average Error: 0.1 → 0.1
Time: 1.3min
Precision: binary64
Cost: 19520

?

\[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?

Derivation?

  1. Initial program 0.1

    \[x \cdot \cos y + z \cdot \sin y \]
  2. Simplified0.1

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

Alternatives

Alternative 1
Error0.1
Cost13248
\[x \cdot \cos y + z \cdot \sin y \]
Alternative 2
Error9.9
Cost7572
\[\begin{array}{l} t_0 := \cos y \cdot x\\ t_1 := x + \begin{array}{l} \mathbf{if}\;z \ne 0:\\ \;\;\;\;\frac{-\sin y}{\frac{-1}{z}}\\ \mathbf{else}:\\ \;\;\;\;\sin y \cdot z\\ \end{array}\\ \mathbf{if}\;x \leq -8 \cdot 10^{+153}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -7.4 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.52 \cdot 10^{-16}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+144}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error15.9
Cost7120
\[\begin{array}{l} t_0 := \sin y \cdot z\\ \mathbf{if}\;y \leq -2 \cdot 10^{+90}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{+17}:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{elif}\;y \leq -6.8 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-7}:\\ \;\;\;\;y \cdot z + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error16.3
Cost6856
\[\begin{array}{l} t_0 := \cos y \cdot x\\ \mathbf{if}\;y \leq -0.205:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.0076:\\ \;\;\;\;y \cdot z + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error37.4
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-256}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error30.6
Cost320
\[y \cdot z + x \]
Alternative 7
Error38.8
Cost64
\[x \]

Error

Reproduce?

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