?

Average Accuracy: 99.8% → 99.8%
Time: 11.6s
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 99.8%

    \[x \cdot \cos y + z \cdot \sin y \]
  2. Applied egg-rr99.8%

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

    [Start]99.8

    \[ x \cdot \cos y + z \cdot \sin y \]

    +-commutative [=>]99.8

    \[ \color{blue}{z \cdot \sin y + x \cdot \cos y} \]

    *-commutative [=>]99.8

    \[ \color{blue}{\sin y \cdot z} + x \cdot \cos y \]

    fma-def [=>]99.8

    \[ \color{blue}{\mathsf{fma}\left(\sin y, z, x \cdot \cos y\right)} \]
  3. Final simplification99.8%

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

Alternatives

Alternative 1
Accuracy86.4%
Cost13257
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+88} \lor \neg \left(x \leq 9.5 \cdot 10^{+44}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, z, x\right)\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost13248
\[\sin y \cdot z + x \cdot \cos y \]
Alternative 3
Accuracy75.8%
Cost7121
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -0.0006:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5800:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+104} \lor \neg \left(y \leq 2.52 \cdot 10^{+123}\right):\\ \;\;\;\;\sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy75.8%
Cost7121
\[\begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -0.00044:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5800:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+112} \lor \neg \left(y \leq 8 \cdot 10^{+122}\right):\\ \;\;\;\;\sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Accuracy86.4%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+87} \lor \neg \left(x \leq 4.6 \cdot 10^{+42}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + \sin y \cdot z\\ \end{array} \]
Alternative 6
Accuracy75.2%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0039 \lor \neg \left(y \leq 5800\right):\\ \;\;\;\;\sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 7
Accuracy42.9%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.25 \cdot 10^{-135}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-139}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy53.1%
Cost320
\[x + y \cdot z \]
Alternative 9
Accuracy40.1%
Cost64
\[x \]

Error

Reproduce?

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