Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I

?

Percentage Accurate: 91.4% → 90.7%
Time: 12.4s
Precision: binary64
Cost: 8008

?

\[ \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\\ \mathbf{if}\;t_1 \leq 4 \cdot 10^{-101}:\\ \;\;\;\;0.5 \cdot \frac{-9 \cdot \left(z \cdot t\right)}{a} + x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;t_1 \leq 10^{+292}:\\ \;\;\;\;\frac{1}{\frac{a}{0.5 \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\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)))
   (if (<= t_1 4e-101)
     (+ (* 0.5 (/ (* -9.0 (* z t)) a)) (* x (* y (/ 0.5 a))))
     (if (<= t_1 1e+292)
       (/ 1.0 (/ a (* 0.5 (fma x y (* z (* t -9.0))))))
       (* -4.5 (* t (/ z a)))))))
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 tmp;
	if (t_1 <= 4e-101) {
		tmp = (0.5 * ((-9.0 * (z * t)) / a)) + (x * (y * (0.5 / a)));
	} else if (t_1 <= 1e+292) {
		tmp = 1.0 / (a / (0.5 * fma(x, y, (z * (t * -9.0)))));
	} else {
		tmp = -4.5 * (t * (z / a));
	}
	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)
	tmp = 0.0
	if (t_1 <= 4e-101)
		tmp = Float64(Float64(0.5 * Float64(Float64(-9.0 * Float64(z * t)) / a)) + Float64(x * Float64(y * Float64(0.5 / a))));
	elseif (t_1 <= 1e+292)
		tmp = Float64(1.0 / Float64(a / Float64(0.5 * fma(x, y, Float64(z * Float64(t * -9.0))))));
	else
		tmp = Float64(-4.5 * Float64(t * Float64(z / a)));
	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]}, If[LessEqual[t$95$1, 4e-101], N[(N[(0.5 * N[(N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+292], N[(1.0 / N[(a / N[(0.5 * N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $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\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{-101}:\\
\;\;\;\;0.5 \cdot \frac{-9 \cdot \left(z \cdot t\right)}{a} + x \cdot \left(y \cdot \frac{0.5}{a}\right)\\

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

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


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 11 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Target

Original91.4%
Target93.6%
Herbie90.7%
\[\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 3 regimes
  2. if (*.f64 (*.f64 z 9) t) < 4.00000000000000021e-101

    1. Initial program 93.1%

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

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

      [Start]93.1%

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

      sub-neg [=>]93.1%

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

      +-commutative [=>]93.1%

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

      neg-sub0 [=>]93.1%

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

      associate-+l- [=>]93.1%

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

      sub0-neg [=>]93.1%

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

      neg-mul-1 [=>]93.1%

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

      associate-/l* [=>]93.0%

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

      associate-/r/ [=>]93.0%

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

      *-commutative [=>]93.0%

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

      sub-neg [=>]93.0%

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

      +-commutative [=>]93.0%

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

      neg-sub0 [=>]93.0%

      \[ \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]

      associate-+l- [=>]93.0%

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

      sub0-neg [=>]93.0%

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

      distribute-lft-neg-out [=>]93.0%

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

      distribute-rgt-neg-in [=>]93.0%

      \[ \color{blue}{\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \left(-\frac{-1}{a \cdot 2}\right)} \]
    3. Applied egg-rr93.6%

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

      [Start]93.6%

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

      associate-*r/ [=>]93.7%

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

      clear-num [=>]93.6%

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

      *-commutative [=>]93.6%

      \[ \frac{1}{\frac{a}{\color{blue}{0.5 \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}}} \]
    4. Applied egg-rr94.1%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right) + 0.5 \cdot \frac{-9 \cdot \left(t \cdot z\right)}{a}} \]
      Step-by-step derivation

      [Start]93.6%

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

      clear-num [<=]93.7%

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

      *-commutative [=>]93.7%

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

      associate-*r/ [<=]93.6%

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

      *-commutative [=>]93.6%

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

      fma-udef [=>]93.0%

      \[ \frac{0.5}{a} \cdot \color{blue}{\left(x \cdot y + z \cdot \left(t \cdot -9\right)\right)} \]

      distribute-lft-out [<=]93.0%

      \[ \color{blue}{\frac{0.5}{a} \cdot \left(x \cdot y\right) + \frac{0.5}{a} \cdot \left(z \cdot \left(t \cdot -9\right)\right)} \]

      *-commutative [=>]93.0%

      \[ \color{blue}{\left(x \cdot y\right) \cdot \frac{0.5}{a}} + \frac{0.5}{a} \cdot \left(z \cdot \left(t \cdot -9\right)\right) \]

      associate-*l* [=>]94.0%

      \[ \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} + \frac{0.5}{a} \cdot \left(z \cdot \left(t \cdot -9\right)\right) \]

      associate-*l/ [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + \color{blue}{\frac{0.5 \cdot \left(z \cdot \left(t \cdot -9\right)\right)}{a}} \]

      *-un-lft-identity [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + \frac{0.5 \cdot \left(z \cdot \left(t \cdot -9\right)\right)}{\color{blue}{1 \cdot a}} \]

      times-frac [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + \color{blue}{\frac{0.5}{1} \cdot \frac{z \cdot \left(t \cdot -9\right)}{a}} \]

      metadata-eval [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + \color{blue}{0.5} \cdot \frac{z \cdot \left(t \cdot -9\right)}{a} \]

      *-commutative [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + 0.5 \cdot \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a} \]

      *-commutative [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + 0.5 \cdot \frac{\color{blue}{\left(-9 \cdot t\right)} \cdot z}{a} \]

      associate-*l* [=>]94.1%

      \[ x \cdot \left(y \cdot \frac{0.5}{a}\right) + 0.5 \cdot \frac{\color{blue}{-9 \cdot \left(t \cdot z\right)}}{a} \]

    if 4.00000000000000021e-101 < (*.f64 (*.f64 z 9) t) < 1e292

    1. Initial program 96.9%

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

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

      [Start]96.9%

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

      sub-neg [=>]96.9%

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

      +-commutative [=>]96.9%

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

      neg-sub0 [=>]96.9%

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

      associate-+l- [=>]96.9%

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

      sub0-neg [=>]96.9%

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

      neg-mul-1 [=>]96.9%

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

      associate-/l* [=>]96.9%

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

      associate-/r/ [=>]96.7%

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

      *-commutative [=>]96.7%

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

      sub-neg [=>]96.7%

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

      +-commutative [=>]96.7%

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

      neg-sub0 [=>]96.7%

      \[ \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]

      associate-+l- [=>]96.7%

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

      sub0-neg [=>]96.7%

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

      distribute-lft-neg-out [=>]96.7%

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

      distribute-rgt-neg-in [=>]96.7%

      \[ \color{blue}{\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \left(-\frac{-1}{a \cdot 2}\right)} \]
    3. Applied egg-rr98.3%

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

      [Start]98.1%

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

      associate-*r/ [=>]98.2%

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

      clear-num [=>]98.3%

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

      *-commutative [=>]98.3%

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

    if 1e292 < (*.f64 (*.f64 z 9) t)

    1. Initial program 50.6%

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

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

      [Start]50.6%

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

      sub-neg [=>]50.6%

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

      +-commutative [=>]50.6%

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

      neg-sub0 [=>]50.6%

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

      associate-+l- [=>]50.6%

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

      sub0-neg [=>]50.6%

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

      neg-mul-1 [=>]50.6%

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

      associate-/l* [=>]50.6%

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

      associate-/r/ [=>]50.6%

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

      *-commutative [=>]50.6%

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

      sub-neg [=>]50.6%

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

      +-commutative [=>]50.6%

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

      neg-sub0 [=>]50.6%

      \[ \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]

      associate-+l- [=>]50.6%

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

      sub0-neg [=>]50.6%

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

      distribute-lft-neg-out [=>]50.6%

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

      distribute-rgt-neg-in [=>]50.6%

      \[ \color{blue}{\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \left(-\frac{-1}{a \cdot 2}\right)} \]
    3. Applied egg-rr50.6%

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

      [Start]50.6%

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

      associate-*r/ [=>]50.6%

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

      clear-num [=>]50.6%

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

      *-commutative [=>]50.6%

      \[ \frac{1}{\frac{a}{\color{blue}{0.5 \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}}} \]
    4. Taylor expanded in x around 0 50.6%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
      Step-by-step derivation

      [Start]50.6%

      \[ -4.5 \cdot \frac{t \cdot z}{a} \]

      *-commutative [=>]50.6%

      \[ -4.5 \cdot \frac{\color{blue}{z \cdot t}}{a} \]

      associate-*l/ [<=]100.0%

      \[ -4.5 \cdot \color{blue}{\left(\frac{z}{a} \cdot t\right)} \]

      *-commutative [=>]100.0%

      \[ -4.5 \cdot \color{blue}{\left(t \cdot \frac{z}{a}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.6%

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

Alternatives

Alternative 1
Accuracy90.7%
Cost8008
\[\begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_1 \leq 4 \cdot 10^{-101}:\\ \;\;\;\;0.5 \cdot \frac{-9 \cdot \left(z \cdot t\right)}{a} + x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;t_1 \leq 10^{+292}:\\ \;\;\;\;\frac{1}{\frac{a}{0.5 \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array} \]
Alternative 2
Accuracy90.4%
Cost7880
\[\begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;0.5 \cdot \frac{-9 \cdot \left(z \cdot t\right)}{a} + x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+287}:\\ \;\;\;\;\frac{0.5}{a} \cdot \mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array} \]
Alternative 3
Accuracy90.4%
Cost1608
\[\begin{array}{l} t_1 := -9 \cdot \left(z \cdot t\right)\\ t_2 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_2 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;0.5 \cdot \frac{t_1}{a} + x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;t_2 \leq 10^{+292}:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(t_1 + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array} \]
Alternative 4
Accuracy93.3%
Cost1220
\[\begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \leq 10^{+292}:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(-9 \cdot \left(z \cdot t\right) + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array} \]
Alternative 5
Accuracy66.6%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+46} \lor \neg \left(x \leq 5.2 \cdot 10^{-193}\right):\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\ \end{array} \]
Alternative 6
Accuracy68.7%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{+41} \lor \neg \left(x \leq 3.7 \cdot 10^{-122}\right):\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\ \end{array} \]
Alternative 7
Accuracy67.6%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+42}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-193}:\\ \;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot \left(y \cdot 0.5\right)\\ \end{array} \]
Alternative 8
Accuracy67.6%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+43}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-193}:\\ \;\;\;\;\frac{\left(z \cdot t\right) \cdot -4.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot \left(y \cdot 0.5\right)\\ \end{array} \]
Alternative 9
Accuracy51.0%
Cost580
\[\begin{array}{l} \mathbf{if}\;t \leq 5.3 \cdot 10^{+213}:\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array} \]
Alternative 10
Accuracy50.9%
Cost580
\[\begin{array}{l} \mathbf{if}\;t \leq 1.85 \cdot 10^{+214}:\\ \;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array} \]
Alternative 11
Accuracy51.2%
Cost448
\[-4.5 \cdot \left(t \cdot \frac{z}{a}\right) \]

Reproduce?

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