Average Error: 7.7 → 4.9
Time: 13.4s
Precision: binary64
Cost: 8396
\[ \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} t_1 := \left(z \cdot 9\right) \cdot t\\ t_2 := 0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+146}:\\ \;\;\;\;\mathsf{fma}\left(z \cdot \frac{t}{a}, -4.5, \frac{y \cdot 0.5}{\frac{a}{x}}\right)\\ \mathbf{elif}\;t_1 \leq -5 \cdot 10^{-274}:\\ \;\;\;\;\frac{y \cdot x + t \cdot \left(z \cdot -9\right)}{a \cdot 2}\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(-4.5, \frac{t}{\frac{a}{z}}, t_2\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{-11}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \frac{y \cdot x}{a}\\ \mathbf{else}:\\ \;\;\;\;t_2 + \frac{t}{a} \cdot \left(z \cdot -4.5\right)\\ \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
 (let* ((t_1 (* (* z 9.0) t)) (t_2 (* 0.5 (/ y (/ a x)))))
   (if (<= t_1 -4e+146)
     (fma (* z (/ t a)) -4.5 (/ (* y 0.5) (/ a x)))
     (if (<= t_1 -5e-274)
       (/ (+ (* y x) (* t (* z -9.0))) (* a 2.0))
       (if (<= t_1 0.0)
         (fma -4.5 (/ t (/ a z)) t_2)
         (if (<= t_1 5e-11)
           (+ (* -4.5 (/ (* z t) a)) (* 0.5 (/ (* y x) a)))
           (+ t_2 (* (/ t a) (* z -4.5)))))))))
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 t_1 = (z * 9.0) * t;
	double t_2 = 0.5 * (y / (a / x));
	double tmp;
	if (t_1 <= -4e+146) {
		tmp = fma((z * (t / a)), -4.5, ((y * 0.5) / (a / x)));
	} else if (t_1 <= -5e-274) {
		tmp = ((y * x) + (t * (z * -9.0))) / (a * 2.0);
	} else if (t_1 <= 0.0) {
		tmp = fma(-4.5, (t / (a / z)), t_2);
	} else if (t_1 <= 5e-11) {
		tmp = (-4.5 * ((z * t) / a)) + (0.5 * ((y * x) / a));
	} else {
		tmp = t_2 + ((t / a) * (z * -4.5));
	}
	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)
	t_1 = Float64(Float64(z * 9.0) * t)
	t_2 = Float64(0.5 * Float64(y / Float64(a / x)))
	tmp = 0.0
	if (t_1 <= -4e+146)
		tmp = fma(Float64(z * Float64(t / a)), -4.5, Float64(Float64(y * 0.5) / Float64(a / x)));
	elseif (t_1 <= -5e-274)
		tmp = Float64(Float64(Float64(y * x) + Float64(t * Float64(z * -9.0))) / Float64(a * 2.0));
	elseif (t_1 <= 0.0)
		tmp = fma(-4.5, Float64(t / Float64(a / z)), t_2);
	elseif (t_1 <= 5e-11)
		tmp = Float64(Float64(-4.5 * Float64(Float64(z * t) / a)) + Float64(0.5 * Float64(Float64(y * x) / a)));
	else
		tmp = Float64(t_2 + Float64(Float64(t / a) * Float64(z * -4.5)));
	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_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+146], N[(N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision] * -4.5 + N[(N[(y * 0.5), $MachinePrecision] / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-274], N[(N[(N[(y * x), $MachinePrecision] + N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 5e-11], N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(t / a), $MachinePrecision] * N[(z * -4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
t_2 := 0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+146}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \frac{t}{a}, -4.5, \frac{y \cdot 0.5}{\frac{a}{x}}\right)\\

\mathbf{elif}\;t_1 \leq -5 \cdot 10^{-274}:\\
\;\;\;\;\frac{y \cdot x + t \cdot \left(z \cdot -9\right)}{a \cdot 2}\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(-4.5, \frac{t}{\frac{a}{z}}, t_2\right)\\

\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-11}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \frac{y \cdot x}{a}\\

\mathbf{else}:\\
\;\;\;\;t_2 + \frac{t}{a} \cdot \left(z \cdot -4.5\right)\\


\end{array}

Error

Target

Original7.7
Target5.5
Herbie4.9
\[\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 5 regimes
  2. if (*.f64 (*.f64 z 9) t) < -3.99999999999999973e146

    1. Initial program 20.4

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

      \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)} \]
      Proof
      (*.f64 (/.f64 1/2 a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1/2)) a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 (Rewrite<= metadata-eval (/.f64 -1 2))) a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (/.f64 -1 2) a))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 2 a)))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (Rewrite<= *-commutative_binary64 (*.f64 a 2)))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t))))): 13 points increase in error, 19 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)))): 0 points increase in error, 2 points decrease in error
      (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 (/.f64 -1 (*.f64 a 2)) (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-out_binary64 (*.f64 (/.f64 -1 (*.f64 a 2)) (neg.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 x y))) (*.f64 (*.f64 z 9) t))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r/_binary64 (/.f64 -1 (/.f64 (*.f64 a 2) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))))): 41 points increase in error, 41 points decrease in error
      (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 -1 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 a 2))): 28 points increase in error, 36 points decrease in error
      (/.f64 (Rewrite<= neg-mul-1_binary64 (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 (neg.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 (neg.f64 (*.f64 x y))) (neg.f64 (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite=> remove-double-neg_binary64 (*.f64 x y)) (neg.f64 (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub-neg_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 19.8

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    4. Applied egg-rr2.9

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

    if -3.99999999999999973e146 < (*.f64 (*.f64 z 9) t) < -5e-274

    1. Initial program 3.7

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

    if -5e-274 < (*.f64 (*.f64 z 9) t) < 0.0

    1. Initial program 6.6

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0 6.6

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    3. Simplified7.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4.5, \frac{t}{\frac{a}{z}}, 0.5 \cdot \frac{y}{\frac{a}{x}}\right)} \]
      Proof
      (fma.f64 -9/2 (/.f64 t (/.f64 a z)) (*.f64 1/2 (/.f64 y (/.f64 a x)))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 t z) a)) (*.f64 1/2 (/.f64 y (/.f64 a x)))): 22 points increase in error, 35 points decrease in error
      (fma.f64 -9/2 (/.f64 (*.f64 t z) a) (*.f64 1/2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y x) a)))): 28 points increase in error, 32 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 -9/2 (/.f64 (*.f64 t z) a)) (*.f64 1/2 (/.f64 (*.f64 y x) a)))): 1 points increase in error, 3 points decrease in error

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

    1. Initial program 3.8

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

      \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)} \]
      Proof
      (*.f64 (/.f64 1/2 a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1/2)) a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 (Rewrite<= metadata-eval (/.f64 -1 2))) a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (/.f64 -1 2) a))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 2 a)))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (Rewrite<= *-commutative_binary64 (*.f64 a 2)))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t))))): 13 points increase in error, 19 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)))): 0 points increase in error, 2 points decrease in error
      (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 (/.f64 -1 (*.f64 a 2)) (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-out_binary64 (*.f64 (/.f64 -1 (*.f64 a 2)) (neg.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 x y))) (*.f64 (*.f64 z 9) t))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r/_binary64 (/.f64 -1 (/.f64 (*.f64 a 2) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))))): 41 points increase in error, 41 points decrease in error
      (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 -1 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 a 2))): 28 points increase in error, 36 points decrease in error
      (/.f64 (Rewrite<= neg-mul-1_binary64 (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 (neg.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 (neg.f64 (*.f64 x y))) (neg.f64 (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite=> remove-double-neg_binary64 (*.f64 x y)) (neg.f64 (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub-neg_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 3.8

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]

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

    1. Initial program 12.3

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

      \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)} \]
      Proof
      (*.f64 (/.f64 1/2 a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1/2)) a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (neg.f64 (Rewrite<= metadata-eval (/.f64 -1 2))) a) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (/.f64 -1 2) a))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 2 a)))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (Rewrite<= *-commutative_binary64 (*.f64 a 2)))) (fma.f64 x y (*.f64 z (*.f64 t -9)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t))))): 13 points increase in error, 19 points decrease in error
      (*.f64 (neg.f64 (/.f64 -1 (*.f64 a 2))) (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)))): 0 points increase in error, 2 points decrease in error
      (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 (/.f64 -1 (*.f64 a 2)) (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-out_binary64 (*.f64 (/.f64 -1 (*.f64 a 2)) (neg.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (*.f64 x y))) (*.f64 (*.f64 z 9) t))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 -1 (*.f64 a 2)) (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r/_binary64 (/.f64 -1 (/.f64 (*.f64 a 2) (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))))): 41 points increase in error, 41 points decrease in error
      (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 -1 (-.f64 (*.f64 (*.f64 z 9) t) (*.f64 x y))) (*.f64 a 2))): 28 points increase in error, 36 points decrease in error
      (/.f64 (Rewrite<= neg-mul-1_binary64 (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 (neg.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 (*.f64 z 9) t) (neg.f64 (*.f64 x y))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (neg.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 (*.f64 x y)) (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 (neg.f64 (*.f64 x y))) (neg.f64 (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite=> remove-double-neg_binary64 (*.f64 x y)) (neg.f64 (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub-neg_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 12.0

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    4. Applied egg-rr7.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{t}{a} \cdot z, -4.5, \frac{y \cdot 0.5}{\frac{a}{x}}\right)} \]
    5. Applied egg-rr7.2

      \[\leadsto \color{blue}{\frac{t}{a} \cdot \left(z \cdot -4.5\right) + 0.5 \cdot \frac{y}{\frac{a}{x}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification4.9

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

Alternatives

Alternative 1
Error4.9
Cost8396
\[\begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ t_2 := 0.5 \cdot \frac{y}{\frac{a}{x}}\\ t_3 := t_2 + \frac{t}{a} \cdot \left(z \cdot -4.5\right)\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+146}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_1 \leq -5 \cdot 10^{-274}:\\ \;\;\;\;\frac{y \cdot x + t \cdot \left(z \cdot -9\right)}{a \cdot 2}\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(-4.5, \frac{t}{\frac{a}{z}}, t_2\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{-11}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \frac{y \cdot x}{a}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error4.5
Cost2760
\[\begin{array}{l} t_1 := \left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ t_2 := \frac{y \cdot x + t \cdot \left(z \cdot -9\right)}{a \cdot 2}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+299}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \frac{y \cdot x}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error4.5
Cost2632
\[\begin{array}{l} t_1 := \left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ t_2 := \frac{y \cdot x + t \cdot \left(z \cdot -9\right)}{a \cdot 2}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+299}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error4.9
Cost2512
\[\begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ t_2 := 0.5 \cdot \frac{y}{\frac{a}{x}} + \frac{t}{a} \cdot \left(z \cdot -4.5\right)\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{+146}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq -5 \cdot 10^{-274}:\\ \;\;\;\;\frac{y \cdot x + t \cdot \left(z \cdot -9\right)}{a \cdot 2}\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{-11}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \frac{y \cdot x}{a}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error24.7
Cost1372
\[\begin{array}{l} t_1 := 0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\ t_2 := \left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+130}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+78}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{elif}\;z \leq -0.00027:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-21}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-65}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error24.8
Cost1372
\[\begin{array}{l} t_1 := 0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\ t_2 := \left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ \mathbf{if}\;z \leq -1 \cdot 10^{+131}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -4 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{+78}:\\ \;\;\;\;\left(z \cdot t\right) \cdot \frac{-4.5}{a}\\ \mathbf{elif}\;z \leq -0.00031:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.68 \cdot 10^{-21}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-67}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error24.3
Cost1240
\[\begin{array}{l} t_1 := \frac{y \cdot 0.5}{\frac{a}{x}}\\ t_2 := \left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{+130}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+78}:\\ \;\;\;\;\left(z \cdot t\right) \cdot \frac{-4.5}{a}\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-215}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{0.5}{a}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-156}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-145}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error7.8
Cost1096
\[\begin{array}{l} t_1 := \frac{0.5}{a} \cdot \left(y \cdot x + \left(z \cdot t\right) \cdot -9\right)\\ \mathbf{if}\;y \leq 4.7 \cdot 10^{+254}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+281}:\\ \;\;\;\;\frac{y \cdot 0.5}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error23.8
Cost976
\[\begin{array}{l} t_1 := 0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\ \mathbf{if}\;x \leq -2 \cdot 10^{+31}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.55 \cdot 10^{-49}:\\ \;\;\;\;\left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-187}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error24.1
Cost976
\[\begin{array}{l} t_1 := \left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{+114}:\\ \;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{+78}:\\ \;\;\;\;\left(z \cdot t\right) \cdot \frac{-4.5}{a}\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-180}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error31.9
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{-108}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \frac{t}{a}\right) \cdot -4.5\\ \end{array} \]
Alternative 12
Error32.3
Cost448
\[\left(z \cdot \frac{t}{a}\right) \cdot -4.5 \]

Error

Reproduce

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