Average Error: 0.0 → 0.0
Time: 5.6s
Precision: binary64
Cost: 6976
\[\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t \]
\[\mathsf{fma}\left(z \cdot -0.5, y, 0.125 \cdot x\right) + t \]
(FPCore (x y z t)
 :precision binary64
 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
(FPCore (x y z t) :precision binary64 (+ (fma (* z -0.5) y (* 0.125 x)) t))
double code(double x, double y, double z, double t) {
	return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
double code(double x, double y, double z, double t) {
	return fma((z * -0.5), y, (0.125 * x)) + t;
}
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t)
end
function code(x, y, z, t)
	return Float64(fma(Float64(z * -0.5), y, Float64(0.125 * x)) + t)
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(z * -0.5), $MachinePrecision] * y + N[(0.125 * x), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\mathsf{fma}\left(z \cdot -0.5, y, 0.125 \cdot x\right) + t

Error

Target

Original0.0
Target0.0
Herbie0.0
\[\left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y \]

Derivation

  1. Initial program 0.0

    \[\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t \]
  2. Applied egg-rr0.0

    \[\leadsto \color{blue}{\left(\left(y \cdot z\right) \cdot -0.5 + 0.125 \cdot x\right)} + t \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot -0.5, y, 0.125 \cdot x\right)} + t \]
  4. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(z \cdot -0.5, y, 0.125 \cdot x\right) + t \]

Alternatives

Alternative 1
Error31.8
Cost840
\[\begin{array}{l} t_1 := -0.5 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \cdot y \leq -2.8477374928829874 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot y \leq 5.642701320029857 \cdot 10^{-6}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error12.2
Cost840
\[\begin{array}{l} t_1 := -0.5 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \cdot y \leq -2.308012827032724 \cdot 10^{+179}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot y \leq 3.7851732106567024 \cdot 10^{+111}:\\ \;\;\;\;0.125 \cdot x + t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error8.8
Cost712
\[\begin{array}{l} t_1 := 0.125 \cdot x + t\\ \mathbf{if}\;x \leq -3.946766474607568 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.1949313332393868 \cdot 10^{-59}:\\ \;\;\;\;t + z \cdot \left(-0.5 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error0.0
Cost704
\[t + \left(0.125 \cdot x + -0.5 \cdot \left(z \cdot y\right)\right) \]
Alternative 5
Error40.1
Cost64
\[t \]

Error

Reproduce

herbie shell --seed 2022318 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (- (+ (/ x 8.0) t) (* (/ z 2.0) y))

  (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))