Average Error: 7.8 → 8.2
Time: 17.5s
Precision: binary64
Cost: 7884
\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \end{array} \]
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
\[\begin{array}{l} \mathbf{if}\;z \cdot 9 \leq -4 \cdot 10^{+216}:\\ \;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;z \cdot 9 \leq -1 \cdot 10^{-139}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a}, \frac{x}{2}, \left(9 \cdot \left(z \cdot t\right)\right) \cdot \frac{-0.5}{a}\right)\\ \mathbf{elif}\;z \cdot 9 \leq 5 \cdot 10^{-11}:\\ \;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\ \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* z 9.0) -4e+216)
   (* (* t -4.5) (/ z a))
   (if (<= (* z 9.0) -1e-139)
     (fma (/ y a) (/ x 2.0) (* (* 9.0 (* z t)) (/ -0.5 a)))
     (if (<= (* z 9.0) 5e-11)
       (* 0.5 (/ (fma x y (* z (* t -9.0))) a))
       (/ (* z -4.5) (/ a t))))))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z * 9.0) <= -4e+216) {
		tmp = (t * -4.5) * (z / a);
	} else if ((z * 9.0) <= -1e-139) {
		tmp = fma((y / a), (x / 2.0), ((9.0 * (z * t)) * (-0.5 / a)));
	} else if ((z * 9.0) <= 5e-11) {
		tmp = 0.5 * (fma(x, y, (z * (t * -9.0))) / a);
	} else {
		tmp = (z * -4.5) / (a / t);
	}
	return tmp;
}
function code(x, y, z, t, a)
	return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0))
