?

Average Error: 0.1 → 0.1
Time: 10.2s
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 0.1

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

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

    [Start]0.1

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

    fma-def [=>]0.1

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

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

Alternatives

Alternative 1
Error0.1
Cost13248
\[z \cdot \sin y + x \cdot \cos y \]
Alternative 2
Error15.8
Cost7517
\[\begin{array}{l} t_0 := z \cdot \sin y\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -2.1 \cdot 10^{+204}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{+181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.009:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1700:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+82} \lor \neg \left(y \leq 3.1 \cdot 10^{+133}\right) \land y \leq 6.9 \cdot 10^{+183}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error16.0
Cost7505
\[\begin{array}{l} t_0 := z \cdot \sin y\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+204}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{+181}:\\ \;\;\;\;x \cdot \cos y\\ \mathbf{elif}\;y \leq -310 \lor \neg \left(y \leq 2.4 \cdot 10^{+77}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{1}{\cos y}} + y \cdot z\\ \end{array} \]
Alternative 4
Error16.2
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00028 \lor \neg \left(y \leq 0.00038\right):\\ \;\;\;\;z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]
Alternative 5
Error37.8
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-140}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-194}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-138}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-88}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error30.8
Cost320
\[x + y \cdot z \]
Alternative 7
Error39.0
Cost64
\[x \]

Error

Reproduce?

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