Average Error: 3.6 → 0.8
Time: 16.8s
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 -14647692784802.4375:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;t \le 1.724132339636328783972953075924958338587 \cdot 10^{-101}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(\left(t \cdot z\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(2 \cdot x - \left(9 \cdot \left(y \cdot z\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 -14647692784802.4375:\\
\;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r623977 = x;
        double r623978 = 2.0;
        double r623979 = r623977 * r623978;
        double r623980 = y;
        double r623981 = 9.0;
        double r623982 = r623980 * r623981;
        double r623983 = z;
        double r623984 = r623982 * r623983;
        double r623985 = t;
        double r623986 = r623984 * r623985;
        double r623987 = r623979 - r623986;
        double r623988 = a;
        double r623989 = 27.0;
        double r623990 = r623988 * r623989;
        double r623991 = b;
        double r623992 = r623990 * r623991;
        double r623993 = r623987 + r623992;
        return r623993;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r623994 = t;
        double r623995 = -14647692784802.438;
        bool r623996 = r623994 <= r623995;
        double r623997 = 2.0;
        double r623998 = x;
        double r623999 = r623997 * r623998;
        double r624000 = 27.0;
        double r624001 = a;
        double r624002 = b;
        double r624003 = r624001 * r624002;
        double r624004 = r624000 * r624003;
        double r624005 = r623999 + r624004;
        double r624006 = 9.0;
        double r624007 = z;
        double r624008 = y;
        double r624009 = r624007 * r624008;
        double r624010 = r623994 * r624009;
        double r624011 = r624006 * r624010;
        double r624012 = r624005 - r624011;
        double r624013 = 1.7241323396363288e-101;
        bool r624014 = r623994 <= r624013;
        double r624015 = r623994 * r624007;
        double r624016 = r624015 * r624008;
        double r624017 = r624006 * r624016;
        double r624018 = r624005 - r624017;
        double r624019 = r624000 * r624002;
        double r624020 = r624001 * r624019;
        double r624021 = r624008 * r624007;
        double r624022 = r624006 * r624021;
        double r624023 = r624022 * r623994;
        double r624024 = r623999 - r624023;
        double r624025 = r624020 + r624024;
        double r624026 = r624014 ? r624018 : r624025;
        double r624027 = r623996 ? r624012 : r624026;
        return r624027;
}

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.6
Target2.7
Herbie0.8
\[\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 < -14647692784802.438

    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. Taylor expanded around inf 0.7

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

    if -14647692784802.438 < t < 1.7241323396363288e-101

    1. Initial program 5.9

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

      \[\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. Using strategy rm
    4. Applied associate-*r*0.4

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

    if 1.7241323396363288e-101 < t

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

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

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

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

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

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

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

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

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

Reproduce

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