Average Error: 0.0 → 0.0
Time: 10.7s
Precision: binary64
Cost: 6912
\[x + y \cdot \left(z - x\right) \]
\[x + \mathsf{fma}\left(z, y, -x \cdot y\right) \]
(FPCore (x y z) :precision binary64 (+ x (* y (- z x))))
(FPCore (x y z) :precision binary64 (+ x (fma z y (- (* x y)))))
double code(double x, double y, double z) {
	return x + (y * (z - x));
}
double code(double x, double y, double z) {
	return x + fma(z, y, -(x * y));
}
function code(x, y, z)
	return Float64(x + Float64(y * Float64(z - x)))
end
function code(x, y, z)
	return Float64(x + fma(z, y, Float64(-Float64(x * y))))
end
code[x_, y_, z_] := N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(z * y + (-N[(x * y), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
x + y \cdot \left(z - x\right)
x + \mathsf{fma}\left(z, y, -x \cdot y\right)

Error

Derivation

  1. Initial program 0.0

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

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

Alternatives

Alternative 1
Error0.0
Cost6720
\[\mathsf{fma}\left(y, z - x, x\right) \]
Alternative 2
Error24.2
Cost984
\[\begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{+137}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq -65000000000:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-36}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-197}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-165}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-41}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
Alternative 3
Error13.0
Cost848
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -7.2 \cdot 10^{-39}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-197}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-165}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error12.6
Cost848
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{-37}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-197}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-165}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 0.0056:\\ \;\;\;\;\left(1 - y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error24.1
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{-39}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-197}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-165}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{-40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
Alternative 6
Error0.0
Cost640
\[\left(x + y \cdot z\right) + \left(-x \cdot y\right) \]
Alternative 7
Error0.9
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -135000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.0126:\\ \;\;\;\;x + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error0.0
Cost448
\[x + y \cdot \left(z - x\right) \]
Alternative 9
Error34.5
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (x y z)
  :name "SynthBasics:oscSampleBasedAux from YampaSynth-0.2"
  :precision binary64
  (+ x (* y (- z x))))