Average Error: 11.7 → 9.4
Time: 3.0m
Precision: 64
Internal Precision: 384
\[\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}
\mathbf{if}\;x \le -3.1186130314637846 \cdot 10^{+124}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\sqrt[3]{c \cdot z - i \cdot a} \cdot \sqrt[3]{c \cdot z - i \cdot a}\right)\right) \cdot \sqrt[3]{c \cdot z - i \cdot a}\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\mathbf{if}\;x \le 4.863955640625947 \cdot 10^{+121}:\\
\;\;\;\;\left(\left(x \cdot z\right) \cdot y + \left(t \cdot x\right) \cdot \left(-a\right)\right) - \left(\left(c \cdot z - i \cdot a\right) \cdot b - j \cdot \left(c \cdot t - y \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\sqrt[3]{c \cdot z - i \cdot a} \cdot \sqrt[3]{c \cdot z - i \cdot a}\right)\right) \cdot \sqrt[3]{c \cdot z - i \cdot a}\right) + j \cdot \left(c \cdot t - i \cdot y\right)\\
\end{array}\]
Target
| Original | 11.7 |
|---|
| Target | 15.5 |
|---|
| Herbie | 9.4 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \lt -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{if}\;t \lt -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{if}\;t \lt -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{if}\;t \lt 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 2 regimes
if x < -3.1186130314637846e+124 or 4.863955640625947e+121 < x
Initial program 6.5
\[\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)\]
- Using strategy
rm Applied add-cube-cbrt6.7
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \color{blue}{\left(\left(\sqrt[3]{c \cdot z - i \cdot a} \cdot \sqrt[3]{c \cdot z - i \cdot a}\right) \cdot \sqrt[3]{c \cdot z - i \cdot a}\right)}\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
Applied associate-*r*6.7
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\left(b \cdot \left(\sqrt[3]{c \cdot z - i \cdot a} \cdot \sqrt[3]{c \cdot z - i \cdot a}\right)\right) \cdot \sqrt[3]{c \cdot z - i \cdot a}}\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
if -3.1186130314637846e+124 < x < 4.863955640625947e+121
Initial program 13.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)\]
- Using strategy
rm Applied sub-neg13.0
\[\leadsto \left(x \cdot \color{blue}{\left(y \cdot z + \left(-t \cdot a\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
Applied distribute-lft-in13.0
\[\leadsto \left(\color{blue}{\left(x \cdot \left(y \cdot z\right) + x \cdot \left(-t \cdot a\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
Taylor expanded around inf 11.7
\[\leadsto \left(\left(x \cdot \left(y \cdot z\right) + \color{blue}{-1 \cdot \left(a \cdot \left(t \cdot x\right)\right)}\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
Applied simplify10.1
\[\leadsto \color{blue}{\left(\left(x \cdot z\right) \cdot y + \left(t \cdot x\right) \cdot \left(-a\right)\right) - \left(\left(c \cdot z - i \cdot a\right) \cdot b - j \cdot \left(c \cdot t - y \cdot i\right)\right)}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
: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) (pow (* i y) 2))) (+ (* 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) (pow (* i y) 2))) (+ (* 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)))))