Average Error: 3.7 → 3.6
Time: 6.3s
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) + a \cdot \left(27 \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) + a \cdot \left(27 \cdot b\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r593899 = x;
        double r593900 = 2.0;
        double r593901 = r593899 * r593900;
        double r593902 = y;
        double r593903 = 9.0;
        double r593904 = r593902 * r593903;
        double r593905 = z;
        double r593906 = r593904 * r593905;
        double r593907 = t;
        double r593908 = r593906 * r593907;
        double r593909 = r593901 - r593908;
        double r593910 = a;
        double r593911 = 27.0;
        double r593912 = r593910 * r593911;
        double r593913 = b;
        double r593914 = r593912 * r593913;
        double r593915 = r593909 + r593914;
        return r593915;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r593916 = 2.0;
        double r593917 = x;
        double r593918 = r593916 * r593917;
        double r593919 = 9.0;
        double r593920 = t;
        double r593921 = z;
        double r593922 = y;
        double r593923 = r593921 * r593922;
        double r593924 = r593920 * r593923;
        double r593925 = r593919 * r593924;
        double r593926 = r593918 - r593925;
        double r593927 = a;
        double r593928 = 27.0;
        double r593929 = b;
        double r593930 = r593928 * r593929;
        double r593931 = r593927 * r593930;
        double r593932 = r593926 + r593931;
        return r593932;
}

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.7
Target2.5
Herbie3.6
\[\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 (* (* (* y 9.0) z) t) < -inf.0 or 5.460922352855281e+241 < (* (* (* y 9.0) z) t)

    1. Initial program 41.1

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

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

      \[\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)}\]
    6. Using strategy rm
    7. Applied associate-*l*6.7

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

    if -inf.0 < (* (* (* y 9.0) z) t) < 5.460922352855281e+241

    1. Initial program 0.5

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

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

      \[\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)}\]
    6. Taylor expanded around inf 0.4

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

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

Reproduce

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