Average Error: 20.2 → 7.6
Time: 24.4s
Precision: binary64
Cost: 1544
\[\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 \leq -1.6175429892819392 \cdot 10^{+25} \lor \neg \left(z \leq 2.2693000753998176 \cdot 10^{-13}\right):\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} + \left(t \cdot a\right) \cdot -4}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + \left(\left(x \cdot 9\right) \cdot y - a \cdot \left(t \cdot \left(z \cdot 4\right)\right)\right)}{z \cdot c}\\ \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 \leq -1.6175429892819392 \cdot 10^{+25} \lor \neg \left(z \leq 2.2693000753998176 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} + \left(t \cdot a\right) \cdot -4}{c}\\

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

\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 (or (<= z -1.6175429892819392e+25) (not (<= z 2.2693000753998176e-13)))
   (/ (+ (/ (+ (* (* x 9.0) y) b) z) (* (* t a) -4.0)) c)
   (/ (+ b (- (* (* x 9.0) y) (* a (* t (* z 4.0))))) (* z 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 ((z <= -1.6175429892819392e+25) || !(z <= 2.2693000753998176e-13)) {
		tmp = (((((x * 9.0) * y) + b) / z) + ((t * a) * -4.0)) / c;
	} else {
		tmp = (b + (((x * 9.0) * y) - (a * (t * (z * 4.0))))) / (z * 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.2
Target14.2
Herbie7.6
\[\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}\]

Alternatives

Alternative 1
Error12.1
Cost2058
\[\begin{array}{l} \mathbf{if}\;z \leq -2.5865480051199704 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} + \left(t \cdot a\right) \cdot -4}{c}\\ \mathbf{elif}\;z \leq 1.2338277900330349 \cdot 10^{-287}:\\ \;\;\;\;\frac{b + x \cdot \left(9 \cdot y\right)}{z \cdot c}\\ \mathbf{elif}\;z \leq 8.790404717816692 \cdot 10^{-154} \lor \neg \left(z \leq 2.1751349563363639 \cdot 10^{-13}\right):\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} + \left(t \cdot a\right) \cdot -4}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}\\ \end{array}\]
Alternative 2
Error12.2
Cost2058
\[\begin{array}{l} \mathbf{if}\;z \leq -7.445106698076842 \cdot 10^{-113}:\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b + x \cdot \left(9 \cdot y\right)}{z}}{c}\\ \mathbf{elif}\;z \leq 1.862995461775845 \cdot 10^{-287}:\\ \;\;\;\;\frac{b + x \cdot \left(9 \cdot y\right)}{z \cdot c}\\ \mathbf{elif}\;z \leq 1.8780733484627925 \cdot 10^{-153} \lor \neg \left(z \leq 2.1751349563363639 \cdot 10^{-13}\right):\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b + x \cdot \left(9 \cdot y\right)}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}\\ \end{array}\]
Alternative 3
Error18.9
Cost2565
\[\begin{array}{l} \mathbf{if}\;z \leq -4.208761508918643 \cdot 10^{-50}:\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b}{z}}{c}\\ \mathbf{elif}\;z \leq 3.489009944192214 \cdot 10^{-13}:\\ \;\;\;\;\frac{b + x \cdot \left(9 \cdot y\right)}{z \cdot c}\\ \mathbf{elif}\;z \leq 1.1840747271147404 \cdot 10^{+54}:\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b}{z}}{c}\\ \mathbf{elif}\;z \leq 8.693825059022038 \cdot 10^{+92}:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z}}{c}\\ \mathbf{elif}\;z \leq 4.747734294008469 \cdot 10^{+111}:\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + 9 \cdot \frac{x \cdot y}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{c}}{\frac{1}{\left(t \cdot a\right) \cdot -4 + \frac{b}{z}}}\\ \end{array}\]
Alternative 4
Error18.6
Cost1032
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0146402186108122 \cdot 10^{-49} \lor \neg \left(z \leq 3.2065145870018524 \cdot 10^{-13}\right):\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + x \cdot \left(9 \cdot y\right)}{z \cdot c}\\ \end{array}\]
Alternative 5
Error18.6
Cost1032
\[\begin{array}{l} \mathbf{if}\;z \leq -6.824279103135246 \cdot 10^{-50} \lor \neg \left(z \leq 3.300679706065306 \cdot 10^{-13}\right):\\ \;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}\\ \end{array}\]
Alternative 6
Error24.7
Cost1988
\[\begin{array}{l} \mathbf{if}\;z \leq -5.3810031221880966 \cdot 10^{+97}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 1.815940157825723 \cdot 10^{-06}:\\ \;\;\;\;\frac{\left(x \cdot 9\right) \cdot y + b}{z \cdot c}\\ \mathbf{elif}\;z \leq 93008929860377.55:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 3.038800988266181 \cdot 10^{+156}:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{c}}{\frac{-0.25}{t \cdot a}}\\ \end{array}\]
Alternative 7
Error29.2
Cost1988
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0558693431034382 \cdot 10^{+97}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 1.815940157825723 \cdot 10^{-06}:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z}}{c}\\ \mathbf{elif}\;z \leq 19503104108265.844:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 1.534851875548736 \cdot 10^{+156}:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{c}}{\frac{-0.25}{t \cdot a}}\\ \end{array}\]
Alternative 8
Error35.5
Cost1732
\[\begin{array}{l} \mathbf{if}\;b \leq -7.025155653862069 \cdot 10^{-73}:\\ \;\;\;\;\frac{\frac{1}{c}}{\frac{z}{b}}\\ \mathbf{elif}\;b \leq -1.0341366538622157 \cdot 10^{-221}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;b \leq -5.498813003454548 \cdot 10^{-307}:\\ \;\;\;\;\frac{9 \cdot \frac{x \cdot y}{z}}{c}\\ \mathbf{elif}\;b \leq 1.6952889149927266 \cdot 10^{+48}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{z \cdot c}\\ \end{array}\]
Alternative 9
Error35.4
Cost1860
\[\begin{array}{l} \mathbf{if}\;z \leq -1.1995966082327767 \cdot 10^{+81}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 2.2945785787397357 \cdot 10^{-10}:\\ \;\;\;\;\frac{b}{z \cdot c}\\ \mathbf{elif}\;z \leq 4.391674306873315 \cdot 10^{+22}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 1.6022637416367905 \cdot 10^{+156}:\\ \;\;\;\;\frac{\frac{b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{c}}{\frac{-0.25}{t \cdot a}}\\ \end{array}\]
Alternative 10
Error35.3
Cost1418
\[\begin{array}{l} \mathbf{if}\;z \leq -2.8305578939883058 \cdot 10^{+81}:\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \leq 2.650122586650986 \cdot 10^{-09}:\\ \;\;\;\;\frac{b}{z \cdot c}\\ \mathbf{elif}\;z \leq 8.064724427238681 \cdot 10^{+20} \lor \neg \left(z \leq 3.577327265509795 \cdot 10^{+155}\right):\\ \;\;\;\;-4 \cdot \frac{t \cdot a}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{z}}{c}\\ \end{array}\]
Alternative 11
Error42.9
Cost641
\[\begin{array}{l} \mathbf{if}\;z \leq 1.977263622719907 \cdot 10^{-61}:\\ \;\;\;\;\frac{b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{z}}{c}\\ \end{array}\]
Alternative 12
Error44.7
Cost320
\[\frac{\frac{b}{z}}{c}\]
Alternative 13
Error59.6
Cost64
\[0\]
Alternative 14
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if z < -1.61754298928193922e25 or 2.26930007539981755e-13 < z

    1. Initial program 29.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. Simplified8.6

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

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

    if -1.61754298928193922e25 < z < 2.26930007539981755e-13

    1. Initial program 6.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. Simplified6.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6175429892819392 \cdot 10^{+25} \lor \neg \left(z \leq 2.2693000753998176 \cdot 10^{-13}\right):\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} + \left(t \cdot a\right) \cdot -4}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + \left(\left(x \cdot 9\right) \cdot y - a \cdot \left(t \cdot \left(z \cdot 4\right)\right)\right)}{z \cdot c}\\ \end{array}\]

Reproduce

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