Average Error: 20.8 → 8.2
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}\;\left(x \cdot 9\right) \cdot y = -\infty:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le -8.108948328176708 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le -6.60707305569133659 \cdot 10^{-206}:\\ \;\;\;\;\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}\;\left(x \cdot 9\right) \cdot y \le 1.61237712410997147 \cdot 10^{-172}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{c} \cdot a, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le 1.87487065300391919 \cdot 10^{-101}:\\ \;\;\;\;\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}\;\left(x \cdot 9\right) \cdot y \le 1.32349191519405003 \cdot 10^{111}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c}\right)\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}\;\left(x \cdot 9\right) \cdot y = -\infty:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c}\right)\right)\\

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

\mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le -6.60707305569133659 \cdot 10^{-206}:\\
\;\;\;\;\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}\;\left(x \cdot 9\right) \cdot y \le 1.61237712410997147 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{c} \cdot a, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\

\mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le 1.87487065300391919 \cdot 10^{-101}:\\
\;\;\;\;\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}\;\left(x \cdot 9\right) \cdot y \le 1.32349191519405003 \cdot 10^{111}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r754987 = x;
        double r754988 = 9.0;
        double r754989 = r754987 * r754988;
        double r754990 = y;
        double r754991 = r754989 * r754990;
        double r754992 = z;
        double r754993 = 4.0;
        double r754994 = r754992 * r754993;
        double r754995 = t;
        double r754996 = r754994 * r754995;
        double r754997 = a;
        double r754998 = r754996 * r754997;
        double r754999 = r754991 - r754998;
        double r755000 = b;
        double r755001 = r754999 + r755000;
        double r755002 = c;
        double r755003 = r754992 * r755002;
        double r755004 = r755001 / r755003;
        return r755004;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r755005 = x;
        double r755006 = 9.0;
        double r755007 = r755005 * r755006;
        double r755008 = y;
        double r755009 = r755007 * r755008;
        double r755010 = -inf.0;
        bool r755011 = r755009 <= r755010;
        double r755012 = 4.0;
        double r755013 = -r755012;
        double r755014 = t;
        double r755015 = c;
        double r755016 = a;
        double r755017 = r755015 / r755016;
        double r755018 = r755014 / r755017;
        double r755019 = z;
        double r755020 = r755005 / r755019;
        double r755021 = r755015 / r755008;
        double r755022 = r755020 / r755021;
        double r755023 = b;
        double r755024 = r755019 * r755015;
        double r755025 = r755023 / r755024;
        double r755026 = fma(r755006, r755022, r755025);
        double r755027 = fma(r755013, r755018, r755026);
        double r755028 = -8.108948328176708e-07;
        bool r755029 = r755009 <= r755028;
        double r755030 = r755016 / r755015;
        double r755031 = r755014 * r755030;
        double r755032 = r755006 * r755008;
        double r755033 = fma(r755005, r755032, r755023);
        double r755034 = r755033 / r755024;
        double r755035 = fma(r755013, r755031, r755034);
        double r755036 = -6.607073055691337e-206;
        bool r755037 = r755009 <= r755036;
        double r755038 = r755014 * r755016;
        double r755039 = r755038 / r755015;
        double r755040 = r755006 * r755005;
        double r755041 = fma(r755040, r755008, r755023);
        double r755042 = r755041 / r755019;
        double r755043 = r755042 / r755015;
        double r755044 = fma(r755013, r755039, r755043);
        double r755045 = 1.6123771241099715e-172;
        bool r755046 = r755009 <= r755045;
        double r755047 = r755014 / r755015;
        double r755048 = r755047 * r755016;
        double r755049 = fma(r755013, r755048, r755034);
        double r755050 = 1.8748706530039192e-101;
        bool r755051 = r755009 <= r755050;
        double r755052 = 1.32349191519405e+111;
        bool r755053 = r755009 <= r755052;
        double r755054 = 1.0;
        double r755055 = r755054 / r755019;
        double r755056 = r755041 / r755015;
        double r755057 = r755055 * r755056;
        double r755058 = fma(r755013, r755018, r755057);
        double r755059 = r755053 ? r755058 : r755027;
        double r755060 = r755051 ? r755044 : r755059;
        double r755061 = r755046 ? r755049 : r755060;
        double r755062 = r755037 ? r755044 : r755061;
        double r755063 = r755029 ? r755035 : r755062;
        double r755064 = r755011 ? r755027 : r755063;
        return r755064;
}

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.7
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 5 regimes
  2. if (* (* x 9.0) y) < -inf.0 or 1.32349191519405e+111 < (* (* x 9.0) y)

    1. Initial program 37.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. Simplified31.8

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

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

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

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

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

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

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

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

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

    if -inf.0 < (* (* x 9.0) y) < -8.108948328176708e-07

    1. Initial program 19.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. Simplified9.7

      \[\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 *-un-lft-identity9.7

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

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

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

    if -8.108948328176708e-07 < (* (* x 9.0) y) < -6.607073055691337e-206 or 1.6123771241099715e-172 < (* (* x 9.0) y) < 1.8748706530039192e-101

    1. Initial program 17.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. Simplified6.8

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

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

      \[\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 -6.607073055691337e-206 < (* (* x 9.0) y) < 1.6123771241099715e-172

    1. Initial program 17.7

      \[\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. Simplified8.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-/l*8.3

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

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

    if 1.8748706530039192e-101 < (* (* x 9.0) y) < 1.32349191519405e+111

    1. Initial program 16.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. Simplified6.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-/l*6.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot 9\right) \cdot y = -\infty:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le -8.108948328176708 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le -6.60707305569133659 \cdot 10^{-206}:\\ \;\;\;\;\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}\;\left(x \cdot 9\right) \cdot y \le 1.61237712410997147 \cdot 10^{-172}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{c} \cdot a, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le 1.87487065300391919 \cdot 10^{-101}:\\ \;\;\;\;\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}\;\left(x \cdot 9\right) \cdot y \le 1.32349191519405003 \cdot 10^{111}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{\frac{x}{z}}{\frac{c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020027 +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)))