Average Error: 6.3 → 1.7
Time: 24.3s
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}\;i \le -8.327975069112872648975651232866366804062 \cdot 10^{76}:\\ \;\;\;\;\left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(\sqrt[3]{i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\right)} \cdot \sqrt[3]{i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\right)}\right) \cdot \sqrt[3]{\left(\sqrt[3]{i} \cdot \sqrt[3]{i}\right) \cdot \left(\left(c \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \sqrt[3]{i}\right)}\right) \cdot 2\\ \mathbf{elif}\;i \le 15715355264021134502316211109778109235200:\\ \;\;\;\;\left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right) \cdot c\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(\left(\sqrt[3]{c \cdot \mathsf{fma}\left(b, c, a\right)} \cdot \sqrt[3]{c \cdot \mathsf{fma}\left(b, c, a\right)}\right) \cdot \sqrt[3]{\sqrt[3]{c \cdot \mathsf{fma}\left(b, c, a\right)} \cdot \left(\sqrt[3]{c \cdot \mathsf{fma}\left(b, c, a\right)} \cdot \sqrt[3]{c \cdot \mathsf{fma}\left(b, c, a\right)}\right)}\right) \cdot i\right) \cdot 2\\ \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}\;i \le -8.327975069112872648975651232866366804062 \cdot 10^{76}:\\
\;\;\;\;\left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(\sqrt[3]{i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\right)} \cdot \sqrt[3]{i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\right)}\right) \cdot \sqrt[3]{\left(\sqrt[3]{i} \cdot \sqrt[3]{i}\right) \cdot \left(\left(c \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \sqrt[3]{i}\right)}\right) \cdot 2\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r33120756 = 2.0;
        double r33120757 = x;
        double r33120758 = y;
        double r33120759 = r33120757 * r33120758;
        double r33120760 = z;
        double r33120761 = t;
        double r33120762 = r33120760 * r33120761;
        double r33120763 = r33120759 + r33120762;
        double r33120764 = a;
        double r33120765 = b;
        double r33120766 = c;
        double r33120767 = r33120765 * r33120766;
        double r33120768 = r33120764 + r33120767;
        double r33120769 = r33120768 * r33120766;
        double r33120770 = i;
        double r33120771 = r33120769 * r33120770;
        double r33120772 = r33120763 - r33120771;
        double r33120773 = r33120756 * r33120772;
        return r33120773;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r33120774 = i;
        double r33120775 = -8.327975069112873e+76;
        bool r33120776 = r33120774 <= r33120775;
        double r33120777 = t;
        double r33120778 = z;
        double r33120779 = x;
        double r33120780 = y;
        double r33120781 = r33120779 * r33120780;
        double r33120782 = fma(r33120777, r33120778, r33120781);
        double r33120783 = c;
        double r33120784 = b;
        double r33120785 = a;
        double r33120786 = fma(r33120784, r33120783, r33120785);
        double r33120787 = r33120783 * r33120786;
        double r33120788 = r33120774 * r33120787;
        double r33120789 = cbrt(r33120788);
        double r33120790 = r33120789 * r33120789;
        double r33120791 = cbrt(r33120774);
        double r33120792 = r33120791 * r33120791;
        double r33120793 = r33120787 * r33120791;
        double r33120794 = r33120792 * r33120793;
        double r33120795 = cbrt(r33120794);
        double r33120796 = r33120790 * r33120795;
        double r33120797 = r33120782 - r33120796;
        double r33120798 = 2.0;
        double r33120799 = r33120797 * r33120798;
        double r33120800 = 1.5715355264021135e+40;
        bool r33120801 = r33120774 <= r33120800;
        double r33120802 = r33120786 * r33120774;
        double r33120803 = r33120802 * r33120783;
        double r33120804 = r33120782 - r33120803;
        double r33120805 = r33120804 * r33120798;
        double r33120806 = cbrt(r33120787);
        double r33120807 = r33120806 * r33120806;
        double r33120808 = r33120806 * r33120807;
        double r33120809 = cbrt(r33120808);
        double r33120810 = r33120807 * r33120809;
        double r33120811 = r33120810 * r33120774;
        double r33120812 = r33120782 - r33120811;
        double r33120813 = r33120812 * r33120798;
        double r33120814 = r33120801 ? r33120805 : r33120813;
        double r33120815 = r33120776 ? r33120799 : r33120814;
        return r33120815;
}

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
Target2.0
Herbie1.7
\[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 i < -8.327975069112873e+76

    1. Initial program 1.0

      \[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}{2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - i \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt1.4

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

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

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

    if -8.327975069112873e+76 < i < 1.5715355264021135e+40

    1. Initial program 8.6

      \[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. Simplified8.6

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

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

    if 1.5715355264021135e+40 < i

    1. Initial program 0.8

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

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

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

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

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

Reproduce

herbie shell --seed 2019192 +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"

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

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