Average Error: 4.1 → 1.0
Time: 10.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}\;y \cdot 9 \le -1.80294560403524109 \cdot 10^{-79} \lor \neg \left(y \cdot 9 \le 4.4323646665533492 \cdot 10^{-78}\right):\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\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}\;y \cdot 9 \le -1.80294560403524109 \cdot 10^{-79} \lor \neg \left(y \cdot 9 \le 4.4323646665533492 \cdot 10^{-78}\right):\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r4373 = x;
        double r4374 = 2.0;
        double r4375 = r4373 * r4374;
        double r4376 = y;
        double r4377 = 9.0;
        double r4378 = r4376 * r4377;
        double r4379 = z;
        double r4380 = r4378 * r4379;
        double r4381 = t;
        double r4382 = r4380 * r4381;
        double r4383 = r4375 - r4382;
        double r4384 = a;
        double r4385 = 27.0;
        double r4386 = r4384 * r4385;
        double r4387 = b;
        double r4388 = r4386 * r4387;
        double r4389 = r4383 + r4388;
        return r4389;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r4390 = y;
        double r4391 = 9.0;
        double r4392 = r4390 * r4391;
        double r4393 = -1.802945604035241e-79;
        bool r4394 = r4392 <= r4393;
        double r4395 = 4.432364666553349e-78;
        bool r4396 = r4392 <= r4395;
        double r4397 = !r4396;
        bool r4398 = r4394 || r4397;
        double r4399 = x;
        double r4400 = 2.0;
        double r4401 = r4399 * r4400;
        double r4402 = z;
        double r4403 = r4391 * r4402;
        double r4404 = t;
        double r4405 = r4403 * r4404;
        double r4406 = r4390 * r4405;
        double r4407 = r4401 - r4406;
        double r4408 = a;
        double r4409 = 27.0;
        double r4410 = r4408 * r4409;
        double r4411 = b;
        double r4412 = r4410 * r4411;
        double r4413 = r4407 + r4412;
        double r4414 = r4400 * r4399;
        double r4415 = r4408 * r4411;
        double r4416 = r4409 * r4415;
        double r4417 = r4414 + r4416;
        double r4418 = r4402 * r4390;
        double r4419 = r4404 * r4418;
        double r4420 = r4391 * r4419;
        double r4421 = r4417 - r4420;
        double r4422 = r4398 ? r4413 : r4421;
        return r4422;
}

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

Original4.1
Target2.8
Herbie1.0
\[\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 2 regimes
  2. if (* y 9.0) < -1.802945604035241e-79 or 4.432364666553349e-78 < (* y 9.0)

    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*1.3

      \[\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. Using strategy rm
    5. Applied associate-*l*1.3

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

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

    if -1.802945604035241e-79 < (* y 9.0) < 4.432364666553349e-78

    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 pow10.6

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

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

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

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

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

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

      \[\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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot 9 \le -1.80294560403524109 \cdot 10^{-79} \lor \neg \left(y \cdot 9 \le 4.4323646665533492 \cdot 10^{-78}\right):\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \end{array}\]

Reproduce

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