\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
↓
\[\begin{array}{l}
t_1 := \left(z \cdot \left(y \cdot x\right) + b \cdot \left(i \cdot a - z \cdot c\right)\right) + c \cdot \left(j \cdot t\right)\\
t_2 := j \cdot \left(c \cdot t - y \cdot i\right)\\
t_3 := t_2 + x \cdot \left(z \cdot y - t \cdot a\right)\\
t_4 := t_2 + z \cdot \left(y \cdot x - b \cdot c\right)\\
\mathbf{if}\;j \leq -1 \cdot 10^{+116}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;j \leq -4.300360684225763 \cdot 10^{-47}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;j \leq -3.1796392933928895 \cdot 10^{-233}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;j \leq -1.6509819308273495 \cdot 10^{-267}:\\
\;\;\;\;y \cdot \left(z \cdot x\right) + a \cdot \left(b \cdot i - x \cdot t\right)\\
\mathbf{elif}\;j \leq 7.045895822020045 \cdot 10^{-178}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;j \leq 5.083169807228723 \cdot 10^{-115}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;j \leq 4.024269224684568 \cdot 10^{-44}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\]
(FPCore (x y z t a b c i j)
:precision binary64
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y)))))
↓
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (+ (+ (* z (* y x)) (* b (- (* i a) (* z c)))) (* c (* j t))))
(t_2 (* j (- (* c t) (* y i))))
(t_3 (+ t_2 (* x (- (* z y) (* t a)))))
(t_4 (+ t_2 (* z (- (* y x) (* b c))))))
(if (<= j -1e+116)
t_4
(if (<= j -4.300360684225763e-47)
t_3
(if (<= j -3.1796392933928895e-233)
t_1
(if (<= j -1.6509819308273495e-267)
(+ (* y (* z x)) (* a (- (* b i) (* x t))))
(if (<= j 7.045895822020045e-178)
t_1
(if (<= j 5.083169807228723e-115)
t_3
(if (<= j 4.024269224684568e-44) t_1 t_4)))))))))
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
↓
\begin{array}{l}
t_1 := \left(z \cdot \left(y \cdot x\right) + b \cdot \left(i \cdot a - z \cdot c\right)\right) + c \cdot \left(j \cdot t\right)\\
t_2 := j \cdot \left(c \cdot t - y \cdot i\right)\\
t_3 := t_2 + x \cdot \left(z \cdot y - t \cdot a\right)\\
t_4 := t_2 + z \cdot \left(y \cdot x - b \cdot c\right)\\
\mathbf{if}\;j \leq -1 \cdot 10^{+116}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;j \leq -4.300360684225763 \cdot 10^{-47}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;j \leq -3.1796392933928895 \cdot 10^{-233}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;j \leq -1.6509819308273495 \cdot 10^{-267}:\\
\;\;\;\;y \cdot \left(z \cdot x\right) + a \cdot \left(b \cdot i - x \cdot t\right)\\
\mathbf{elif}\;j \leq 7.045895822020045 \cdot 10^{-178}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;j \leq 5.083169807228723 \cdot 10^{-115}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;j \leq 4.024269224684568 \cdot 10^{-44}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
Error
Try it out
Results
Enter valid numbers for all inputs
Target
Original
12.1
Target
16.3
Herbie
23.1
\[\begin{array}{l}
\mathbf{if}\;t < -8.120978919195912 \cdot 10^{-33}:\\
\;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\mathbf{elif}\;t < -4.712553818218485 \cdot 10^{-169}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\
\mathbf{elif}\;t < -7.633533346031584 \cdot 10^{-308}:\\
\;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\mathbf{elif}\;t < 1.0535888557455487 \cdot 10^{-139}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\
\end{array}
\]
Derivation
Split input into 4 regimes
if j < -1.00000000000000002e116 or 4.02426922468456824e-44 < j
Initial program 7.4
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Taylor expanded in y around inf 13.8
\[\leadsto \left(\color{blue}{y \cdot \left(z \cdot x\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified13.2
\[\leadsto \left(\color{blue}{z \cdot \left(y \cdot x\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Taylor expanded in z around inf 18.3
\[\leadsto \color{blue}{\left(y \cdot x - c \cdot b\right) \cdot z} + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified18.3
\[\leadsto \color{blue}{z \cdot \left(y \cdot x - b \cdot c\right)} + j \cdot \left(c \cdot t - i \cdot y\right)
\]
if -1.00000000000000002e116 < j < -4.30036068422576296e-47 or 7.0458958220200452e-178 < j < 5.0831698072287231e-115
Initial program 11.2
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified11.1
\[\leadsto \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \mathsf{fma}\left(z, -c, a \cdot i\right), j \cdot \mathsf{fma}\left(i, -y, t \cdot c\right)\right)\right)}
\]
Taylor expanded in b around 0 26.9
\[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot i\right) + c \cdot t\right) \cdot j + \left(y \cdot z - a \cdot t\right) \cdot x}
\]
if -4.30036068422576296e-47 < j < -3.1796392933928895e-233 or -1.65098193082734954e-267 < j < 7.0458958220200452e-178 or 5.0831698072287231e-115 < j < 4.02426922468456824e-44
Initial program 15.4
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Taylor expanded in y around inf 24.9
\[\leadsto \left(\color{blue}{y \cdot \left(z \cdot x\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified25.1
\[\leadsto \left(\color{blue}{z \cdot \left(y \cdot x\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Taylor expanded in c around inf 24.7
\[\leadsto \left(z \cdot \left(y \cdot x\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \color{blue}{c \cdot \left(t \cdot j\right)}
\]
if -3.1796392933928895e-233 < j < -1.65098193082734954e-267
Initial program 23.0
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified23.0
\[\leadsto \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \mathsf{fma}\left(z, -c, a \cdot i\right), j \cdot \mathsf{fma}\left(i, -y, t \cdot c\right)\right)\right)}
\]
Taylor expanded in j around 0 23.0
\[\leadsto \color{blue}{\left(y \cdot z - a \cdot t\right) \cdot x + b \cdot \left(i \cdot a + -1 \cdot \left(c \cdot z\right)\right)}
\]
Taylor expanded in i around inf 31.2
\[\leadsto \left(y \cdot z - a \cdot t\right) \cdot x + \color{blue}{a \cdot \left(i \cdot b\right)}
\]
Taylor expanded in a around 0 28.2
\[\leadsto \color{blue}{a \cdot \left(i \cdot b + -1 \cdot \left(t \cdot x\right)\right) + y \cdot \left(z \cdot x\right)}
\]
Recombined 4 regimes into one program.
Final simplification23.1
\[\leadsto \begin{array}{l}
\mathbf{if}\;j \leq -1 \cdot 10^{+116}:\\
\;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + z \cdot \left(y \cdot x - b \cdot c\right)\\
\mathbf{elif}\;j \leq -4.300360684225763 \cdot 10^{-47}:\\
\;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + x \cdot \left(z \cdot y - t \cdot a\right)\\
\mathbf{elif}\;j \leq -3.1796392933928895 \cdot 10^{-233}:\\
\;\;\;\;\left(z \cdot \left(y \cdot x\right) + b \cdot \left(i \cdot a - z \cdot c\right)\right) + c \cdot \left(j \cdot t\right)\\
\mathbf{elif}\;j \leq -1.6509819308273495 \cdot 10^{-267}:\\
\;\;\;\;y \cdot \left(z \cdot x\right) + a \cdot \left(b \cdot i - x \cdot t\right)\\
\mathbf{elif}\;j \leq 7.045895822020045 \cdot 10^{-178}:\\
\;\;\;\;\left(z \cdot \left(y \cdot x\right) + b \cdot \left(i \cdot a - z \cdot c\right)\right) + c \cdot \left(j \cdot t\right)\\
\mathbf{elif}\;j \leq 5.083169807228723 \cdot 10^{-115}:\\
\;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + x \cdot \left(z \cdot y - t \cdot a\right)\\
\mathbf{elif}\;j \leq 4.024269224684568 \cdot 10^{-44}:\\
\;\;\;\;\left(z \cdot \left(y \cdot x\right) + b \cdot \left(i \cdot a - z \cdot c\right)\right) + c \cdot \left(j \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;j \cdot \left(c \cdot t - y \cdot i\right) + z \cdot \left(y \cdot x - b \cdot c\right)\\
\end{array}
\]
herbie shell --seed 2022228
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -8.120978919195912e-33) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -4.712553818218485e-169) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (if (< t -7.633533346031584e-308) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 1.0535888557455487e-139) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))