\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)
\begin{array}{l}
\mathbf{if}\;x \le 1.6227582129164173 \cdot 10^{-284}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{1}{\frac{1}{j \cdot \left(c \cdot a - i \cdot y\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)}}\\
\mathbf{elif}\;x \le 5.64284305689208109 \cdot 10^{-266}:\\
\;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{j}{\frac{1}{\mathsf{fma}\left(a, c, -y \cdot i\right)}}\\
\end{array}double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return (((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i))));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double VAR;
if ((x <= 1.6227582129164173e-284)) {
VAR = (((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (1.0 / (1.0 / ((j * ((c * a) - (i * y))) + (j * fma(-i, y, (i * y)))))));
} else {
double VAR_1;
if ((x <= 5.642843056892081e-266)) {
VAR_1 = fma(t, (i * b), -fma(z, (b * c), (t * (x * a))));
} else {
VAR_1 = (((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j / (1.0 / fma(a, c, -(y * i)))));
}
VAR = VAR_1;
}
return VAR;
}




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
Results
| Original | 12.0 |
|---|---|
| Target | 19.6 |
| Herbie | 12.4 |
if x < 1.6227582129164173e-284Initial program 12.6
rmApplied flip--25.3
Applied associate-*r/27.8
Simplified23.0
rmApplied clear-num23.0
Simplified12.6
rmApplied prod-diff12.6
Applied distribute-lft-in12.6
Simplified12.6
Simplified12.6
if 1.6227582129164173e-284 < x < 5.642843056892081e-266Initial program 14.5
Simplified14.5
Taylor expanded around inf 32.1
Simplified32.1
if 5.642843056892081e-266 < x Initial program 11.2
rmApplied flip--23.5
Applied associate-*r/25.8
Simplified21.0
rmApplied associate-*l*25.8
Applied associate-/l*23.5
Simplified11.2
Final simplification12.4
herbie shell --seed 2020071 +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)))))