end
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(z * 9.0) <= -4e+216)
		tmp = Float64(Float64(t * -4.5) * Float64(z / a));
	elseif (Float64(z * 9.0) <= -1e-139)
		tmp = fma(Float64(y / a), Float64(x / 2.0), Float64(Float64(9.0 * Float64(z * t)) * Float64(-0.5 / a)));
	elseif (Float64(z * 9.0) <= 5e-11)
		tmp = Float64(0.5 * Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / a));
	else
		tmp = Float64(Float64(z * -4.5) / Float64(a / t));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * 9.0), $MachinePrecision], -4e+216], N[(N[(t * -4.5), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * 9.0), $MachinePrecision], -1e-139], N[(N[(y / a), $MachinePrecision] * N[(x / 2.0), $MachinePrecision] + N[(N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * 9.0), $MachinePrecision], 5e-11], N[(0.5 * N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(z * -4.5), $MachinePrecision] / N[(a / t), $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;z \cdot 9 \leq -4 \cdot 10^{+216}:\\
\;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\

\mathbf{elif}\;z \cdot 9 \leq -1 \cdot 10^{-139}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, \frac{x}{2}, \left(9 \cdot \left(z \cdot t\right)\right) \cdot \frac{-0.5}{a}\right)\\

\mathbf{elif}\;z \cdot 9 \leq 5 \cdot 10^{-11}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\


\end{array}

Error

Target

Original7.8
Target5.7
Herbie8.2
\[\begin{array}{l} \mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\ \end{array} \]

Derivation

  1. Split input into 4 regimes
  2. if (*.f64 z 9) < -4.0000000000000001e216

    1. Initial program 17.8

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Simplified17.2

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}} \]
      Proof
      (*.f64 1/2 (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= metadata-eval (/.f64 1 2)) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1)) 2) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t)))) a)): 12 points increase in error, 11 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) a)): 0 points increase in error, 1 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (*.f64 x y) 0)) (*.f64 (*.f64 z 9) t)) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 (+.f64 (*.f64 x y) 0) a) (/.f64 (*.f64 (*.f64 z 9) t) a)))): 2 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (-.f64 (/.f64 (Rewrite=> +-rgt-identity_binary64 (*.f64 x y)) a) (/.f64 (*.f64 (*.f64 z 9) t) a))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) a))): 0 points increase in error, 2 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 x y) (neg.f64 (*.f64 (*.f64 z 9) t)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 x y)))) (neg.f64 (*.f64 (*.f64 z 9) t))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (neg.f64 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite=> distribute-frac-neg_binary64 (neg.f64 (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) a)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> distribute-rgt-neg-out_binary64 (neg.f64 (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) a)))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (neg.f64 -1) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a)))): 1 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (*.f64 (Rewrite=> metadata-eval 1) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (Rewrite=> *-lft-identity_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) (Rewrite<= *-commutative_binary64 (*.f64 a 2)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-frac-neg_binary64 (/.f64 (neg.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 a 2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 (*.f64 z 9) t)) (*.f64 x y))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 (*.f64 z 9) t))) (*.f64 x y)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= distribute-lft-neg-out_binary64 (*.f64 (neg.f64 (*.f64 z 9)) t)) (*.f64 x y)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 x y) (*.f64 (neg.f64 (*.f64 z 9)) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in x around 0 28.0

      \[\leadsto 0.5 \cdot \color{blue}{\left(-9 \cdot \frac{t \cdot z}{a}\right)} \]
    4. Simplified21.8

      \[\leadsto 0.5 \cdot \color{blue}{\left(-9 \cdot \frac{z}{\frac{a}{t}}\right)} \]
      Proof
      (*.f64 -9 (/.f64 z (/.f64 a t))): 0 points increase in error, 0 points decrease in error
      (*.f64 -9 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 z t) a))): 46 points increase in error, 58 points decrease in error
      (*.f64 -9 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 t z)) a)): 0 points increase in error, 0 points decrease in error
    5. Taylor expanded in z around 0 28.0

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    6. Simplified24.7

      \[\leadsto \color{blue}{\left(t \cdot -4.5\right) \cdot \frac{z}{a}} \]
      Proof
      (*.f64 (*.f64 t -9/2) (/.f64 z a)): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (*.f64 t -9/2) z) a)): 55 points increase in error, 49 points decrease in error
      (Rewrite=> associate-/l*_binary64 (/.f64 (*.f64 t -9/2) (/.f64 a z))): 50 points increase in error, 53 points decrease in error
      (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 -9/2 t)) (/.f64 a z)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r/_binary64 (*.f64 -9/2 (/.f64 t (/.f64 a z)))): 27 points increase in error, 33 points decrease in error
      (*.f64 -9/2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 t z) a))): 52 points increase in error, 43 points decrease in error

    if -4.0000000000000001e216 < (*.f64 z 9) < -1.00000000000000003e-139

    1. Initial program 7.1

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Applied egg-rr7.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, \frac{x}{2}, -\left(9 \cdot \left(z \cdot t\right)\right) \cdot \frac{0.5}{a}\right)} \]

    if -1.00000000000000003e-139 < (*.f64 z 9) < 5.00000000000000018e-11

    1. Initial program 4.2

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Simplified4.3

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}} \]
      Proof
      (*.f64 1/2 (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= metadata-eval (/.f64 1 2)) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1)) 2) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t)))) a)): 12 points increase in error, 11 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) a)): 0 points increase in error, 1 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (*.f64 x y) 0)) (*.f64 (*.f64 z 9) t)) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 (+.f64 (*.f64 x y) 0) a) (/.f64 (*.f64 (*.f64 z 9) t) a)))): 2 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (-.f64 (/.f64 (Rewrite=> +-rgt-identity_binary64 (*.f64 x y)) a) (/.f64 (*.f64 (*.f64 z 9) t) a))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) a))): 0 points increase in error, 2 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 x y) (neg.f64 (*.f64 (*.f64 z 9) t)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 x y)))) (neg.f64 (*.f64 (*.f64 z 9) t))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (neg.f64 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite=> distribute-frac-neg_binary64 (neg.f64 (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) a)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> distribute-rgt-neg-out_binary64 (neg.f64 (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) a)))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (neg.f64 -1) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a)))): 1 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (*.f64 (Rewrite=> metadata-eval 1) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (Rewrite=> *-lft-identity_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) (Rewrite<= *-commutative_binary64 (*.f64 a 2)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-frac-neg_binary64 (/.f64 (neg.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 a 2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 (*.f64 z 9) t)) (*.f64 x y))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 (*.f64 z 9) t))) (*.f64 x y)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= distribute-lft-neg-out_binary64 (*.f64 (neg.f64 (*.f64 z 9)) t)) (*.f64 x y)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 x y) (*.f64 (neg.f64 (*.f64 z 9)) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error

    if 5.00000000000000018e-11 < (*.f64 z 9)

    1. Initial program 22.8

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Simplified22.7

      \[\leadsto \color{blue}{0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}} \]
      Proof
      (*.f64 1/2 (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= metadata-eval (/.f64 1 2)) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1)) 2) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t)))) a)): 12 points increase in error, 11 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) a)): 0 points increase in error, 1 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (*.f64 x y) 0)) (*.f64 (*.f64 z 9) t)) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 (+.f64 (*.f64 x y) 0) a) (/.f64 (*.f64 (*.f64 z 9) t) a)))): 2 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (-.f64 (/.f64 (Rewrite=> +-rgt-identity_binary64 (*.f64 x y)) a) (/.f64 (*.f64 (*.f64 z 9) t) a))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) a))): 0 points increase in error, 2 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 x y) (neg.f64 (*.f64 (*.f64 z 9) t)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 x y)))) (neg.f64 (*.f64 (*.f64 z 9) t))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (neg.f64 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 -1) 2) (Rewrite=> distribute-frac-neg_binary64 (neg.f64 (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) a)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> distribute-rgt-neg-out_binary64 (neg.f64 (*.f64 (/.f64 (neg.f64 -1) 2) (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) a)))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (neg.f64 -1) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a)))): 1 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (*.f64 (Rewrite=> metadata-eval 1) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (Rewrite=> *-lft-identity_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (/.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)) (Rewrite<= *-commutative_binary64 (*.f64 a 2)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-frac-neg_binary64 (/.f64 (neg.f64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 a 2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 (*.f64 z 9) t)) (*.f64 x y))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 (*.f64 z 9) t))) (*.f64 x y)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= distribute-lft-neg-out_binary64 (*.f64 (neg.f64 (*.f64 z 9)) t)) (*.f64 x y)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 x y) (*.f64 (neg.f64 (*.f64 z 9)) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in x around 0 28.7

      \[\leadsto 0.5 \cdot \color{blue}{\left(-9 \cdot \frac{t \cdot z}{a}\right)} \]
    4. Simplified10.7

      \[\leadsto 0.5 \cdot \color{blue}{\left(-9 \cdot \frac{z}{\frac{a}{t}}\right)} \]
      Proof
      (*.f64 -9 (/.f64 z (/.f64 a t))): 0 points increase in error, 0 points decrease in error
      (*.f64 -9 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 z t) a))): 46 points increase in error, 58 points decrease in error
      (*.f64 -9 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 t z)) a)): 0 points increase in error, 0 points decrease in error
    5. Applied egg-rr10.7

      \[\leadsto \color{blue}{\frac{-4.5 \cdot z}{\frac{a}{t}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 9 \leq -4 \cdot 10^{+216}:\\ \;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;z \cdot 9 \leq -1 \cdot 10^{-139}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a}, \frac{x}{2}, \left(9 \cdot \left(z \cdot t\right)\right) \cdot \frac{-0.5}{a}\right)\\ \mathbf{elif}\;z \cdot 9 \leq 5 \cdot 10^{-11}:\\ \;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\ \end{array} \]

