Average Error: 3.8 → 1.1
Time: 20.5s
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 -5.710514206256463262912944743704297947195 \cdot 10^{-143}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;t \le 6.684904928353329488192510198937718575237 \cdot 10^{-67}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\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 -5.710514206256463262912944743704297947195 \cdot 10^{-143}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r52189150 = x;
        double r52189151 = 2.0;
        double r52189152 = r52189150 * r52189151;
        double r52189153 = y;
        double r52189154 = 9.0;
        double r52189155 = r52189153 * r52189154;
        double r52189156 = z;
        double r52189157 = r52189155 * r52189156;
        double r52189158 = t;
        double r52189159 = r52189157 * r52189158;
        double r52189160 = r52189152 - r52189159;
        double r52189161 = a;
        double r52189162 = 27.0;
        double r52189163 = r52189161 * r52189162;
        double r52189164 = b;
        double r52189165 = r52189163 * r52189164;
        double r52189166 = r52189160 + r52189165;
        return r52189166;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r52189167 = t;
        double r52189168 = -5.710514206256463e-143;
        bool r52189169 = r52189167 <= r52189168;
        double r52189170 = x;
        double r52189171 = 2.0;
        double r52189172 = r52189170 * r52189171;
        double r52189173 = y;
        double r52189174 = 9.0;
        double r52189175 = r52189173 * r52189174;
        double r52189176 = z;
        double r52189177 = r52189175 * r52189176;
        double r52189178 = r52189177 * r52189167;
        double r52189179 = r52189172 - r52189178;
        double r52189180 = a;
        double r52189181 = 27.0;
        double r52189182 = b;
        double r52189183 = r52189181 * r52189182;
        double r52189184 = r52189180 * r52189183;
        double r52189185 = r52189179 + r52189184;
        double r52189186 = 6.68490492835333e-67;
        bool r52189187 = r52189167 <= r52189186;
        double r52189188 = r52189174 * r52189176;
        double r52189189 = r52189188 * r52189167;
        double r52189190 = r52189173 * r52189189;
        double r52189191 = r52189172 - r52189190;
        double r52189192 = r52189180 * r52189182;
        double r52189193 = r52189181 * r52189192;
        double r52189194 = r52189191 + r52189193;
        double r52189195 = r52189187 ? r52189194 : r52189185;
        double r52189196 = r52189169 ? r52189185 : r52189195;
        return r52189196;
}

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.8
Target2.8
Herbie1.1
\[\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 2 regimes
  2. if t < -5.710514206256463e-143 or 6.68490492835333e-67 < t

    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. Using strategy rm
    3. Applied associate-*l*1.4

      \[\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)}\]

    if -5.710514206256463e-143 < t < 6.68490492835333e-67

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

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b\]
    4. Taylor expanded around 0 0.6

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

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

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

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

Reproduce

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

  :herbie-target
  (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))

  (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))