Average Error: 0.1 → 0.1
Time: 8.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.1

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

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

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

Alternatives

Alternative 1
Error0.9
Cost13384
\[\begin{array}{l} t_0 := \sin y \cdot z\\ \mathbf{if}\;x \leq -265.7059042176869:\\ \;\;\;\;x - t_0\\ \mathbf{elif}\;x \leq 5.4316683679789 \cdot 10^{-8}:\\ \;\;\;\;\cos y - t_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, \sin y, x\right)\\ \end{array} \]
Alternative 2
Error0.1
Cost13248
\[\left(x + \cos y\right) - \sin y \cdot z \]
Alternative 3
Error4.5
Cost13188
\[\begin{array}{l} \mathbf{if}\;z \leq -1.9497315071920233 \cdot 10^{+46}:\\ \;\;\;\;\mathsf{fma}\left(-z, \sin y, x\right)\\ \mathbf{elif}\;z \leq 31040007.704675548:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;x - \sin y \cdot z\\ \end{array} \]
Alternative 4
Error18.6
Cost6992
\[\begin{array}{l} \mathbf{if}\;x \leq -0.004117797940046108:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;x \leq 9.332974612922434 \cdot 10^{-284}:\\ \;\;\;\;\cos y\\ \mathbf{elif}\;x \leq 6.142943179884381 \cdot 10^{-160}:\\ \;\;\;\;1 + y \cdot \left(y \cdot -0.5 - z\right)\\ \mathbf{elif}\;x \leq 5.4316683679789 \cdot 10^{-8}:\\ \;\;\;\;\cos y\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]
Alternative 5
Error4.5
Cost6984
\[\begin{array}{l} t_0 := x - \sin y \cdot z\\ \mathbf{if}\;z \leq -1.9497315071920233 \cdot 10^{+46}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 31040007.704675548:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error11.4
Cost6920
\[\begin{array}{l} t_0 := \sin y \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -1.2122258679160396 \cdot 10^{+192}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.013519629117478 \cdot 10^{+156}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error11.7
Cost6856
\[\begin{array}{l} t_0 := x + \cos y\\ \mathbf{if}\;y \leq -959.0349490808583:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.005942722395923747:\\ \;\;\;\;x + \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error19.0
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -1.2344750053823221 \cdot 10^{+23}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 4.601561285580659 \cdot 10^{+89}:\\ \;\;\;\;x + \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]
Alternative 9
Error21.4
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -5.021443259394436 \cdot 10^{+24}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1189639.3908977848:\\ \;\;\;\;1 - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]
Alternative 10
Error25.2
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -33.7827754951074:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.0265571596315616 \cdot 10^{-20}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error24.5
Cost192
\[x + 1 \]
Alternative 12
Error36.5
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022300 
(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))))