Average Error: 6.2 → 1.4
Time: 28.7s
Precision: 64
\[2.0 \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 4.487426699771173 \cdot 10^{+21}:\\ \;\;\;\;2.0 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2.0 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(a \cdot i + c \cdot \left(b \cdot i\right)\right) \cdot c\right)\\ \end{array}\]
2.0 \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 4.487426699771173 \cdot 10^{+21}:\\
\;\;\;\;2.0 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2.0 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(a \cdot i + c \cdot \left(b \cdot i\right)\right) \cdot c\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r30249818 = 2.0;
        double r30249819 = x;
        double r30249820 = y;
        double r30249821 = r30249819 * r30249820;
        double r30249822 = z;
        double r30249823 = t;
        double r30249824 = r30249822 * r30249823;
        double r30249825 = r30249821 + r30249824;
        double r30249826 = a;
        double r30249827 = b;
        double r30249828 = c;
        double r30249829 = r30249827 * r30249828;
        double r30249830 = r30249826 + r30249829;
        double r30249831 = r30249830 * r30249828;
        double r30249832 = i;
        double r30249833 = r30249831 * r30249832;
        double r30249834 = r30249825 - r30249833;
        double r30249835 = r30249818 * r30249834;
        return r30249835;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r30249836 = c;
        double r30249837 = 4.487426699771173e+21;
        bool r30249838 = r30249836 <= r30249837;
        double r30249839 = 2.0;
        double r30249840 = t;
        double r30249841 = z;
        double r30249842 = x;
        double r30249843 = y;
        double r30249844 = r30249842 * r30249843;
        double r30249845 = fma(r30249840, r30249841, r30249844);
        double r30249846 = b;
        double r30249847 = a;
        double r30249848 = fma(r30249836, r30249846, r30249847);
        double r30249849 = i;
        double r30249850 = r30249849 * r30249836;
        double r30249851 = r30249848 * r30249850;
        double r30249852 = r30249845 - r30249851;
        double r30249853 = r30249839 * r30249852;
        double r30249854 = r30249847 * r30249849;
        double r30249855 = r30249846 * r30249849;
        double r30249856 = r30249836 * r30249855;
        double r30249857 = r30249854 + r30249856;
        double r30249858 = r30249857 * r30249836;
        double r30249859 = r30249845 - r30249858;
        double r30249860 = r30249839 * r30249859;
        double r30249861 = r30249838 ? r30249853 : r30249860;
        return r30249861;
}

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.2
Target1.7
Herbie1.4
\[2.0 \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 2 regimes
  2. if c < 4.487426699771173e+21

    1. Initial program 3.7

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

      \[\leadsto \color{blue}{2.0 \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*5.1

      \[\leadsto 2.0 \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)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt5.4

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

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

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)\right) \cdot \color{blue}{{\left(\sqrt[3]{c}\right)}^{1}}\right)\]
    10. Applied pow15.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(\sqrt[3]{c} \cdot \color{blue}{{\left(\sqrt[3]{c}\right)}^{1}}\right)\right) \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    11. Applied pow15.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(\color{blue}{{\left(\sqrt[3]{c}\right)}^{1}} \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\right) \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    12. Applied pow-prod-down5.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \color{blue}{{\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    13. Applied pow15.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(i \cdot \color{blue}{{\left(\mathsf{fma}\left(b, c, a\right)\right)}^{1}}\right) \cdot {\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)}^{1}\right) \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    14. Applied pow15.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(\color{blue}{{i}^{1}} \cdot {\left(\mathsf{fma}\left(b, c, a\right)\right)}^{1}\right) \cdot {\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)}^{1}\right) \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    15. Applied pow-prod-down5.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\color{blue}{{\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right)}^{1}} \cdot {\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)}^{1}\right) \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    16. Applied pow-prod-down5.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{{\left(\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)\right)}^{1}} \cdot {\left(\sqrt[3]{c}\right)}^{1}\right)\]
    17. Applied pow-prod-down5.4

      \[\leadsto 2.0 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \color{blue}{{\left(\left(\left(i \cdot \mathsf{fma}\left(b, c, a\right)\right) \cdot \left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right)\right) \cdot \sqrt[3]{c}\right)}^{1}}\right)\]
    18. Simplified1.1

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

    if 4.487426699771173e+21 < c

    1. Initial program 21.0

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

      \[\leadsto \color{blue}{2.0 \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*3.4

      \[\leadsto 2.0 \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)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt3.9

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le 4.487426699771173 \cdot 10^{+21}:\\ \;\;\;\;2.0 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \mathsf{fma}\left(c, b, a\right) \cdot \left(i \cdot c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2.0 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - \left(a \cdot i + c \cdot \left(b \cdot i\right)\right) \cdot c\right)\\ \end{array}\]

Reproduce

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