Average Error: 7.7 → 4.0
Time: 5.9s
Precision: binary64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.1946644378395818 \cdot 10^{+157}:\\ \;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\ \mathbf{elif}\;x \cdot y \leq -3.945575518712505 \cdot 10^{-233}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2}\\ \mathbf{elif}\;x \cdot y \leq 4.5098826906000265 \cdot 10^{-235}:\\ \;\;\;\;y \cdot \frac{x}{a \cdot 2} - \frac{9}{2} \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{elif}\;x \cdot y \leq 6.101385177587424 \cdot 10^{+99}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(\sqrt[3]{x} \cdot \frac{\sqrt[3]{x}}{a}\right)\right) \cdot \frac{\sqrt[3]{x}}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.1946644378395818 \cdot 10^{+157}:\\
\;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\

\mathbf{elif}\;x \cdot y \leq -3.945575518712505 \cdot 10^{-233}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2}\\

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

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

\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(\sqrt[3]{x} \cdot \frac{\sqrt[3]{x}}{a}\right)\right) \cdot \frac{\sqrt[3]{x}}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\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
 (if (<= (* x y) -1.1946644378395818e+157)
   (- (* (/ y a) (/ x 2.0)) (* t (* (/ z a) (/ 9.0 2.0))))
   (if (<= (* x y) -3.945575518712505e-233)
     (* (/ 1.0 a) (/ (- (* x y) (* z (* t 9.0))) 2.0))
     (if (<= (* x y) 4.5098826906000265e-235)
       (- (* y (/ x (* a 2.0))) (* (/ 9.0 2.0) (* t (/ z a))))
       (if (<= (* x y) 6.101385177587424e+99)
         (* (/ 1.0 a) (/ (- (* x y) (* z (* t 9.0))) 2.0))
         (-
          (* (* y (* (cbrt x) (/ (cbrt x) a))) (/ (cbrt x) 2.0))
          (* t (* (/ z a) (/ 9.0 2.0)))))))))
