Average Error: 3.9 → 0.7
Time: 4.6s
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.68222309471244744 \cdot 10^{-14}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(t \cdot z\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \mathbf{elif}\;y \cdot 9 \le 2.4332828583437407 \cdot 10^{21}:\\ \;\;\;\;1 \cdot \left(\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\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}\;y \cdot 9 \le -1.68222309471244744 \cdot 10^{-14}:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(t \cdot z\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\

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

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\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 r773465 = x;
        double r773466 = 2.0;
        double r773467 = r773465 * r773466;
        double r773468 = y;
        double r773469 = 9.0;
        double r773470 = r773468 * r773469;
        double r773471 = z;
        double r773472 = r773470 * r773471;
        double r773473 = t;
        double r773474 = r773472 * r773473;
        double r773475 = r773467 - r773474;
        double r773476 = a;
        double r773477 = 27.0;
        double r773478 = r773476 * r773477;
        double r773479 = b;
        double r773480 = r773478 * r773479;
        double r773481 = r773475 + r773480;
        return r773481;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r773482 = y;
        double r773483 = 9.0;
        double r773484 = r773482 * r773483;
        double r773485 = -1.6822230947124474e-14;
        bool r773486 = r773484 <= r773485;
        double r773487 = x;
        double r773488 = 2.0;
        double r773489 = r773487 * r773488;
        double r773490 = t;
        double r773491 = z;
        double r773492 = r773490 * r773491;
        double r773493 = r773483 * r773492;
        double r773494 = r773482 * r773493;
        double r773495 = r773489 - r773494;
        double r773496 = 27.0;
        double r773497 = a;
        double r773498 = b;
        double r773499 = r773497 * r773498;
        double r773500 = r773496 * r773499;
        double r773501 = 1.0;
        double r773502 = pow(r773500, r773501);
        double r773503 = r773495 + r773502;
        double r773504 = 2.4332828583437407e+21;
        bool r773505 = r773484 <= r773504;
        double r773506 = r773488 * r773487;
        double r773507 = r773506 + r773500;
        double r773508 = r773491 * r773482;
        double r773509 = r773490 * r773508;
        double r773510 = r773483 * r773509;
        double r773511 = r773507 - r773510;
        double r773512 = r773501 * r773511;
        double r773513 = r773491 * r773490;
        double r773514 = r773484 * r773513;
        double r773515 = r773489 - r773514;
        double r773516 = r773496 * r773498;
        double r773517 = r773497 * r773516;
        double r773518 = r773515 + r773517;
        double r773519 = r773505 ? r773512 : r773518;
        double r773520 = r773486 ? r773503 : r773519;
        return r773520;
}

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.9
Target2.7
Herbie0.7
\[\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 (* y 9.0) < -1.6822230947124474e-14

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

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

      \[\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 pow11.0

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

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

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

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

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

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

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

    if -1.6822230947124474e-14 < (* y 9.0) < 2.4332828583437407e+21

    1. Initial program 0.7

      \[\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*6.0

      \[\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*6.0

      \[\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 pow16.0

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

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

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

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

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

      \[\leadsto \left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right) + {\color{blue}{\left(27 \cdot \left(a \cdot b\right)\right)}}^{1}\]
    13. Using strategy rm
    14. Applied *-un-lft-identity6.0

      \[\leadsto \left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right) + \color{blue}{1 \cdot {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}}\]
    15. Applied *-un-lft-identity6.0

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

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

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

    if 2.4332828583437407e+21 < (* y 9.0)

    1. Initial program 8.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. Using strategy rm
    5. Applied associate-*l*0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot 9 \le -1.68222309471244744 \cdot 10^{-14}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(t \cdot z\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \mathbf{elif}\;y \cdot 9 \le 2.4332828583437407 \cdot 10^{21}:\\ \;\;\;\;1 \cdot \left(\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\ \end{array}\]

Reproduce

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