Alternatives

Alternative 1
Error4.8
Cost8904
\[\begin{array}{l} t_1 := \frac{y \cdot x - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+290}:\\ \;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\ \end{array} \]
Alternative 2
Error5.0
Cost1608
\[\begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+125}:\\ \;\;\;\;t \cdot \left(z \cdot \frac{-4.5}{a}\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\frac{y \cdot x - t_1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\ \end{array} \]
Alternative 3
Error26.4
Cost1240
\[\begin{array}{l} t_1 := 0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\ t_2 := -4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{if}\;z \leq -1.1 \cdot 10^{+135}:\\ \;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;z \leq -3.745526105770942 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.198231315383873 \cdot 10^{-35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9.504351234452438 \cdot 10^{-283}:\\ \;\;\;\;x \cdot \frac{y}{\frac{a}{0.5}}\\ \mathbf{elif}\;z \leq 2.0913829374307953 \cdot 10^{-224}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.405940892000433 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\ \end{array} \]
Alternative 4
Error26.4
Cost1240
\[\begin{array}{l} t_1 := 0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\ t_2 := \frac{-9 \cdot \left(z \cdot t\right)}{a \cdot 2}\\ \mathbf{if}\;z \leq -1.1 \cdot 10^{+135}:\\ \;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;z \leq -3.745526105770942 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.198231315383873 \cdot 10^{-35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9.504351234452438 \cdot 10^{-283}:\\ \;\;\;\;x \cdot \frac{y}{\frac{a}{0.5}}\\ \mathbf{elif}\;z \leq 2.0913829374307953 \cdot 10^{-224}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.405940892000433 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\ \end{array} \]
Alternative 5
Error32.4
Cost712
\[\begin{array}{l} t_1 := 0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\ \mathbf{if}\;x \leq -1 \cdot 10^{+150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.5829542251452476 \cdot 10^{-188}:\\ \;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error31.1
Cost712
\[\begin{array}{l} t_1 := 0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\ \mathbf{if}\;a \leq -6.4 \cdot 10^{-33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.506181425296345 \cdot 10^{+75}:\\ \;\;\;\;\frac{0.5}{\frac{a}{y \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error31.0
Cost712
\[\begin{array}{l} t_1 := 0.5 \cdot \left(\frac{y}{a} \cdot x\right)\\ \mathbf{if}\;a \leq -1 \cdot 10^{-20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.35 \cdot 10^{+48}:\\ \;\;\;\;\frac{0.5 \cdot \left(y \cdot x\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error24.1
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -5.709523417542095 \cdot 10^{-56}:\\ \;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\ \mathbf{elif}\;y \leq 6951419.389301048:\\ \;\;\;\;\left(t \cdot -4.5\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{\frac{a}{0.5}}\\ \end{array} \]
Alternative 9
Error24.1
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -5.709523417542095 \cdot 10^{-56}:\\ \;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\ \mathbf{elif}\;y \leq 6951419.389301048:\\ \;\;\;\;t \cdot \frac{z}{\frac{a}{-4.5}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{\frac{a}{0.5}}\\ \end{array} \]
Alternative 10
Error24.1
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -5.709523417542095 \cdot 10^{-56}:\\ \;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\ \mathbf{elif}\;y \leq 6951419.389301048:\\ \;\;\;\;t \cdot \left(z \cdot \frac{-4.5}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{\frac{a}{0.5}}\\ \end{array} \]
Alternative 11
Error32.4
Cost448
\[0.5 \cdot \left(\frac{y}{a} \cdot x\right) \]

Error

Reproduce

herbie shell --seed 2022316 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"
  :precision binary64

  :herbie-target
  (if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))