Average Error: 3.5 → 3.4
Time: 10.2s
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\]
\[\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + 27 \cdot \left(a \cdot b\right)\]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + 27 \cdot \left(a \cdot b\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r633044 = x;
        double r633045 = 2.0;
        double r633046 = r633044 * r633045;
        double r633047 = y;
        double r633048 = 9.0;
        double r633049 = r633047 * r633048;
        double r633050 = z;
        double r633051 = r633049 * r633050;
        double r633052 = t;
        double r633053 = r633051 * r633052;
        double r633054 = r633046 - r633053;
        double r633055 = a;
        double r633056 = 27.0;
        double r633057 = r633055 * r633056;
        double r633058 = b;
        double r633059 = r633057 * r633058;
        double r633060 = r633054 + r633059;
        return r633060;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r633061 = 2.0;
        double r633062 = x;
        double r633063 = r633061 * r633062;
        double r633064 = 9.0;
        double r633065 = t;
        double r633066 = z;
        double r633067 = y;
        double r633068 = r633066 * r633067;
        double r633069 = r633065 * r633068;
        double r633070 = r633064 * r633069;
        double r633071 = r633063 - r633070;
        double r633072 = 27.0;
        double r633073 = a;
        double r633074 = b;
        double r633075 = r633073 * r633074;
        double r633076 = r633072 * r633075;
        double r633077 = r633071 + r633076;
        return r633077;
}

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.6
Herbie3.4
\[\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 < -2.6508813647618153e+68 or 1.6408427513533212e-149 < t

    1. Initial program 1.3

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

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

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

    if -2.6508813647618153e+68 < t < 1.6408427513533212e-149

    1. Initial program 5.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*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\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.4

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

Reproduce

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