Average Error: 20.9 → 8.2
Time: 5.4s
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 -2.35809942177298091 \cdot 10^{74} \lor \neg \left(z \le 1.49299520604753219 \cdot 10^{37}\right):\\ \;\;\;\;\left(\frac{1}{\frac{c}{\frac{b}{z}}} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \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 -2.35809942177298091 \cdot 10^{74} \lor \neg \left(z \le 1.49299520604753219 \cdot 10^{37}\right):\\
\;\;\;\;\left(\frac{1}{\frac{c}{\frac{b}{z}}} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\

\mathbf{else}:\\
\;\;\;\;\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}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r721944 = x;
        double r721945 = 9.0;
        double r721946 = r721944 * r721945;
        double r721947 = y;
        double r721948 = r721946 * r721947;
        double r721949 = z;
        double r721950 = 4.0;
        double r721951 = r721949 * r721950;
        double r721952 = t;
        double r721953 = r721951 * r721952;
        double r721954 = a;
        double r721955 = r721953 * r721954;
        double r721956 = r721948 - r721955;
        double r721957 = b;
        double r721958 = r721956 + r721957;
        double r721959 = c;
        double r721960 = r721949 * r721959;
        double r721961 = r721958 / r721960;
        return r721961;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r721962 = z;
        double r721963 = -2.358099421772981e+74;
        bool r721964 = r721962 <= r721963;
        double r721965 = 1.4929952060475322e+37;
        bool r721966 = r721962 <= r721965;
        double r721967 = !r721966;
        bool r721968 = r721964 || r721967;
        double r721969 = 1.0;
        double r721970 = c;
        double r721971 = b;
        double r721972 = r721971 / r721962;
        double r721973 = r721970 / r721972;
        double r721974 = r721969 / r721973;
        double r721975 = 9.0;
        double r721976 = x;
        double r721977 = r721962 * r721970;
        double r721978 = y;
        double r721979 = r721977 / r721978;
        double r721980 = r721976 / r721979;
        double r721981 = r721975 * r721980;
        double r721982 = r721974 + r721981;
        double r721983 = 4.0;
        double r721984 = a;
        double r721985 = t;
        double r721986 = r721984 * r721985;
        double r721987 = r721986 / r721970;
        double r721988 = r721983 * r721987;
        double r721989 = r721982 - r721988;
        double r721990 = r721969 / r721962;
        double r721991 = r721976 * r721975;
        double r721992 = r721991 * r721978;
        double r721993 = r721962 * r721983;
        double r721994 = r721993 * r721985;
        double r721995 = r721994 * r721984;
        double r721996 = r721992 - r721995;
        double r721997 = r721996 + r721971;
        double r721998 = r721997 / r721970;
        double r721999 = r721990 * r721998;
        double r722000 = r721968 ? r721989 : r721999;
        return r722000;
}

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.9
Target14.2
Herbie8.2
\[\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 2 regimes
  2. if z < -2.358099421772981e+74 or 1.4929952060475322e+37 < z

    1. Initial program 33.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 14.4

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

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

      \[\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}\]
    7. Using strategy rm
    8. Applied clear-num8.9

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

    if -2.358099421772981e+74 < z < 1.4929952060475322e+37

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

      \[\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-frac7.4

      \[\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 2 regimes into one program.
  4. Final simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.35809942177298091 \cdot 10^{74} \lor \neg \left(z \le 1.49299520604753219 \cdot 10^{37}\right):\\ \;\;\;\;\left(\frac{1}{\frac{c}{\frac{b}{z}}} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]

Reproduce

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