Average Error: 20.8 → 8.6
Time: 5.9s
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 -1.350720498066435 \cdot 10^{188}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;z \le -8.8327021830331049 \cdot 10^{-302}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 7.9225009883727773 \cdot 10^{-38}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{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 \le -1.350720498066435 \cdot 10^{188}:\\
\;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r713013 = x;
        double r713014 = 9.0;
        double r713015 = r713013 * r713014;
        double r713016 = y;
        double r713017 = r713015 * r713016;
        double r713018 = z;
        double r713019 = 4.0;
        double r713020 = r713018 * r713019;
        double r713021 = t;
        double r713022 = r713020 * r713021;
        double r713023 = a;
        double r713024 = r713022 * r713023;
        double r713025 = r713017 - r713024;
        double r713026 = b;
        double r713027 = r713025 + r713026;
        double r713028 = c;
        double r713029 = r713018 * r713028;
        double r713030 = r713027 / r713029;
        return r713030;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r713031 = z;
        double r713032 = -1.350720498066435e+188;
        bool r713033 = r713031 <= r713032;
        double r713034 = b;
        double r713035 = r713034 / r713031;
        double r713036 = c;
        double r713037 = r713035 / r713036;
        double r713038 = 9.0;
        double r713039 = x;
        double r713040 = r713031 * r713036;
        double r713041 = y;
        double r713042 = r713040 / r713041;
        double r713043 = r713039 / r713042;
        double r713044 = r713038 * r713043;
        double r713045 = r713037 + r713044;
        double r713046 = 4.0;
        double r713047 = a;
        double r713048 = t;
        double r713049 = r713047 * r713048;
        double r713050 = r713049 / r713036;
        double r713051 = r713046 * r713050;
        double r713052 = r713045 - r713051;
        double r713053 = -8.832702183033105e-302;
        bool r713054 = r713031 <= r713053;
        double r713055 = r713034 / r713040;
        double r713056 = r713055 + r713044;
        double r713057 = r713036 / r713048;
        double r713058 = r713047 / r713057;
        double r713059 = r713046 * r713058;
        double r713060 = r713056 - r713059;
        double r713061 = 7.922500988372777e-38;
        bool r713062 = r713031 <= r713061;
        double r713063 = 1.0;
        double r713064 = r713063 / r713031;
        double r713065 = r713039 * r713038;
        double r713066 = r713065 * r713041;
        double r713067 = r713031 * r713046;
        double r713068 = r713067 * r713048;
        double r713069 = r713068 * r713047;
        double r713070 = r713066 - r713069;
        double r713071 = r713070 + r713034;
        double r713072 = r713071 / r713036;
        double r713073 = r713064 * r713072;
        double r713074 = r713062 ? r713073 : r713052;
        double r713075 = r713054 ? r713060 : r713074;
        double r713076 = r713033 ? r713052 : r713075;
        return r713076;
}

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.8
Target14.9
Herbie8.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} \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 < -1.350720498066435e+188 or 7.922500988372777e-38 < z

    1. Initial program 30.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. 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{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*11.8

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

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

    if -1.350720498066435e+188 < z < -8.832702183033105e-302

    1. Initial program 13.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. Taylor expanded around 0 10.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*10.1

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

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

    if -8.832702183033105e-302 < z < 7.922500988372777e-38

    1. Initial program 6.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. Using strategy rm
    3. Applied *-un-lft-identity6.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.350720498066435 \cdot 10^{188}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;z \le -8.8327021830331049 \cdot 10^{-302}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 7.9225009883727773 \cdot 10^{-38}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Reproduce

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