Average Error: 12.5 → 10.3
Time: 1.2m
Precision: 64
Internal precision: 128
\[\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}\;a \le 2.3403364003398004 \cdot 10^{+122}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + {\left(\sqrt[3]{j \cdot \left(c \cdot t - i \cdot y\right)}\right)}^3\\
\mathbf{else}:\\
\;\;\;\;\left(j \cdot \left(t \cdot c - y \cdot i\right) - \left(b \cdot z\right) \cdot c\right) + \left(b \cdot i - x \cdot t\right) \cdot a\\
\end{array}\]
Target
| Original | 12.5 |
| Comparison | 16.2 |
| Herbie | 10.3 |
\[ \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 a < 2.3403364003398004e+122
Initial program 10.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)\]
- Using strategy
rm
Applied add-cube-cbrt 10.7
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \color{blue}{{\left(\sqrt[3]{j \cdot \left(c \cdot t - i \cdot y\right)}\right)}^3}\]
if 2.3403364003398004e+122 < a
Initial program 29.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)\]
Applied taylor 23.1
\[\leadsto \left(i \cdot \left(b \cdot a\right) - \left(c \cdot \left(b \cdot z\right) + t \cdot \left(x \cdot a\right)\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
Taylor expanded around inf 23.1
\[\leadsto \color{blue}{\left(i \cdot \left(b \cdot a\right) - \left(c \cdot \left(b \cdot z\right) + t \cdot \left(x \cdot a\right)\right)\right)} + j \cdot \left(c \cdot t - i \cdot y\right)\]
Applied simplify 7.3
\[\leadsto \color{blue}{\left(j \cdot \left(t \cdot c - y \cdot i\right) - \left(b \cdot z\right) \cdot c\right) + \left(b \cdot i - x \cdot t\right) \cdot a}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1306143174 2644417500 4281817640 1256093871 2664406329 2513944914)'
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
: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 (- (sqr (* c t)) (sqr (* i y)))) (+ (* 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 (- (sqr (* c t)) (sqr (* i y)))) (+ (* 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)))))