double code(double x, double y, double z, double t, double a) {
	return (((double) (((double) (x * y)) - ((double) (((double) (z * 9.0)) * t)))) / ((double) (a * 2.0)));
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((((double) (x * y)) <= -1.1946644378395818e+157)) {
		tmp = ((double) (((double) ((y / a) * (x / 2.0))) - ((double) (t * ((double) ((z / a) * (9.0 / 2.0)))))));
	} else {
		double tmp_1;
		if ((((double) (x * y)) <= -3.945575518712505e-233)) {
			tmp_1 = ((double) ((1.0 / a) * (((double) (((double) (x * y)) - ((double) (z * ((double) (t * 9.0)))))) / 2.0)));
		} else {
			double tmp_2;
			if ((((double) (x * y)) <= 4.5098826906000265e-235)) {
				tmp_2 = ((double) (((double) (y * (x / ((double) (a * 2.0))))) - ((double) ((9.0 / 2.0) * ((double) (t * (z / a)))))));
			} else {
				double tmp_3;
				if ((((double) (x * y)) <= 6.101385177587424e+99)) {
					tmp_3 = ((double) ((1.0 / a) * (((double) (((double) (x * y)) - ((double) (z * ((double) (t * 9.0)))))) / 2.0)));
				} else {
					tmp_3 = ((double) (((double) (((double) (y * ((double) (((double) cbrt(x)) * (((double) cbrt(x)) / a))))) * (((double) cbrt(x)) / 2.0))) - ((double) (t * ((double) ((z / a) * (9.0 / 2.0)))))));
				}
				tmp_2 = tmp_3;
			}
			tmp_1 = tmp_2;
		}
		tmp = tmp_1;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.7
Target5.7
Herbie4.0
\[\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 (* x y) < -1.19466443783958176e157

    1. Initial program Error: 24.5 bits

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-subError: 24.5 bits

      \[\leadsto \color{blue}{\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}}\]
    4. SimplifiedError: 7.9 bits

      \[\leadsto \color{blue}{y \cdot \frac{x}{a \cdot 2}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    5. SimplifiedError: 1.9 bits

      \[\leadsto y \cdot \frac{x}{a \cdot 2} - \color{blue}{t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)}\]
    6. Using strategy rm
    7. Applied *-un-lft-identityError: 1.9 bits

      \[\leadsto y \cdot \frac{\color{blue}{1 \cdot x}}{a \cdot 2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
    8. Applied times-fracError: 1.9 bits

      \[\leadsto y \cdot \color{blue}{\left(\frac{1}{a} \cdot \frac{x}{2}\right)} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
    9. Applied associate-*r*Error: 2.1 bits

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a}\right) \cdot \frac{x}{2}} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
    10. SimplifiedError: 2.0 bits

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

    if -1.19466443783958176e157 < (* x y) < -3.94557551871250505e-233 or 4.5098826906000265e-235 < (* x y) < 6.1013851775874236e99

    1. Initial program Error: 3.3 bits

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied *-un-lft-identityError: 3.3 bits

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)}}{a \cdot 2}\]
    4. Applied times-fracError: 3.4 bits

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{2}}\]
    5. SimplifiedError: 3.3 bits

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

    if -3.94557551871250505e-233 < (* x y) < 4.5098826906000265e-235

    1. Initial program Error: 5.9 bits

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-subError: 5.9 bits

      \[\leadsto \color{blue}{\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}}\]
    4. SimplifiedError: 5.2 bits

      \[\leadsto \color{blue}{y \cdot \frac{x}{a \cdot 2}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    5. SimplifiedError: 6.5 bits

      \[\leadsto y \cdot \frac{x}{a \cdot 2} - \color{blue}{t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)}\]
    6. Using strategy rm
    7. Applied associate-*r*Error: 6.6 bits

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

    if 6.1013851775874236e99 < (* x y)

    1. Initial program Error: 18.5 bits

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-subError: 18.5 bits

      \[\leadsto \color{blue}{\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}}\]
    4. SimplifiedError: 8.8 bits

      \[\leadsto \color{blue}{y \cdot \frac{x}{a \cdot 2}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    5. SimplifiedError: 4.1 bits

      \[\leadsto y \cdot \frac{x}{a \cdot 2} - \color{blue}{t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)}\]
    6. Using strategy rm
    7. Applied add-cube-cbrtError: 5.0 bits

      \[\leadsto y \cdot \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{a \cdot 2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
    8. Applied times-fracError: 4.7 bits

      \[\leadsto y \cdot \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{a} \cdot \frac{\sqrt[3]{x}}{2}\right)} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
    9. Applied associate-*r*Error: 3.6 bits

      \[\leadsto \color{blue}{\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{a}\right) \cdot \frac{\sqrt[3]{x}}{2}} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
    10. SimplifiedError: 3.6 bits

      \[\leadsto \color{blue}{\left(y \cdot \left(\frac{\sqrt[3]{x}}{a} \cdot \sqrt[3]{x}\right)\right)} \cdot \frac{\sqrt[3]{x}}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\]
  3. Recombined 4 regimes into one program.
  4. Final simplificationError: 4.0 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.1946644378395818 \cdot 10^{+157}:\\ \;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\ \mathbf{elif}\;x \cdot y \leq -3.945575518712505 \cdot 10^{-233}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2}\\ \mathbf{elif}\;x \cdot y \leq 4.5098826906000265 \cdot 10^{-235}:\\ \;\;\;\;y \cdot \frac{x}{a \cdot 2} - \frac{9}{2} \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{elif}\;x \cdot y \leq 6.101385177587424 \cdot 10^{+99}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(\sqrt[3]{x} \cdot \frac{\sqrt[3]{x}}{a}\right)\right) \cdot \frac{\sqrt[3]{x}}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\ \end{array}\]

Reproduce

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