Average Error: 20.8 → 8.1
Time: 6.1s
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 r738154 = x;
        double r738155 = 9.0;
        double r738156 = r738154 * r738155;
        double r738157 = y;
        double r738158 = r738156 * r738157;
        double r738159 = z;
        double r738160 = 4.0;
        double r738161 = r738159 * r738160;
        double r738162 = t;
        double r738163 = r738161 * r738162;
        double r738164 = a;
        double r738165 = r738163 * r738164;
        double r738166 = r738158 - r738165;
        double r738167 = b;
        double r738168 = r738166 + r738167;
        double r738169 = c;
        double r738170 = r738159 * r738169;
        double r738171 = r738168 / r738170;
        return r738171;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r738172 = c;
        double r738173 = -1.252202118917326e+240;
        bool r738174 = r738172 <= r738173;
        double r738175 = 9.0;
        double r738176 = x;
        double r738177 = z;
        double r738178 = r738177 * r738172;
        double r738179 = r738176 / r738178;
        double r738180 = y;
        double r738181 = r738179 * r738180;
        double r738182 = b;
        double r738183 = r738182 / r738178;
        double r738184 = 4.0;
        double r738185 = a;
        double r738186 = t;
        double r738187 = r738172 / r738186;
        double r738188 = r738185 / r738187;
        double r738189 = r738184 * r738188;
        double r738190 = r738183 - r738189;
        double r738191 = fma(r738175, r738181, r738190);
        double r738192 = -32082327.647484176;
        bool r738193 = r738172 <= r738192;
        double r738194 = 1.0;
        double r738195 = r738194 / r738177;
        double r738196 = r738176 / r738172;
        double r738197 = r738195 * r738196;
        double r738198 = r738197 * r738180;
        double r738199 = r738185 * r738186;
        double r738200 = r738199 / r738172;
        double r738201 = r738184 * r738200;
        double r738202 = r738183 - r738201;
        double r738203 = fma(r738175, r738198, r738202);
        double r738204 = 0.0014459186212377087;
        bool r738205 = r738172 <= r738204;
        double r738206 = -r738184;
        double r738207 = r738186 * r738185;
        double r738208 = r738207 / r738172;
        double r738209 = r738175 * r738176;
        double r738210 = fma(r738209, r738180, r738182);
        double r738211 = r738210 / r738177;
        double r738212 = r738211 / r738172;
        double r738213 = fma(r738206, r738208, r738212);
        double r738214 = 3.170978639894234e+235;
        bool r738215 = r738172 <= r738214;
        double r738216 = r738178 / r738180;
        double r738217 = r738176 / r738216;
        double r738218 = cbrt(r738172);
        double r738219 = r738218 * r738218;
        double r738220 = r738185 / r738219;
        double r738221 = r738186 / r738218;
        double r738222 = r738220 * r738221;
        double r738223 = r738184 * r738222;
        double r738224 = r738183 - r738223;
        double r738225 = fma(r738175, r738217, r738224);
        double r738226 = r738176 / r738177;
        double r738227 = r738172 / r738180;
        double r738228 = r738226 / r738227;
        double r738229 = fma(r738175, r738228, r738202);
        double r738230 = r738215 ? r738225 : r738229;
        double r738231 = r738205 ? r738213 : r738230;
        double r738232 = r738193 ? r738203 : r738231;
        double r738233 = r738174 ? r738191 : r738232;
        return r738233;
}

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)))