Average Error: 20.4 → 9.1
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}\;y \leq -1.8297439497525036 \cdot 10^{+21}:\\ \;\;\;\;\frac{b}{z \cdot c} + \left(9 \cdot \left(y \cdot \frac{\frac{x}{z}}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\right)\\ \mathbf{elif}\;y \leq -4.3366014336811505 \cdot 10^{-101}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + x \cdot \left(y \cdot 9\right)}} - 4 \cdot \left(t \cdot a\right)}{c}\\ \mathbf{elif}\;y \leq 2.4452607704569994 \cdot 10^{-237}:\\ \;\;\;\;\frac{b + x \cdot \left(y \cdot 9\right)}{z \cdot c} - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \mathbf{elif}\;y \leq 9.042159349952659 \cdot 10^{-35}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + x \cdot \left(y \cdot 9\right)}} - 4 \cdot \left(t \cdot a\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{b}{c} + \left(9 \cdot \left(y \cdot \frac{x}{z \cdot c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\right)\\ \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}\;y \leq -1.8297439497525036 \cdot 10^{+21}:\\
\;\;\;\;\frac{b}{z \cdot c} + \left(9 \cdot \left(y \cdot \frac{\frac{x}{z}}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\right)\\

\mathbf{elif}\;y \leq -4.3366014336811505 \cdot 10^{-101}:\\
\;\;\;\;\frac{\frac{1}{\frac{z}{b + x \cdot \left(y \cdot 9\right)}} - 4 \cdot \left(t \cdot a\right)}{c}\\

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

\mathbf{elif}\;y \leq 9.042159349952659 \cdot 10^{-35}:\\
\;\;\;\;\frac{\frac{1}{\frac{z}{b + x \cdot \left(y \cdot 9\right)}} - 4 \cdot \left(t \cdot a\right)}{c}\\

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

\end{array}
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((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 ((y <= -1.8297439497525036e+21)) {
		VAR = ((double) ((b / ((double) (z * c))) + ((double) (((double) (9.0 * ((double) (y * ((x / z) / c))))) - ((double) (4.0 * ((double) (t * (a / c)))))))));
	} else {
		double VAR_1;
		if ((y <= -4.3366014336811505e-101)) {
			VAR_1 = (((double) ((1.0 / (z / ((double) (b + ((double) (x * ((double) (y * 9.0)))))))) - ((double) (4.0 * ((double) (t * a)))))) / c);
		} else {
			double VAR_2;
			if ((y <= 2.4452607704569994e-237)) {
				VAR_2 = ((double) ((((double) (b + ((double) (x * ((double) (y * 9.0)))))) / ((double) (z * c))) - ((double) (4.0 * ((double) (t * (a / c)))))));
			} else {
				double VAR_3;
				if ((y <= 9.042159349952659e-35)) {
					VAR_3 = (((double) ((1.0 / (z / ((double) (b + ((double) (x * ((double) (y * 9.0)))))))) - ((double) (4.0 * ((double) (t * a)))))) / c);
				} else {
					VAR_3 = ((double) (((double) ((1.0 / z) * (b / c))) + ((double) (((double) (9.0 * ((double) (y * (x / ((double) (z * c))))))) - ((double) (4.0 * ((double) (t * (a / c)))))))));
				}
				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.4
Target15.0
Herbie9.1
\[\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} < -1.1001567408041051 \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} < -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} < 1.1708877911747488 \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} < 2.876823679546137 \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} < 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 y < -1829743949752503630000

    1. Initial program 24.4

      \[\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. Simplified20.1

      \[\leadsto \color{blue}{\frac{\frac{x \cdot \left(9 \cdot y\right) + b}{z} - 4 \cdot \left(t \cdot a\right)}{c}}\]
    3. Taylor expanded around 0 17.2

      \[\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}}\]
    4. Simplified10.2

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

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

    if -1829743949752503630000 < y < -4.33660143368115052e-101 or 2.4452607704569994e-237 < y < 9.0421593499526589e-35

    1. Initial program 17.0

      \[\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. Simplified9.0

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

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

    if -4.33660143368115052e-101 < y < 2.4452607704569994e-237

    1. Initial program 17.2

      \[\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. Simplified8.8

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

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

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

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

    if 9.0421593499526589e-35 < y

    1. Initial program 24.6

      \[\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. Simplified18.3

      \[\leadsto \color{blue}{\frac{\frac{x \cdot \left(9 \cdot y\right) + b}{z} - 4 \cdot \left(t \cdot a\right)}{c}}\]
    3. Taylor expanded around 0 16.4

      \[\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}}\]
    4. Simplified10.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8297439497525036 \cdot 10^{+21}:\\ \;\;\;\;\frac{b}{z \cdot c} + \left(9 \cdot \left(y \cdot \frac{\frac{x}{z}}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\right)\\ \mathbf{elif}\;y \leq -4.3366014336811505 \cdot 10^{-101}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + x \cdot \left(y \cdot 9\right)}} - 4 \cdot \left(t \cdot a\right)}{c}\\ \mathbf{elif}\;y \leq 2.4452607704569994 \cdot 10^{-237}:\\ \;\;\;\;\frac{b + x \cdot \left(y \cdot 9\right)}{z \cdot c} - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \mathbf{elif}\;y \leq 9.042159349952659 \cdot 10^{-35}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + x \cdot \left(y \cdot 9\right)}} - 4 \cdot \left(t \cdot a\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{b}{c} + \left(9 \cdot \left(y \cdot \frac{x}{z \cdot c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\right)\\ \end{array}\]

Reproduce

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