?

Average Accuracy: 99.8% → 99.8%
Time: 12.6s
Precision: binary64
Cost: 19520

?

\[x \cdot \cos y + z \cdot \sin y \]
\[\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right) \]
(FPCore (x y z) :precision binary64 (+ (* x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (fma x (cos y) (* z (sin 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(x, cos(y), (z * sin(y)));
}
function code(x, y, z)
	return Float64(Float64(x * cos(y)) + Float64(z * sin(y)))
end
function code(x, y, z)
	return fma(x, cos(y), Float64(z * sin(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[(x * N[Cos[y], $MachinePrecision] + N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \cos y + z \cdot \sin y
\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right)

Error?

Derivation?

  1. Initial program 99.8%

    \[x \cdot \cos y + z \cdot \sin y \]
  2. Simplified99.8%

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

    [Start]99.8

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

    fma-def [=>]99.8

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

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

Alternatives

Alternative 1
Accuracy99.8%
Cost13248
\[z \cdot \sin y + x \cdot \cos y \]
Alternative 2
Accuracy74.5%
Cost7896
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := z \cdot \sin y\\ \mathbf{if}\;y \leq -4 \cdot 10^{+220}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{+74}:\\ \;\;\;\;\frac{1}{\frac{1}{t_0}}\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -260:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+120}:\\ \;\;\;\;x \cdot \left(\left(\cos y + 1\right) + -1\right) + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy75.0%
Cost7516
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := z \cdot \sin y\\ \mathbf{if}\;y \leq -6 \cdot 10^{+219}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -8:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-8}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+126}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy75.3%
Cost7516
\[\begin{array}{l} t_0 := x \cdot \cos y\\ t_1 := z \cdot \sin y\\ \mathbf{if}\;y \leq -5 \cdot 10^{+220}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{+140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7.4 \cdot 10^{+74}:\\ \;\;\;\;\frac{1}{\frac{1}{t_0}}\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -8:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-8}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+130}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy75.3%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00017 \lor \neg \left(y \leq 0.027\right):\\ \;\;\;\;z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 6
Accuracy40.4%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-43}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{-243}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Accuracy51.9%
Cost320
\[x + y \cdot z \]
Alternative 8
Accuracy39.0%
Cost64
\[x \]

Error

Reproduce?

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