Average Error: 0.0 → 0.0
Time: 11.4s
Precision: binary64
Cost: 19584
\[\left(x + \cos y\right) - z \cdot \sin y \]
\[\mathsf{fma}\left(\sin y, -z, x + \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), Float64(-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]
\left(x + \cos y\right) - z \cdot \sin y
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)

Error

Derivation

  1. Initial program 0.0

    \[\left(x + \cos y\right) - z \cdot \sin y \]
  2. Applied egg-rr0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, x + \cos y\right)} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error0.0
Cost13248
\[\left(x + \cos y\right) - \sin y \cdot z \]
Alternative 2
Error0.9
Cost7112
\[\begin{array}{l} t_0 := \left(x + 1\right) - \sin y \cdot z\\ \mathbf{if}\;z \leq -6657819.89257601:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.4691728910638 \cdot 10^{-47}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error5.3
Cost6984
\[\begin{array}{l} t_0 := x - \sin y \cdot z\\ \mathbf{if}\;z \leq -4.980723565132105 \cdot 10^{+117}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.1276020500820164 \cdot 10^{-10}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error11.7
Cost6920
\[\begin{array}{l} t_0 := z \cdot \left(-\sin y\right)\\ \mathbf{if}\;z \leq -1.2582800421291595 \cdot 10^{+194}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.607587977229177 \cdot 10^{+89}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error11.8
Cost6856
\[\begin{array}{l} t_0 := x + \cos y\\ \mathbf{if}\;y \leq -10604636.769083364:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 389.6858559397786:\\ \;\;\;\;x - \left(y \cdot z + -1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error17.8
Cost6728
\[\begin{array}{l} \mathbf{if}\;x \leq -0.9157326639427598:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;x \leq 3.8135462907295645 \cdot 10^{-7}:\\ \;\;\;\;\cos y\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]
Alternative 7
Error18.7
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -2.3562927529405907 \cdot 10^{+47}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 4.754348398261506 \cdot 10^{+19}:\\ \;\;\;\;x - \left(y \cdot z + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + -1\\ \end{array} \]
Alternative 8
Error21.0
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -23171205789086.324:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.371067309490128 \cdot 10^{-25}:\\ \;\;\;\;1 - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]
Alternative 9
Error24.6
Cost388
\[\begin{array}{l} \mathbf{if}\;z \leq 1.0049206363290624 \cdot 10^{+161}:\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \end{array} \]
Alternative 10
Error24.7
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3719448422663253 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.0179829716806413 \cdot 10^{-6}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error25.1
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -2.2602511433546637 \cdot 10^{-32}:\\ \;\;\;\;x + -1\\ \mathbf{elif}\;x \leq 3.0179829716806413 \cdot 10^{-6}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error24.3
Cost192
\[x + 1 \]
Alternative 13
Error37.0
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022297 
(FPCore (x y z)
  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
  :precision binary64
  (- (+ x (cos y)) (* z (sin y))))