Average Error: 7.9 → 1.3
Time: 16.9s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \leq -2.8008563787642985 \cdot 10^{+283} \lor \neg \left(\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \leq 3.338319463100624 \cdot 10^{+294}\right):\\ \;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \left(4.5 \cdot \frac{z}{\sqrt[3]{a}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \leq -2.8008563787642985 \cdot 10^{+283} \lor \neg \left(\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \leq 3.338319463100624 \cdot 10^{+294}\right):\\
\;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \left(4.5 \cdot \frac{z}{\sqrt[3]{a}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\\

\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 (or (<=
          (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0))
          -2.8008563787642985e+283)
         (not
          (<=
           (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0))
           3.338319463100624e+294)))
   (-
    (* (/ x a) (/ y 2.0))
    (* (/ t (* (cbrt a) (cbrt a))) (* 4.5 (/ z (cbrt a)))))
   (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0))))
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 (((((x * y) - ((z * 9.0) * t)) / (a * 2.0)) <= -2.8008563787642985e+283) || !((((x * y) - ((z * 9.0) * t)) / (a * 2.0)) <= 3.338319463100624e+294)) {
		tmp = ((x / a) * (y / 2.0)) - ((t / (cbrt(a) * cbrt(a))) * (4.5 * (z / cbrt(a))));
	} else {
		tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
	}
	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.9
Target5.3
Herbie1.3
\[\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 2 regimes
  2. if (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) (*.f64 a 2)) < -2.80085637876429845e283 or 3.33831946310062391e294 < (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) (*.f64 a 2))

    1. Initial program 52.3

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

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

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \color{blue}{\frac{t \cdot z}{a} \cdot 4.5}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt_binary6451.8

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \frac{t \cdot z}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} \cdot 4.5\]
    7. Applied times-frac_binary6429.1

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \color{blue}{\left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)} \cdot 4.5\]
    8. Applied associate-*l*_binary6429.1

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

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \color{blue}{\left(4.5 \cdot \frac{z}{\sqrt[3]{a}}\right)}\]
    10. Using strategy rm
    11. Applied times-frac_binary644.3

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

    if -2.80085637876429845e283 < (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) (*.f64 a 2)) < 3.33831946310062391e294

    1. Initial program 0.9

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

      \[\leadsto \frac{\color{blue}{{\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)}^{1}}}{a \cdot 2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \leq -2.8008563787642985 \cdot 10^{+283} \lor \neg \left(\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \leq 3.338319463100624 \cdot 10^{+294}\right):\\ \;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \left(4.5 \cdot \frac{z}{\sqrt[3]{a}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \end{array}\]

Alternatives

Reproduce

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