\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}
t_1 := j \cdot \left(a \cdot c - y \cdot i\right)\\
t_2 := c \cdot \left(z \cdot b\right) - i \cdot \left(t \cdot b\right)\\
t_3 := x \cdot \left(y \cdot z - t \cdot a\right)\\
t_4 := \left(t_3 - b \cdot \left(z \cdot c - t \cdot i\right)\right) + t_1\\
\mathbf{if}\;t_4 \leq -4.234739746971676 \cdot 10^{+304}:\\
\;\;\;\;\left(t_3 - t_2\right) + \left(c \cdot \left(a \cdot j\right) - i \cdot \left(y \cdot j\right)\right)\\
\mathbf{elif}\;t_4 \leq 2.1205633201927566 \cdot 10^{+301}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\left(y \cdot \left(x \cdot z\right) - a \cdot \left(x \cdot t\right)\right) - t_2\right)\\
\end{array}
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* j (- (* a c) (* y i))))
(t_2 (- (* c (* z b)) (* i (* t b))))
(t_3 (* x (- (* y z) (* t a))))
(t_4 (+ (- t_3 (* b (- (* z c) (* t i)))) t_1)))
(if (<= t_4 -4.234739746971676e+304)
(+ (- t_3 t_2) (- (* c (* a j)) (* i (* y j))))
(if (<= t_4 2.1205633201927566e+301)
t_4
(+ t_1 (- (- (* y (* x z)) (* a (* x t))) t_2))))))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 t_1 = j * ((a * c) - (y * i));
double t_2 = (c * (z * b)) - (i * (t * b));
double t_3 = x * ((y * z) - (t * a));
double t_4 = (t_3 - (b * ((z * c) - (t * i)))) + t_1;
double tmp;
if (t_4 <= -4.234739746971676e+304) {
tmp = (t_3 - t_2) + ((c * (a * j)) - (i * (y * j)));
} else if (t_4 <= 2.1205633201927566e+301) {
tmp = t_4;
} else {
tmp = t_1 + (((y * (x * z)) - (a * (x * t))) - t_2);
}
return tmp;
}




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.2 |
|---|---|
| Target | 19.2 |
| Herbie | 6.0 |
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < -4.23473974697167595e304Initial program 60.9
Taylor expanded in c around 0 41.4
Taylor expanded in c around -inf 22.1
if -4.23473974697167595e304 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < 2.1205633201927566e301Initial program 0.9
Taylor expanded in j around 0 0.9
if 2.1205633201927566e301 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 58.0
Taylor expanded in c around 0 43.0
Applied sub-neg_binary6443.0
Applied distribute-rgt-in_binary6443.0
Simplified38.8
Simplified31.7
Final simplification6.0
herbie shell --seed 2022077
(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.0) (pow (* t i) 2.0))) (+ (* 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.0) (pow (* t i) 2.0))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))