Average Error: 20.8 → 8.1
Time: 6.3s
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}\;c \le -1.252202118917326 \cdot 10^{240}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{z \cdot c} \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a}{\frac{c}{t}}\right)\\ \mathbf{elif}\;c \le -32082327.647484176:\\ \;\;\;\;\mathsf{fma}\left(9, \left(\frac{1}{z} \cdot \frac{x}{c}\right) \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\\ \mathbf{elif}\;c \le 0.00144591862123770866:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \mathbf{elif}\;c \le 3.1709786398942339 \cdot 10^{235}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c} - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{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}\;c \le -1.252202118917326 \cdot 10^{240}:\\
\;\;\;\;\mathsf{fma}\left(9, \frac{x}{z \cdot c} \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a}{\frac{c}{t}}\right)\\

\mathbf{elif}\;c \le -32082327.647484176:\\
\;\;\;\;\mathsf{fma}\left(9, \left(\frac{1}{z} \cdot \frac{x}{c}\right) \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\\

\mathbf{elif}\;c \le 0.00144591862123770866:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\

\mathbf{elif}\;c \le 3.1709786398942339 \cdot 10^{235}:\\
\;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c} - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r642833 = x;
        double r642834 = 9.0;
        double r642835 = r642833 * r642834;
        double r642836 = y;
        double r642837 = r642835 * r642836;
        double r642838 = z;
        double r642839 = 4.0;
        double r642840 = r642838 * r642839;
        double r642841 = t;
        double r642842 = r642840 * r642841;
        double r642843 = a;
        double r642844 = r642842 * r642843;
        double r642845 = r642837 - r642844;
        double r642846 = b;
        double r642847 = r642845 + r642846;
        double r642848 = c;
        double r642849 = r642838 * r642848;
        double r642850 = r642847 / r642849;
        return r642850;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r642851 = c;
        double r642852 = -1.252202118917326e+240;
        bool r642853 = r642851 <= r642852;
        double r642854 = 9.0;
        double r642855 = x;
        double r642856 = z;
        double r642857 = r642856 * r642851;
        double r642858 = r642855 / r642857;
        double r642859 = y;
        double r642860 = r642858 * r642859;
        double r642861 = b;
        double r642862 = r642861 / r642857;
        double r642863 = 4.0;
        double r642864 = a;
        double r642865 = t;
        double r642866 = r642851 / r642865;
        double r642867 = r642864 / r642866;
        double r642868 = r642863 * r642867;
        double r642869 = r642862 - r642868;
        double r642870 = fma(r642854, r642860, r642869);
        double r642871 = -32082327.647484176;
        bool r642872 = r642851 <= r642871;
        double r642873 = 1.0;
        double r642874 = r642873 / r642856;
        double r642875 = r642855 / r642851;
        double r642876 = r642874 * r642875;
        double r642877 = r642876 * r642859;
        double r642878 = r642864 * r642865;
        double r642879 = r642878 / r642851;
        double r642880 = r642863 * r642879;
        double r642881 = r642862 - r642880;
        double r642882 = fma(r642854, r642877, r642881);
        double r642883 = 0.0014459186212377087;
        bool r642884 = r642851 <= r642883;
        double r642885 = -r642863;
        double r642886 = r642865 * r642864;
        double r642887 = r642886 / r642851;
        double r642888 = r642854 * r642855;
        double r642889 = fma(r642888, r642859, r642861);
        double r642890 = r642889 / r642856;
        double r642891 = r642890 / r642851;
        double r642892 = fma(r642885, r642887, r642891);
        double r642893 = 3.170978639894234e+235;
        bool r642894 = r642851 <= r642893;
        double r642895 = r642857 / r642859;
        double r642896 = r642855 / r642895;
        double r642897 = cbrt(r642851);
        double r642898 = r642897 * r642897;
        double r642899 = r642864 / r642898;
        double r642900 = r642865 / r642897;
        double r642901 = r642899 * r642900;
        double r642902 = r642863 * r642901;
        double r642903 = r642862 - r642902;
        double r642904 = fma(r642854, r642896, r642903);
        double r642905 = r642855 / r642856;
        double r642906 = r642851 / r642859;
        double r642907 = r642905 / r642906;
        double r642908 = fma(r642854, r642907, r642881);
        double r642909 = r642894 ? r642904 : r642908;
        double r642910 = r642884 ? r642892 : r642909;
        double r642911 = r642872 ? r642882 : r642910;
        double r642912 = r642853 ? r642870 : r642911;
        return r642912;
}

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

Target

Original20.8
Target14.8
Herbie8.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} \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 5 regimes
  2. if c < -1.252202118917326e+240

    1. Initial program 27.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. Simplified20.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Taylor expanded around 0 20.5

      \[\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}}\]
    4. Simplified20.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)}\]
    5. Using strategy rm
    6. Applied associate-/l*18.7

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

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{x}{z \cdot c} \cdot y}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    9. Using strategy rm
    10. Applied associate-/l*14.4

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

    if -1.252202118917326e+240 < c < -32082327.647484176

    1. Initial program 22.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. Simplified13.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Taylor expanded around 0 13.5

      \[\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}}\]
    4. Simplified13.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)}\]
    5. Using strategy rm
    6. Applied associate-/l*11.4

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

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{x}{z \cdot c} \cdot y}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    9. Using strategy rm
    10. Applied *-un-lft-identity11.2

      \[\leadsto \mathsf{fma}\left(9, \frac{\color{blue}{1 \cdot x}}{z \cdot c} \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    11. Applied times-frac9.3

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

    if -32082327.647484176 < c < 0.0014459186212377087

    1. Initial program 14.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. Simplified5.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Using strategy rm
    4. Applied associate-/r*2.7

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

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

    if 0.0014459186212377087 < c < 3.170978639894234e+235

    1. Initial program 22.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. Simplified13.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Taylor expanded around 0 13.9

      \[\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}}\]
    4. Simplified13.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)}\]
    5. Using strategy rm
    6. Applied associate-/l*12.1

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    7. Using strategy rm
    8. Applied add-cube-cbrt12.4

      \[\leadsto \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{\color{blue}{\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right) \cdot \sqrt[3]{c}}}\right)\]
    9. Applied times-frac8.1

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

    if 3.170978639894234e+235 < c

    1. Initial program 28.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. Simplified20.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Taylor expanded around 0 20.1

      \[\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}}\]
    4. Simplified20.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)}\]
    5. Using strategy rm
    6. Applied associate-/l*18.6

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    7. Using strategy rm
    8. Applied *-un-lft-identity18.6

      \[\leadsto \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{\color{blue}{1 \cdot y}}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    9. Applied times-frac16.0

      \[\leadsto \mathsf{fma}\left(9, \frac{x}{\color{blue}{\frac{z}{1} \cdot \frac{c}{y}}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    10. Applied associate-/r*17.9

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{\frac{x}{\frac{z}{1}}}{\frac{c}{y}}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\]
    11. Simplified17.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -1.252202118917326 \cdot 10^{240}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{z \cdot c} \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a}{\frac{c}{t}}\right)\\ \mathbf{elif}\;c \le -32082327.647484176:\\ \;\;\;\;\mathsf{fma}\left(9, \left(\frac{1}{z} \cdot \frac{x}{c}\right) \cdot y, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\\ \mathbf{elif}\;c \le 0.00144591862123770866:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \mathbf{elif}\;c \le 3.1709786398942339 \cdot 10^{235}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c} - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c} - 4 \cdot \frac{a \cdot t}{c}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(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)))