Average Error: 20.4 → 5.8
Time: 12.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}\;\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} \le -6.79788688002701001 \cdot 10^{270}:\\ \;\;\;\;\mathsf{fma}\left(x \cdot \frac{1}{c \cdot \frac{z}{y}}, 9, \frac{1}{z} \cdot \frac{b}{c}\right) - 4 \cdot \frac{t \cdot a}{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} \le -2.07074883831385532 \cdot 10^{-229}:\\ \;\;\;\;\left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{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} \le 448174337903075008:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z} - a \cdot \left(4 \cdot t\right)}}\\ \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} \le 1.3732890460674824 \cdot 10^{303}:\\ \;\;\;\;\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}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{c \cdot \frac{z}{y}}, 9, \frac{\frac{b}{z}}{c}\right) - 4 \cdot \frac{t \cdot a}{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}\;\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} \le -6.79788688002701001 \cdot 10^{270}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot \frac{1}{c \cdot \frac{z}{y}}, 9, \frac{1}{z} \cdot \frac{b}{c}\right) - 4 \cdot \frac{t \cdot a}{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} \le -2.07074883831385532 \cdot 10^{-229}:\\
\;\;\;\;\left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{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} \le 448174337903075008:\\
\;\;\;\;\frac{1}{\frac{c}{\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z} - a \cdot \left(4 \cdot t\right)}}\\

\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} \le 1.3732890460674824 \cdot 10^{303}:\\
\;\;\;\;\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}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r943718 = x;
        double r943719 = 9.0;
        double r943720 = r943718 * r943719;
        double r943721 = y;
        double r943722 = r943720 * r943721;
        double r943723 = z;
        double r943724 = 4.0;
        double r943725 = r943723 * r943724;
        double r943726 = t;
        double r943727 = r943725 * r943726;
        double r943728 = a;
        double r943729 = r943727 * r943728;
        double r943730 = r943722 - r943729;
        double r943731 = b;
        double r943732 = r943730 + r943731;
        double r943733 = c;
        double r943734 = r943723 * r943733;
        double r943735 = r943732 / r943734;
        return r943735;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r943736 = x;
        double r943737 = 9.0;
        double r943738 = r943736 * r943737;
        double r943739 = y;
        double r943740 = r943738 * r943739;
        double r943741 = z;
        double r943742 = 4.0;
        double r943743 = r943741 * r943742;
        double r943744 = t;
        double r943745 = r943743 * r943744;
        double r943746 = a;
        double r943747 = r943745 * r943746;
        double r943748 = r943740 - r943747;
        double r943749 = b;
        double r943750 = r943748 + r943749;
        double r943751 = c;
        double r943752 = r943741 * r943751;
        double r943753 = r943750 / r943752;
        double r943754 = -6.79788688002701e+270;
        bool r943755 = r943753 <= r943754;
        double r943756 = 1.0;
        double r943757 = r943741 / r943739;
        double r943758 = r943751 * r943757;
        double r943759 = r943756 / r943758;
        double r943760 = r943736 * r943759;
        double r943761 = r943756 / r943741;
        double r943762 = r943749 / r943751;
        double r943763 = r943761 * r943762;
        double r943764 = fma(r943760, r943737, r943763);
        double r943765 = r943744 * r943746;
        double r943766 = r943765 / r943751;
        double r943767 = r943742 * r943766;
        double r943768 = r943764 - r943767;
        double r943769 = -2.0707488383138553e-229;
        bool r943770 = r943753 <= r943769;
        double r943771 = r943736 * r943739;
        double r943772 = r943771 / r943752;
        double r943773 = r943737 * r943772;
        double r943774 = r943749 / r943752;
        double r943775 = r943773 + r943774;
        double r943776 = r943775 - r943767;
        double r943777 = 4.48174337903075e+17;
        bool r943778 = r943753 <= r943777;
        double r943779 = r943737 * r943739;
        double r943780 = fma(r943736, r943779, r943749);
        double r943781 = r943780 / r943741;
        double r943782 = r943742 * r943744;
        double r943783 = r943746 * r943782;
        double r943784 = r943781 - r943783;
        double r943785 = r943751 / r943784;
        double r943786 = r943756 / r943785;
        double r943787 = 1.3732890460674824e+303;
        bool r943788 = r943753 <= r943787;
        double r943789 = r943736 / r943758;
        double r943790 = r943749 / r943741;
        double r943791 = r943790 / r943751;
        double r943792 = fma(r943789, r943737, r943791);
        double r943793 = r943792 - r943767;
        double r943794 = r943788 ? r943753 : r943793;
        double r943795 = r943778 ? r943786 : r943794;
        double r943796 = r943770 ? r943776 : r943795;
        double r943797 = r943755 ? r943768 : r943796;
        return r943797;
}

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.4
Target14.5
Herbie5.8
\[\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) (* (* (* z 4.0) t) a)) b) (* z c)) < -6.79788688002701e+270

    1. Initial program 48.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. Simplified25.4

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

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

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

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

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

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

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

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

    if -6.79788688002701e+270 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -2.0707488383138553e-229

    1. Initial program 0.8

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

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

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

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

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

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

    if -2.0707488383138553e-229 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 4.48174337903075e+17

    1. Initial program 18.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. Simplified1.0

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

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

    if 4.48174337903075e+17 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 1.3732890460674824e+303

    1. Initial program 0.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}\]

    if 1.3732890460674824e+303 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))

    1. Initial program 62.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. Simplified27.0

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

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

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

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

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

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

    \[\leadsto \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} \le -6.79788688002701001 \cdot 10^{270}:\\ \;\;\;\;\mathsf{fma}\left(x \cdot \frac{1}{c \cdot \frac{z}{y}}, 9, \frac{1}{z} \cdot \frac{b}{c}\right) - 4 \cdot \frac{t \cdot a}{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} \le -2.07074883831385532 \cdot 10^{-229}:\\ \;\;\;\;\left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{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} \le 448174337903075008:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z} - a \cdot \left(4 \cdot t\right)}}\\ \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} \le 1.3732890460674824 \cdot 10^{303}:\\ \;\;\;\;\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}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{c \cdot \frac{z}{y}}, 9, \frac{\frac{b}{z}}{c}\right) - 4 \cdot \frac{t \cdot a}{c}\\ \end{array}\]

Reproduce

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