?

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

?

\[x \cdot \sin y + z \cdot \cos y \]
\[\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right) \]
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
(FPCore (x y z) :precision binary64 (fma x (sin y) (* z (cos y))))
double code(double x, double y, double z) {
	return (x * sin(y)) + (z * cos(y));
}
double code(double x, double y, double z) {
	return fma(x, sin(y), (z * cos(y)));
}
function code(x, y, z)
	return Float64(Float64(x * sin(y)) + Float64(z * cos(y)))
end
function code(x, y, z)
	return fma(x, sin(y), Float64(z * cos(y)))
end
code[x_, y_, z_] := N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x * N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \sin y + z \cdot \cos y
\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)

Error?

Derivation?

  1. Initial program 99.8%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)} \]
    Step-by-step derivation

    [Start]99.8

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

    fma-def [=>]99.8

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

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

Alternatives

Alternative 1
Accuracy86.9%
Cost13257
\[\begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+64} \lor \neg \left(z \leq 6.3 \cdot 10^{+60}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \sin y, z\right)\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost13248
\[x \cdot \sin y + z \cdot \cos y \]
Alternative 3
Accuracy72.4%
Cost7384
\[\begin{array}{l} t_0 := x \cdot \sin y\\ t_1 := z \cdot \cos y\\ t_2 := z + x \cdot y\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{-37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-170}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-249}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-99}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy86.7%
Cost6985
\[\begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+69} \lor \neg \left(z \leq 4.7 \cdot 10^{+70}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + x \cdot \sin y\\ \end{array} \]
Alternative 5
Accuracy74.5%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.112 \lor \neg \left(y \leq 200000000\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + x \cdot y\\ \end{array} \]
Alternative 6
Accuracy42.0%
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{-200}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-166}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 7
Accuracy51.7%
Cost320
\[z + x \cdot y \]
Alternative 8
Accuracy38.7%
Cost64
\[z \]

Error

Reproduce?

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