Average Error: 5.7 → 1.6
Time: 9.6s
Precision: binary64
\[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
\[\begin{array}{l} \mathbf{if}\;x \leq -7.14462332976739 \cdot 10^{-22} \lor \neg \left(x \leq 1.8467307309333337 \cdot 10^{-43}\right):\\ \;\;\;\;x \cdot \left(y \cdot \left(18 \cdot \left(z \cdot t\right)\right)\right) + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right) + t \cdot \left(18 \cdot \left(y \cdot \left(x \cdot z\right)\right)\right)\\ \end{array}\]
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\begin{array}{l}
\mathbf{if}\;x \leq -7.14462332976739 \cdot 10^{-22} \lor \neg \left(x \leq 1.8467307309333337 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \left(y \cdot \left(18 \cdot \left(z \cdot t\right)\right)\right) + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right) + t \cdot \left(18 \cdot \left(y \cdot \left(x \cdot z\right)\right)\right)\\

\end{array}
(FPCore (x y z t a b c i j k)
 :precision binary64
 (-
  (-
   (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c))
   (* (* x 4.0) i))
  (* (* j 27.0) k)))
(FPCore (x y z t a b c i j k)
 :precision binary64
 (if (or (<= x -7.14462332976739e-22) (not (<= x 1.8467307309333337e-43)))
   (+
    (* x (* y (* 18.0 (* z t))))
    (- (* b c) (+ (* j (* 27.0 k)) (* 4.0 (+ (* t a) (* x i))))))
   (+
    (- (* b c) (+ (* j (* 27.0 k)) (* 4.0 (+ (* t a) (* x i)))))
    (* t (* 18.0 (* y (* x z)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	return ((double) (((double) (((double) (((double) (((double) (((double) (((double) (((double) (x * 18.0)) * y)) * z)) * t)) - ((double) (((double) (a * 4.0)) * t)))) + ((double) (b * c)))) - ((double) (((double) (x * 4.0)) * i)))) - ((double) (((double) (j * 27.0)) * k))));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
	double tmp;
	if (((x <= -7.14462332976739e-22) || !(x <= 1.8467307309333337e-43))) {
		tmp = ((double) (((double) (x * ((double) (y * ((double) (18.0 * ((double) (z * t)))))))) + ((double) (((double) (b * c)) - ((double) (((double) (j * ((double) (27.0 * k)))) + ((double) (4.0 * ((double) (((double) (t * a)) + ((double) (x * i))))))))))));
	} else {
		tmp = ((double) (((double) (((double) (b * c)) - ((double) (((double) (j * ((double) (27.0 * k)))) + ((double) (4.0 * ((double) (((double) (t * a)) + ((double) (x * i)))))))))) + ((double) (t * ((double) (18.0 * ((double) (y * ((double) (x * z))))))))));
	}
	return tmp;
}

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

Bits error versus c

Bits error versus i

Bits error versus j

Bits error versus k

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.7
Target1.7
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;t < -1.6210815397541398 \cdot 10^{-69}:\\ \;\;\;\;\left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \mathbf{elif}\;t < 165.68027943805222:\\ \;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -7.1446233297673901e-22 or 1.84673073093333372e-43 < x

    1. Initial program Error: 11.3 bits

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
    2. SimplifiedError: 2.0 bits

      \[\leadsto \color{blue}{x \cdot \left(18 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right) + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)}\]
    3. Taylor expanded around inf Error: 2.3 bits

      \[\leadsto x \cdot \color{blue}{\left(18 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)} + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\]
    4. SimplifiedError: 2.0 bits

      \[\leadsto x \cdot \color{blue}{\left(y \cdot \left(18 \cdot \left(z \cdot t\right)\right)\right)} + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\]

    if -7.1446233297673901e-22 < x < 1.84673073093333372e-43

    1. Initial program Error: 1.3 bits

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
    2. SimplifiedError: 8.5 bits

      \[\leadsto \color{blue}{x \cdot \left(18 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right) + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)}\]
    3. Taylor expanded around inf Error: 5.8 bits

      \[\leadsto \color{blue}{18 \cdot \left(t \cdot \left(x \cdot \left(z \cdot y\right)\right)\right)} + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\]
    4. SimplifiedError: 1.3 bits

      \[\leadsto \color{blue}{t \cdot \left(\left(y \cdot \left(z \cdot x\right)\right) \cdot 18\right)} + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplificationError: 1.6 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.14462332976739 \cdot 10^{-22} \lor \neg \left(x \leq 1.8467307309333337 \cdot 10^{-43}\right):\\ \;\;\;\;x \cdot \left(y \cdot \left(18 \cdot \left(z \cdot t\right)\right)\right) + \left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot c - \left(j \cdot \left(27 \cdot k\right) + 4 \cdot \left(t \cdot a + x \cdot i\right)\right)\right) + t \cdot \left(18 \cdot \left(y \cdot \left(x \cdot z\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020203 
(FPCore (x y z t a b c i j k)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, E"
  :precision binary64

  :herbie-target
  (if (< t -1.6210815397541398e-69) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b))) (if (< t 165.68027943805222) (+ (- (* (* 18.0 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4.0)) (- (* c b) (* 27.0 (* k j)))) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b)))))

  (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))