Average Error: 20.7 → 9.0
Time: 5.6s
Precision: 64
\[\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 -5.1099468617088619 \cdot 10^{-43}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 5.4639892796598128 \cdot 10^{52}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\frac{a}{c} \cdot t\right)\\ \mathbf{elif}\;z \le 7.03897792667915037 \cdot 10^{164}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\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 -5.1099468617088619 \cdot 10^{-43}:\\
\;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r714317 = x;
        double r714318 = 9.0;
        double r714319 = r714317 * r714318;
        double r714320 = y;
        double r714321 = r714319 * r714320;
        double r714322 = z;
        double r714323 = 4.0;
        double r714324 = r714322 * r714323;
        double r714325 = t;
        double r714326 = r714324 * r714325;
        double r714327 = a;
        double r714328 = r714326 * r714327;
        double r714329 = r714321 - r714328;
        double r714330 = b;
        double r714331 = r714329 + r714330;
        double r714332 = c;
        double r714333 = r714322 * r714332;
        double r714334 = r714331 / r714333;
        return r714334;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r714335 = z;
        double r714336 = -5.109946861708862e-43;
        bool r714337 = r714335 <= r714336;
        double r714338 = b;
        double r714339 = r714338 / r714335;
        double r714340 = c;
        double r714341 = r714339 / r714340;
        double r714342 = 9.0;
        double r714343 = x;
        double r714344 = r714335 * r714340;
        double r714345 = y;
        double r714346 = r714344 / r714345;
        double r714347 = r714343 / r714346;
        double r714348 = r714342 * r714347;
        double r714349 = r714341 + r714348;
        double r714350 = 4.0;
        double r714351 = a;
        double r714352 = t;
        double r714353 = r714340 / r714352;
        double r714354 = r714351 / r714353;
        double r714355 = r714350 * r714354;
        double r714356 = r714349 - r714355;
        double r714357 = 5.463989279659813e+52;
        bool r714358 = r714335 <= r714357;
        double r714359 = r714338 / r714344;
        double r714360 = r714359 + r714348;
        double r714361 = r714351 / r714340;
        double r714362 = r714361 * r714352;
        double r714363 = r714350 * r714362;
        double r714364 = r714360 - r714363;
        double r714365 = 7.03897792667915e+164;
        bool r714366 = r714335 <= r714365;
        double r714367 = r714345 / r714340;
        double r714368 = r714335 / r714367;
        double r714369 = r714343 / r714368;
        double r714370 = r714342 * r714369;
        double r714371 = r714359 + r714370;
        double r714372 = r714371 - r714355;
        double r714373 = r714366 ? r714356 : r714372;
        double r714374 = r714358 ? r714364 : r714373;
        double r714375 = r714337 ? r714356 : r714374;
        return r714375;
}

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
Target15.2
Herbie9.0
\[\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 3 regimes
  2. if z < -5.109946861708862e-43 or 5.463989279659813e+52 < z < 7.03897792667915e+164

    1. Initial program 26.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. Taylor expanded around 0 13.3

      \[\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*13.5

      \[\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 associate-/l*11.0

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

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

    if -5.109946861708862e-43 < z < 5.463989279659813e+52

    1. Initial program 7.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. Taylor expanded around 0 10.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}}\]
    3. Using strategy rm
    4. Applied associate-/l*7.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 associate-/l*7.6

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

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

    if 7.03897792667915e+164 < z

    1. Initial program 39.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 16.3

      \[\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*17.7

      \[\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 associate-/l*14.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.1099468617088619 \cdot 10^{-43}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 5.4639892796598128 \cdot 10^{52}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\frac{a}{c} \cdot t\right)\\ \mathbf{elif}\;z \le 7.03897792667915037 \cdot 10^{164}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 
(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) y) (* (* (* z 4) t) a)) b) (* z c)) -1.1001567408041051e-171) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c))))))))

  (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)))