Average Error: 3.5 → 1.1
Time: 4.1s
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 -1.73860997368552148 \cdot 10^{-139}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - \left(9 \cdot t\right) \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;t \le 1.93734229431234734 \cdot 10^{-73}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\ \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 -1.73860997368552148 \cdot 10^{-139}:\\
\;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - \left(9 \cdot t\right) \cdot \left(z \cdot y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r850174 = x;
        double r850175 = 2.0;
        double r850176 = r850174 * r850175;
        double r850177 = y;
        double r850178 = 9.0;
        double r850179 = r850177 * r850178;
        double r850180 = z;
        double r850181 = r850179 * r850180;
        double r850182 = t;
        double r850183 = r850181 * r850182;
        double r850184 = r850176 - r850183;
        double r850185 = a;
        double r850186 = 27.0;
        double r850187 = r850185 * r850186;
        double r850188 = b;
        double r850189 = r850187 * r850188;
        double r850190 = r850184 + r850189;
        return r850190;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r850191 = t;
        double r850192 = -1.7386099736855215e-139;
        bool r850193 = r850191 <= r850192;
        double r850194 = 2.0;
        double r850195 = x;
        double r850196 = r850194 * r850195;
        double r850197 = 27.0;
        double r850198 = a;
        double r850199 = b;
        double r850200 = r850198 * r850199;
        double r850201 = r850197 * r850200;
        double r850202 = r850196 + r850201;
        double r850203 = 9.0;
        double r850204 = r850203 * r850191;
        double r850205 = z;
        double r850206 = y;
        double r850207 = r850205 * r850206;
        double r850208 = r850204 * r850207;
        double r850209 = r850202 - r850208;
        double r850210 = 1.9373422943123473e-73;
        bool r850211 = r850191 <= r850210;
        double r850212 = r850195 * r850194;
        double r850213 = r850206 * r850203;
        double r850214 = r850205 * r850191;
        double r850215 = r850213 * r850214;
        double r850216 = r850212 - r850215;
        double r850217 = r850198 * r850197;
        double r850218 = r850217 * r850199;
        double r850219 = r850216 + r850218;
        double r850220 = r850203 * r850205;
        double r850221 = r850206 * r850220;
        double r850222 = r850221 * r850191;
        double r850223 = r850212 - r850222;
        double r850224 = r850223 + r850218;
        double r850225 = r850211 ? r850219 : r850224;
        double r850226 = r850193 ? r850209 : r850225;
        return r850226;
}

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.5
Herbie1.1
\[\begin{array}{l} \mathbf{if}\;y \lt 7.590524218811189 \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 < -1.7386099736855215e-139

    1. Initial program 1.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. Taylor expanded around 0 1.6

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

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

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

    if -1.7386099736855215e-139 < t < 1.9373422943123473e-73

    1. Initial program 6.8

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

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

    if 1.9373422943123473e-73 < t

    1. Initial program 1.2

      \[\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.1

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

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

Reproduce

herbie shell --seed 2020021 
(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)))