Average Error: 6.3 → 2.2
Time: 9.7s
Precision: 64
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
\[\begin{array}{l} \mathbf{if}\;c \le -2.78867939221890347 \cdot 10^{113}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}\right)\right)\\ \mathbf{elif}\;c \le 1.88250129061364727 \cdot 10^{37}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), 2 \cdot \left(\left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot c\right) \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{c \cdot i}\right)\right) \cdot \sqrt[3]{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}\right)\right)\\ \end{array}\]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\begin{array}{l}
\mathbf{if}\;c \le -2.78867939221890347 \cdot 10^{113}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}\right)\right)\\

\mathbf{elif}\;c \le 1.88250129061364727 \cdot 10^{37}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), 2 \cdot \left(\left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot c\right) \cdot i\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{c \cdot i}\right)\right) \cdot \sqrt[3]{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r751985 = 2.0;
        double r751986 = x;
        double r751987 = y;
        double r751988 = r751986 * r751987;
        double r751989 = z;
        double r751990 = t;
        double r751991 = r751989 * r751990;
        double r751992 = r751988 + r751991;
        double r751993 = a;
        double r751994 = b;
        double r751995 = c;
        double r751996 = r751994 * r751995;
        double r751997 = r751993 + r751996;
        double r751998 = r751997 * r751995;
        double r751999 = i;
        double r752000 = r751998 * r751999;
        double r752001 = r751992 - r752000;
        double r752002 = r751985 * r752001;
        return r752002;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r752003 = c;
        double r752004 = -2.7886793922189035e+113;
        bool r752005 = r752003 <= r752004;
        double r752006 = 2.0;
        double r752007 = x;
        double r752008 = y;
        double r752009 = z;
        double r752010 = t;
        double r752011 = r752009 * r752010;
        double r752012 = fma(r752007, r752008, r752011);
        double r752013 = b;
        double r752014 = a;
        double r752015 = fma(r752003, r752013, r752014);
        double r752016 = -r752015;
        double r752017 = i;
        double r752018 = r752003 * r752017;
        double r752019 = r752016 * r752018;
        double r752020 = cbrt(r752019);
        double r752021 = r752020 * r752020;
        double r752022 = cbrt(r752016);
        double r752023 = r752022 * r752022;
        double r752024 = r752022 * r752018;
        double r752025 = r752023 * r752024;
        double r752026 = cbrt(r752025);
        double r752027 = r752021 * r752026;
        double r752028 = r752006 * r752027;
        double r752029 = fma(r752006, r752012, r752028);
        double r752030 = 1.8825012906136473e+37;
        bool r752031 = r752003 <= r752030;
        double r752032 = r752007 * r752008;
        double r752033 = fma(r752010, r752009, r752032);
        double r752034 = r752016 * r752003;
        double r752035 = r752034 * r752017;
        double r752036 = r752006 * r752035;
        double r752037 = fma(r752006, r752033, r752036);
        double r752038 = cbrt(r752018);
        double r752039 = r752022 * r752038;
        double r752040 = r752020 * r752039;
        double r752041 = r752040 * r752026;
        double r752042 = r752006 * r752041;
        double r752043 = fma(r752006, r752012, r752042);
        double r752044 = r752031 ? r752037 : r752043;
        double r752045 = r752005 ? r752029 : r752044;
        return r752045;
}

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

Bits error versus i

Target

Original6.3
Target1.9
Herbie2.2
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\]

Derivation

  1. Split input into 3 regimes
  2. if c < -2.7886793922189035e+113

    1. Initial program 32.3

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
    2. Simplified5.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt5.6

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \color{blue}{\left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right)}\right)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt5.6

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\color{blue}{\left(\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right)} \cdot \left(c \cdot i\right)}\right)\right)\]
    7. Applied associate-*l*5.6

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

    if -2.7886793922189035e+113 < c < 1.8825012906136473e+37

    1. Initial program 1.3

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
    2. Simplified1.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)}\]
    3. Taylor expanded around inf 1.0

      \[\leadsto \mathsf{fma}\left(2, \color{blue}{t \cdot z + x \cdot y}, 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\]
    4. Simplified1.0

      \[\leadsto \mathsf{fma}\left(2, \color{blue}{\mathsf{fma}\left(t, z, x \cdot y\right)}, 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\]
    5. Using strategy rm
    6. Applied associate-*r*1.3

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

    if 1.8825012906136473e+37 < c

    1. Initial program 23.9

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
    2. Simplified5.7

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt6.2

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \color{blue}{\left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right)}\right)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt6.2

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\color{blue}{\left(\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right)} \cdot \left(c \cdot i\right)}\right)\right)\]
    7. Applied associate-*l*6.1

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}}\right)\right)\]
    8. Using strategy rm
    9. Applied cbrt-prod6.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -2.78867939221890347 \cdot 10^{113}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)}\right) \cdot \sqrt[3]{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}\right)\right)\\ \mathbf{elif}\;c \le 1.88250129061364727 \cdot 10^{37}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), 2 \cdot \left(\left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot c\right) \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(\sqrt[3]{\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)} \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{c \cdot i}\right)\right) \cdot \sqrt[3]{\left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{-\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\sqrt[3]{-\mathsf{fma}\left(c, b, a\right)} \cdot \left(c \cdot i\right)\right)}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020081 +o rules:numerics
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

  (* 2 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))