Average Error: 7.8 → 5.9
Time: 6.3s
Precision: binary64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -4.175740189811104 \cdot 10^{-35}:\\ \;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\ \mathbf{elif}\;x \leq 1.1206573610708866 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{2 \cdot \frac{a}{x \cdot y - z \cdot \left(t \cdot 9\right)}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a \cdot 2} - \frac{9}{2} \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \leq -4.175740189811104 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\

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

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a \cdot 2} - \frac{9}{2} \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
 (if (<= x -4.175740189811104e-35)
   (- (* (/ y a) (/ x 2.0)) (* t (* (/ z a) (/ 9.0 2.0))))
   (if (<= x 1.1206573610708866e+135)
     (/ 1.0 (* 2.0 (/ a (- (* x y) (* z (* t 9.0))))))
     (- (* y (/ x (* a 2.0))) (* (/ 9.0 2.0) (* t (/ z a)))))))
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 ((x <= -4.175740189811104e-35)) {
		tmp = ((double) (((double) ((y / a) * (x / 2.0))) - ((double) (t * ((double) ((z / a) * (9.0 / 2.0)))))));
	} else {
		double tmp_1;
		if ((x <= 1.1206573610708866e+135)) {
			tmp_1 = (1.0 / ((double) (2.0 * (a / ((double) (((double) (x * y)) - ((double) (z * ((double) (t * 9.0))))))))));
		} else {
			tmp_1 = ((double) (((double) (y * (x / ((double) (a * 2.0))))) - ((double) ((9.0 / 2.0) * ((double) (t * (z / a)))))));
		}
		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.8
Target5.7
Herbie5.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 3 regimes
  2. if x < -4.17574018981110384e-35

    1. Initial program Error: 11.3 bits

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-subError: 11.3 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: 7.4 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: 7.4 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: 7.5 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: 6.2 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: 6.2 bits

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

    if -4.17574018981110384e-35 < x < 1.1206573610708866e135

    1. Initial program Error: 5.0 bits

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

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

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

    if 1.1206573610708866e135 < x

    1. Initial program Error: 15.7 bits

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{a \cdot 2}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    5. SimplifiedError: 9.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 associate-*r*Error: 9.1 bits

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.175740189811104 \cdot 10^{-35}:\\ \;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - t \cdot \left(\frac{z}{a} \cdot \frac{9}{2}\right)\\ \mathbf{elif}\;x \leq 1.1206573610708866 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{2 \cdot \frac{a}{x \cdot y - z \cdot \left(t \cdot 9\right)}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a \cdot 2} - \frac{9}{2} \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array}\]

Reproduce

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