Average Error: 12.6 → 12.6
Time: 8.7s
Precision: 64
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
\[\left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + \left(j \cdot \left(c \cdot a - y \cdot i\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)\right)\]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + \left(j \cdot \left(c \cdot a - y \cdot i\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r850184 = x;
        double r850185 = y;
        double r850186 = z;
        double r850187 = r850185 * r850186;
        double r850188 = t;
        double r850189 = a;
        double r850190 = r850188 * r850189;
        double r850191 = r850187 - r850190;
        double r850192 = r850184 * r850191;
        double r850193 = b;
        double r850194 = c;
        double r850195 = r850194 * r850186;
        double r850196 = i;
        double r850197 = r850188 * r850196;
        double r850198 = r850195 - r850197;
        double r850199 = r850193 * r850198;
        double r850200 = r850192 - r850199;
        double r850201 = j;
        double r850202 = r850194 * r850189;
        double r850203 = r850185 * r850196;
        double r850204 = r850202 - r850203;
        double r850205 = r850201 * r850204;
        double r850206 = r850200 + r850205;
        return r850206;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r850207 = x;
        double r850208 = y;
        double r850209 = z;
        double r850210 = a;
        double r850211 = t;
        double r850212 = r850210 * r850211;
        double r850213 = -r850212;
        double r850214 = fma(r850208, r850209, r850213);
        double r850215 = r850207 * r850214;
        double r850216 = -r850210;
        double r850217 = fma(r850216, r850211, r850212);
        double r850218 = r850207 * r850217;
        double r850219 = r850215 + r850218;
        double r850220 = b;
        double r850221 = c;
        double r850222 = r850221 * r850209;
        double r850223 = i;
        double r850224 = r850211 * r850223;
        double r850225 = r850222 - r850224;
        double r850226 = r850220 * r850225;
        double r850227 = -r850223;
        double r850228 = r850223 * r850211;
        double r850229 = fma(r850227, r850211, r850228);
        double r850230 = r850220 * r850229;
        double r850231 = r850226 + r850230;
        double r850232 = r850219 - r850231;
        double r850233 = j;
        double r850234 = r850221 * r850210;
        double r850235 = r850208 * r850223;
        double r850236 = r850234 - r850235;
        double r850237 = r850233 * r850236;
        double r850238 = r850223 * r850208;
        double r850239 = fma(r850227, r850208, r850238);
        double r850240 = r850233 * r850239;
        double r850241 = r850237 + r850240;
        double r850242 = r850232 + r850241;
        return r850242;
}

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

Target

Original12.6
Target20.2
Herbie12.6
\[\begin{array}{l} \mathbf{if}\;x \lt -1.46969429677770502 \cdot 10^{-64}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x \lt 3.2113527362226803 \cdot 10^{-147}:\\ \;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array}\]

Derivation

  1. Initial program 12.6

    \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
  2. Using strategy rm
  3. Applied prod-diff12.6

    \[\leadsto \left(x \cdot \color{blue}{\left(\mathsf{fma}\left(y, z, -a \cdot t\right) + \mathsf{fma}\left(-a, t, a \cdot t\right)\right)} - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
  4. Applied distribute-lft-in12.6

    \[\leadsto \left(\color{blue}{\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right)} - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
  5. Using strategy rm
  6. Applied prod-diff12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - b \cdot \color{blue}{\left(\mathsf{fma}\left(c, z, -i \cdot t\right) + \mathsf{fma}\left(-i, t, i \cdot t\right)\right)}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
  7. Applied distribute-lft-in12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \color{blue}{\left(b \cdot \mathsf{fma}\left(c, z, -i \cdot t\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
  8. Simplified12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(\color{blue}{b \cdot \left(c \cdot z - t \cdot i\right)} + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\]
  9. Using strategy rm
  10. Applied prod-diff12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \color{blue}{\left(\mathsf{fma}\left(c, a, -i \cdot y\right) + \mathsf{fma}\left(-i, y, i \cdot y\right)\right)}\]
  11. Applied distribute-lft-in12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + \color{blue}{\left(j \cdot \mathsf{fma}\left(c, a, -i \cdot y\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)\right)}\]
  12. Simplified12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + \left(\color{blue}{j \cdot \left(c \cdot a - y \cdot i\right)} + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)\right)\]
  13. Final simplification12.6

    \[\leadsto \left(\left(x \cdot \mathsf{fma}\left(y, z, -a \cdot t\right) + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + \left(j \cdot \left(c \cdot a - y \cdot i\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)\right)\]

Reproduce

herbie shell --seed 2020039 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
  :precision binary64

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 3.2113527362226803e-147) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))