Average Error: 3.5 → 1.0
Time: 16.0s
Precision: 64
\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;t \le -2.171737053366690492496454059018873464008 \cdot 10^{128}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{elif}\;t \le 4.404072813174863545657687298340743366284 \cdot 10^{58}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(2 \cdot x - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right)\\ \end{array}\]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
\mathbf{if}\;t \le -2.171737053366690492496454059018873464008 \cdot 10^{128}:\\
\;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\

\mathbf{elif}\;t \le 4.404072813174863545657687298340743366284 \cdot 10^{58}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(2 \cdot x - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right)\\

\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r558133 = x;
        double r558134 = 2.0;
        double r558135 = r558133 * r558134;
        double r558136 = y;
        double r558137 = 9.0;
        double r558138 = r558136 * r558137;
        double r558139 = z;
        double r558140 = r558138 * r558139;
        double r558141 = t;
        double r558142 = r558140 * r558141;
        double r558143 = r558135 - r558142;
        double r558144 = a;
        double r558145 = 27.0;
        double r558146 = r558144 * r558145;
        double r558147 = b;
        double r558148 = r558146 * r558147;
        double r558149 = r558143 + r558148;
        return r558149;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r558150 = t;
        double r558151 = -2.1717370533666905e+128;
        bool r558152 = r558150 <= r558151;
        double r558153 = 2.0;
        double r558154 = x;
        double r558155 = r558153 * r558154;
        double r558156 = 9.0;
        double r558157 = z;
        double r558158 = y;
        double r558159 = r558157 * r558158;
        double r558160 = r558150 * r558159;
        double r558161 = r558156 * r558160;
        double r558162 = r558155 - r558161;
        double r558163 = a;
        double r558164 = 27.0;
        double r558165 = r558163 * r558164;
        double r558166 = b;
        double r558167 = r558165 * r558166;
        double r558168 = r558162 + r558167;
        double r558169 = 4.4040728131748635e+58;
        bool r558170 = r558150 <= r558169;
        double r558171 = r558164 * r558166;
        double r558172 = r558163 * r558171;
        double r558173 = r558156 * r558157;
        double r558174 = r558173 * r558150;
        double r558175 = r558158 * r558174;
        double r558176 = r558155 - r558175;
        double r558177 = r558172 + r558176;
        double r558178 = r558163 * r558166;
        double r558179 = r558164 * r558178;
        double r558180 = r558154 * r558153;
        double r558181 = r558157 * r558156;
        double r558182 = r558158 * r558181;
        double r558183 = r558182 * r558150;
        double r558184 = r558180 - r558183;
        double r558185 = r558179 + r558184;
        double r558186 = r558170 ? r558177 : r558185;
        double r558187 = r558152 ? r558168 : r558186;
        return r558187;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.5
Target2.4
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;y \lt 7.590524218811188954625810696587370427881 \cdot 10^{-161}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -2.1717370533666905e+128

    1. Initial program 1.4

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Taylor expanded around inf 1.4

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

    if -2.1717370533666905e+128 < t < 4.4040728131748635e+58

    1. Initial program 4.5

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*4.5

      \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \color{blue}{a \cdot \left(27 \cdot b\right)}\]
    4. Using strategy rm
    5. Applied pow14.5

      \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot \color{blue}{{t}^{1}}\right) + a \cdot \left(27 \cdot b\right)\]
    6. Applied pow14.5

      \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \color{blue}{{z}^{1}}\right) \cdot {t}^{1}\right) + a \cdot \left(27 \cdot b\right)\]
    7. Applied pow14.5

      \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot \color{blue}{{9}^{1}}\right) \cdot {z}^{1}\right) \cdot {t}^{1}\right) + a \cdot \left(27 \cdot b\right)\]
    8. Applied pow14.5

      \[\leadsto \left(x \cdot 2 - \left(\left(\color{blue}{{y}^{1}} \cdot {9}^{1}\right) \cdot {z}^{1}\right) \cdot {t}^{1}\right) + a \cdot \left(27 \cdot b\right)\]
    9. Applied pow-prod-down4.5

      \[\leadsto \left(x \cdot 2 - \left(\color{blue}{{\left(y \cdot 9\right)}^{1}} \cdot {z}^{1}\right) \cdot {t}^{1}\right) + a \cdot \left(27 \cdot b\right)\]
    10. Applied pow-prod-down4.5

      \[\leadsto \left(x \cdot 2 - \color{blue}{{\left(\left(y \cdot 9\right) \cdot z\right)}^{1}} \cdot {t}^{1}\right) + a \cdot \left(27 \cdot b\right)\]
    11. Applied pow-prod-down4.5

      \[\leadsto \left(x \cdot 2 - \color{blue}{{\left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)}^{1}}\right) + a \cdot \left(27 \cdot b\right)\]
    12. Simplified1.1

      \[\leadsto \left(x \cdot 2 - {\color{blue}{\left(y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right)}}^{1}\right) + a \cdot \left(27 \cdot b\right)\]

    if 4.4040728131748635e+58 < t

    1. Initial program 0.6

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*0.5

      \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \color{blue}{a \cdot \left(27 \cdot b\right)}\]
    4. Using strategy rm
    5. Applied associate-*l*0.6

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + a \cdot \left(27 \cdot b\right)\]
    6. Simplified0.6

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \color{blue}{\left(z \cdot 9\right)}\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\]
    7. Using strategy rm
    8. Applied pow10.6

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + a \cdot \left(27 \cdot \color{blue}{{b}^{1}}\right)\]
    9. Applied pow10.6

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + a \cdot \left(\color{blue}{{27}^{1}} \cdot {b}^{1}\right)\]
    10. Applied pow-prod-down0.6

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + a \cdot \color{blue}{{\left(27 \cdot b\right)}^{1}}\]
    11. Applied pow10.6

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + \color{blue}{{a}^{1}} \cdot {\left(27 \cdot b\right)}^{1}\]
    12. Applied pow-prod-down0.6

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + \color{blue}{{\left(a \cdot \left(27 \cdot b\right)\right)}^{1}}\]
    13. Simplified0.5

      \[\leadsto \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + {\color{blue}{\left(27 \cdot \left(a \cdot b\right)\right)}}^{1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.171737053366690492496454059018873464008 \cdot 10^{128}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{elif}\;t \le 4.404072813174863545657687298340743366284 \cdot 10^{58}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(2 \cdot x - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< y 7.590524218811189e-161) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b)))

  (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))