Average Error: 20.3 → 10.3
Time: 8.1s
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}\;c \leq -2.5948083836392496 \cdot 10^{+243}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \leq -7.1508586972380935 \cdot 10^{+143}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{y \cdot \frac{x}{z}}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;c \leq -2.7444922325717474 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;c \leq 5.017340518112637 \cdot 10^{+97}:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{b + y \cdot \left(9 \cdot x\right)}{z} + a \cdot \left(t \cdot -4\right)}}\\ \mathbf{elif}\;c \leq 5.546949437242792 \cdot 10^{+124}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \leq 1.2353692371008664 \cdot 10^{+143}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{y \cdot \frac{x}{z}}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;c \leq 1.8206532349167078 \cdot 10^{+266}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\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}\;c \leq -2.5948083836392496 \cdot 10^{+243}:\\
\;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\

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

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

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

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

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

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

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

\end{array}
(FPCore (x y z t a b c)
 :precision binary64
 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= c -2.5948083836392496e+243)
   (- (+ (/ b (* c z)) (* 9.0 (/ (* x y) (* c z)))) (* 4.0 (* a (/ t c))))
   (if (<= c -7.1508586972380935e+143)
     (- (+ (/ b (* c z)) (* 9.0 (/ (* y (/ x z)) c))) (* 4.0 (/ (* a t) c)))
     (if (<= c -2.7444922325717474e-13)
       (- (+ (/ b (* c z)) (* 9.0 (/ x (/ z (/ y c))))) (* 4.0 (/ (* a t) c)))
       (if (<= c 5.017340518112637e+97)
         (/ 1.0 (/ c (+ (/ (+ b (* y (* 9.0 x))) z) (* a (* t -4.0)))))
         (if (<= c 5.546949437242792e+124)
           (-
            (+ (/ b (* c z)) (* 9.0 (/ (* x y) (* c z))))
            (* 4.0 (* a (/ t c))))
           (if (<= c 1.2353692371008664e+143)
             (-
              (+ (/ b (* c z)) (* 9.0 (/ (* y (/ x z)) c)))
              (* 4.0 (/ (* a t) c)))
             (if (<= c 1.8206532349167078e+266)
               (-
                (+ (/ b (* c z)) (* 9.0 (/ x (/ z (/ y c)))))
                (* 4.0 (/ (* a t) c)))
               (-
                (+ (/ b (* c z)) (* 9.0 (/ (* x y) (* c z))))
                (* 4.0 (* a (/ t c))))))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
}
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if (c <= -2.5948083836392496e+243) {
		tmp = ((b / (c * z)) + (9.0 * ((x * y) / (c * z)))) - (4.0 * (a * (t / c)));
	} else if (c <= -7.1508586972380935e+143) {
		tmp = ((b / (c * z)) + (9.0 * ((y * (x / z)) / c))) - (4.0 * ((a * t) / c));
	} else if (c <= -2.7444922325717474e-13) {
		tmp = ((b / (c * z)) + (9.0 * (x / (z / (y / c))))) - (4.0 * ((a * t) / c));
	} else if (c <= 5.017340518112637e+97) {
		tmp = 1.0 / (c / (((b + (y * (9.0 * x))) / z) + (a * (t * -4.0))));
	} else if (c <= 5.546949437242792e+124) {
		tmp = ((b / (c * z)) + (9.0 * ((x * y) / (c * z)))) - (4.0 * (a * (t / c)));
	} else if (c <= 1.2353692371008664e+143) {
		tmp = ((b / (c * z)) + (9.0 * ((y * (x / z)) / c))) - (4.0 * ((a * t) / c));
	} else if (c <= 1.8206532349167078e+266) {
		tmp = ((b / (c * z)) + (9.0 * (x / (z / (y / c))))) - (4.0 * ((a * t) / c));
	} else {
		tmp = ((b / (c * z)) + (9.0 * ((x * y) / (c * z)))) - (4.0 * (a * (t / c)));
	}
	return tmp;
}

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.3
Target14.8
Herbie10.3
\[\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 c < -2.5948083836392496e243 or 5.0173405181126369e97 < c < 5.54694943724279193e124 or 1.82065323491670777e266 < c

    1. Initial program 26.5

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

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

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

      \[\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}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity_binary6418.8

      \[\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}}\]
    7. Applied times-frac_binary6415.4

      \[\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)}\]
    8. Simplified15.4

      \[\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)\]

    if -2.5948083836392496e243 < c < -7.1508586972380935e143 or 5.54694943724279193e124 < c < 1.2353692371008664e143

    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.8

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

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}}\]
    4. Simplified17.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}}\]
    5. Using strategy rm
    6. Applied associate-/r*_binary6419.8

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

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

    if -7.1508586972380935e143 < c < -2.7444922325717474e-13 or 1.2353692371008664e143 < c < 1.82065323491670777e266

    1. Initial program 22.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. Simplified17.5

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

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

      \[\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}}\]
    5. Using strategy rm
    6. Applied associate-/l*_binary6412.3

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

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

    if -2.7444922325717474e-13 < c < 5.0173405181126369e97

    1. Initial program 14.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. Simplified4.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.5948083836392496 \cdot 10^{+243}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \leq -7.1508586972380935 \cdot 10^{+143}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{y \cdot \frac{x}{z}}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;c \leq -2.7444922325717474 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;c \leq 5.017340518112637 \cdot 10^{+97}:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{b + y \cdot \left(9 \cdot x\right)}{z} + a \cdot \left(t \cdot -4\right)}}\\ \mathbf{elif}\;c \leq 5.546949437242792 \cdot 10^{+124}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \leq 1.2353692371008664 \cdot 10^{+143}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{y \cdot \frac{x}{z}}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;c \leq 1.8206532349167078 \cdot 10^{+266}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + 9 \cdot \frac{x \cdot y}{c \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \end{array}\]

Reproduce

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