Average Error: 20.7 → 7.7
Time: 6.8s
Precision: binary64
\[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.3974205239249899 \cdot 10^{271}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot y\right) \cdot \frac{1}{c}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le -4.74459581184539511 \cdot 10^{228}:\\ \;\;\;\;\left(\frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{z} \cdot \frac{\sqrt[3]{b}}{c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;z \le -3.4832840638970871 \cdot 10^{56}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 5.9081829346869604 \cdot 10^{-62}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;z \le -2.3974205239249899 \cdot 10^{271}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot y\right) \cdot \frac{1}{c}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;z \le -4.74459581184539511 \cdot 10^{228}:\\
\;\;\;\;\left(\frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{z} \cdot \frac{\sqrt[3]{b}}{c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}\\

\mathbf{elif}\;z \le -3.4832840638970871 \cdot 10^{56}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;z \le 5.9081829346869604 \cdot 10^{-62}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\end{array}
double code(double x, double y, double z, double t, double a, double b, double c) {
	return ((double) (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c))));
}
double code(double x, double y, double z, double t, double a, double b, double c) {
	double VAR;
	if ((z <= -2.39742052392499e+271)) {
		VAR = ((double) (((double) (((double) (b / ((double) (z * c)))) + ((double) (9.0 * ((double) (((double) (((double) (x / z)) * y)) * ((double) (1.0 / c)))))))) - ((double) (4.0 * ((double) (a / ((double) (c / t))))))));
	} else {
		double VAR_1;
		if ((z <= -4.744595811845395e+228)) {
			VAR_1 = ((double) (((double) (((double) (((double) (((double) (((double) cbrt(b)) * ((double) cbrt(b)))) / z)) * ((double) (((double) cbrt(b)) / c)))) + ((double) (9.0 * ((double) (((double) (x * y)) / ((double) (z * c)))))))) - ((double) (4.0 * ((double) (((double) (a * t)) / c))))));
		} else {
			double VAR_2;
			if ((z <= -3.483284063897087e+56)) {
				VAR_2 = ((double) (((double) (((double) (b / ((double) (z * c)))) + ((double) (9.0 * ((double) (((double) (((double) (x / z)) * ((double) (((double) (((double) cbrt(y)) * ((double) cbrt(y)))) / ((double) (((double) cbrt(c)) * ((double) cbrt(c)))))))) * ((double) (((double) cbrt(y)) / ((double) cbrt(c)))))))))) - ((double) (4.0 * ((double) (a / ((double) (c / t))))))));
			} else {
				double VAR_3;
				if ((z <= 5.90818293468696e-62)) {
					VAR_3 = ((double) (((double) (((double) (b / ((double) (z * c)))) + ((double) (9.0 * ((double) (((double) (x * y)) / ((double) (z * c)))))))) - ((double) (4.0 * ((double) (a * ((double) (t / c))))))));
				} else {
					VAR_3 = ((double) (((double) (((double) (b / ((double) (z * c)))) + ((double) (9.0 * ((double) (((double) (((double) (x / z)) * ((double) (((double) (((double) cbrt(y)) * ((double) cbrt(y)))) / ((double) (((double) cbrt(c)) * ((double) cbrt(c)))))))) * ((double) (((double) cbrt(y)) / ((double) cbrt(c)))))))))) - ((double) (4.0 * ((double) (a / ((double) (c / t))))))));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.7
Target14.7
Herbie7.7
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.10015674080410512 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.17088779117474882 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.8768236795461372 \cdot 10^{130}:\\ \;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.3838515042456319 \cdot 10^{158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if z < -2.3974205239249899e271

    1. Initial program 42.3

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 15.1

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*16.0

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied times-frac14.6

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \color{blue}{\left(\frac{x}{z} \cdot \frac{y}{c}\right)}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    7. Using strategy rm
    8. Applied div-inv14.6

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z} \cdot \color{blue}{\left(y \cdot \frac{1}{c}\right)}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    9. Applied associate-*r*10.0

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

    if -2.3974205239249899e271 < z < -4.74459581184539511e228

    1. Initial program 39.9

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 15.5

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt15.6

      \[\leadsto \left(\frac{\color{blue}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}}}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}\]
    5. Applied times-frac14.8

      \[\leadsto \left(\color{blue}{\frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{z} \cdot \frac{\sqrt[3]{b}}{c}} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}\]

    if -4.74459581184539511e228 < z < -3.4832840638970871e56 or 5.9081829346869604e-62 < z

    1. Initial program 27.8

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 13.7

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*14.6

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied times-frac11.0

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \color{blue}{\left(\frac{x}{z} \cdot \frac{y}{c}\right)}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt11.2

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z} \cdot \frac{y}{\color{blue}{\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right) \cdot \sqrt[3]{c}}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    9. Applied add-cube-cbrt11.3

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z} \cdot \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right) \cdot \sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    10. Applied times-frac11.3

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z} \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    11. Applied associate-*r*8.3

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \color{blue}{\left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]

    if -3.4832840638970871e56 < z < 5.9081829346869604e-62

    1. Initial program 6.9

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 8.9

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity8.9

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{\color{blue}{1 \cdot c}}\]
    5. Applied times-frac5.9

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\left(\frac{a}{1} \cdot \frac{t}{c}\right)}\]
    6. Simplified5.9

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(\color{blue}{a} \cdot \frac{t}{c}\right)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.3974205239249899 \cdot 10^{271}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot y\right) \cdot \frac{1}{c}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le -4.74459581184539511 \cdot 10^{228}:\\ \;\;\;\;\left(\frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{z} \cdot \frac{\sqrt[3]{b}}{c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;z \le -3.4832840638970871 \cdot 10^{56}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 5.9081829346869604 \cdot 10^{-62}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{c} \cdot \sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{c}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020153 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"
  :precision binary64

  :herbie-target
  (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -1.1001567408041051e-171) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9.0 (/ y c)) (/ x z)) (/ b (* c z))) (* 4.0 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (- (+ (* 9.0 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4.0 (/ (* a t) c))))))))

  (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))