Average Error: 20.3 → 5.1
Time: 25.6s
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}\;\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} \leq -\infty:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + \frac{x}{\frac{z}{y}} \cdot \frac{9}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \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} \leq -8.502225291463227 \cdot 10^{-129}:\\ \;\;\;\;\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}\\ \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} \leq 2.1243198050990233 \cdot 10^{+35}:\\ \;\;\;\;\frac{\frac{b + x \cdot \left(9 \cdot y\right)}{z}}{c} - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \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} \leq 5.2213817646856615 \cdot 10^{+261}:\\ \;\;\;\;\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}\\ \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} \leq \infty:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + 9 \cdot \left(x \cdot y\right)}} - t \cdot \left(4 \cdot a\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + \frac{x}{\frac{z}{y}} \cdot \frac{9}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{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}\;\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} \leq -\infty:\\
\;\;\;\;\left(\frac{\frac{b}{z}}{c} + \frac{x}{\frac{z}{y}} \cdot \frac{9}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\

\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} \leq -8.502225291463227 \cdot 10^{-129}:\\
\;\;\;\;\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}\\

\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} \leq 2.1243198050990233 \cdot 10^{+35}:\\
\;\;\;\;\frac{\frac{b + x \cdot \left(9 \cdot y\right)}{z}}{c} - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\

\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} \leq 5.2213817646856615 \cdot 10^{+261}:\\
\;\;\;\;\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}\\

\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} \leq \infty:\\
\;\;\;\;\frac{\frac{1}{\frac{z}{b + 9 \cdot \left(x \cdot y\right)}} - t \cdot \left(4 \cdot a\right)}{c}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{b}{z}}{c} + \frac{x}{\frac{z}{y}} \cdot \frac{9}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{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 (<=
      (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
      (- INFINITY))
   (- (+ (/ (/ b z) c) (* (/ x (/ z y)) (/ 9.0 c))) (* 4.0 (* t (/ a c))))
   (if (<=
        (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
        -8.502225291463227e-129)
     (/ (+ (- (* (* 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.1243198050990233e+35)
       (- (/ (/ (+ b (* x (* 9.0 y))) z) c) (* 4.0 (* t (/ a c))))
       (if (<=
            (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
            5.2213817646856615e+261)
         (/ (+ (- (* (* 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))
              INFINITY)
           (/ (- (/ 1.0 (/ z (+ b (* 9.0 (* x y))))) (* t (* 4.0 a))) c)
           (-
            (+ (/ (/ b z) c) (* (/ x (/ z y)) (/ 9.0 c)))
            (* 4.0 (* t (/ a 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 ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= -((double) INFINITY)) {
		tmp = (((b / z) / c) + ((x / (z / y)) * (9.0 / c))) - (4.0 * (t * (a / c)));
	} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= -8.502225291463227e-129) {
		tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
	} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= 2.1243198050990233e+35) {
		tmp = (((b + (x * (9.0 * y))) / z) / c) - (4.0 * (t * (a / c)));
	} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= 5.2213817646856615e+261) {
		tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
	} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= ((double) INFINITY)) {
		tmp = ((1.0 / (z / (b + (9.0 * (x * y))))) - (t * (4.0 * a))) / c;
	} else {
		tmp = (((b / z) / c) + ((x / (z / y)) * (9.0 / c))) - (4.0 * (t * (a / 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.4
Herbie5.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 (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -inf.0 or +inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c))

    1. Initial program 64.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. Simplified26.8

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

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

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

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

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

    if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -8.50222529146322655e-129 or 2.12431980509902328e35 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 5.2213817646856615e261

    1. Initial program 0.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}\]

    if -8.50222529146322655e-129 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 2.12431980509902328e35

    1. Initial program 15.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. Simplified1.2

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

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

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

    if 5.2213817646856615e261 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < +inf.0

    1. Initial program 45.1

      \[\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{x \cdot \left(9 \cdot y\right) + b}{z} - t \cdot \left(4 \cdot a\right)}{c}}\]
    3. Using strategy rm
    4. Applied clear-num_binary64_1439922.1

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

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

    \[\leadsto \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} \leq -\infty:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + \frac{x}{\frac{z}{y}} \cdot \frac{9}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \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} \leq -8.502225291463227 \cdot 10^{-129}:\\ \;\;\;\;\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}\\ \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} \leq 2.1243198050990233 \cdot 10^{+35}:\\ \;\;\;\;\frac{\frac{b + x \cdot \left(9 \cdot y\right)}{z}}{c} - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \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} \leq 5.2213817646856615 \cdot 10^{+261}:\\ \;\;\;\;\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}\\ \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} \leq \infty:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + 9 \cdot \left(x \cdot y\right)}} - t \cdot \left(4 \cdot a\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + \frac{x}{\frac{z}{y}} \cdot \frac{9}{c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \end{array}\]

Reproduce

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