?

Average Accuracy: 99.8% → 99.8%
Time: 11.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
Accuracy85.8%
Cost13257
\[\begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+64} \lor \neg \left(x \leq 3 \cdot 10^{+113}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, z, x\right)\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost13248
\[z \cdot \sin y + x \cdot \cos y \]
Alternative 3
Accuracy74.5%
Cost7253
\[\begin{array}{l} t_0 := z \cdot \sin y\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -7.8 \cdot 10^{+103}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.0105:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-13}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+49} \lor \neg \left(y \leq 1.2 \cdot 10^{+145}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy74.6%
Cost7253
\[\begin{array}{l} t_0 := z \cdot \sin y\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -6.6 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.00185:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{-13}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{+46} \lor \neg \left(y \leq 3.7 \cdot 10^{+146}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy85.8%
Cost6985
\[\begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{-106} \lor \neg \left(z \leq 2.95 \cdot 10^{-67}\right):\\ \;\;\;\;x + z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \cos y\\ \end{array} \]
Alternative 6
Accuracy74.2%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0036 \lor \neg \left(y \leq 4.3 \cdot 10^{-13}\right):\\ \;\;\;\;z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 7
Accuracy41.6%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-167}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-150}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy51.6%
Cost320
\[x + y \cdot z \]
Alternative 9
Accuracy39.1%
Cost64
\[x \]

Error

Reproduce?

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