?

Average Accuracy: 99.9% → 99.9%
Time: 10.7s
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 99.9%

    \[\left(x + \cos y\right) - z \cdot \sin y \]
  2. Simplified99.9%

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

    [Start]99.9

    \[ \left(x + \cos y\right) - z \cdot \sin y \]

    cancel-sign-sub-inv [=>]99.9

    \[ \color{blue}{\left(x + \cos y\right) + \left(-z\right) \cdot \sin y} \]

    +-commutative [=>]99.9

    \[ \color{blue}{\left(-z\right) \cdot \sin y + \left(x + \cos y\right)} \]

    *-commutative [=>]99.9

    \[ \color{blue}{\sin y \cdot \left(-z\right)} + \left(x + \cos y\right) \]

    fma-def [=>]99.9

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

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

Alternatives

Alternative 1
Accuracy89.9%
Cost13384
\[\begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+29}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.42:\\ \;\;\;\;\cos y - \sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
Alternative 2
Accuracy99.9%
Cost13248
\[\left(x + \cos y\right) - \sin y \cdot z \]
Alternative 3
Accuracy71.1%
Cost6992
\[\begin{array}{l} \mathbf{if}\;x \leq -2.25 \cdot 10^{-13}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-226}:\\ \;\;\;\;\cos y\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-245}:\\ \;\;\;\;1 - y \cdot z\\ \mathbf{elif}\;x \leq 0.66:\\ \;\;\;\;\cos y\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]
Alternative 4
Accuracy82.9%
Cost6921
\[\begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+140} \lor \neg \left(z \leq 6.2 \cdot 10^{+187}\right):\\ \;\;\;\;\sin y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
Alternative 5
Accuracy81.0%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -2700000000 \lor \neg \left(y \leq 0.021\right):\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;1 + \left(x - y \cdot z\right)\\ \end{array} \]
Alternative 6
Accuracy70.0%
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -15000000000000:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 35:\\ \;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -1\\ \end{array} \]
Alternative 7
Accuracy69.8%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{+36}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+15}:\\ \;\;\;\;1 + \left(x - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -1\\ \end{array} \]
Alternative 8
Accuracy66.7%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-58} \lor \neg \left(x \leq 0.8\right):\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;1 - y \cdot z\\ \end{array} \]
Alternative 9
Accuracy61.1%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -0.475:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 0.000185:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy62.0%
Cost192
\[x + 1 \]
Alternative 11
Accuracy21.7%
Cost64
\[1 \]

Error

Reproduce?

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