Average Error: 7.2 → 6.6
Time: 55.2s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot y - z \cdot t}{a}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a \le 6.625574720452708 \cdot 10^{+86}:\\
\;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\\
\mathbf{if}\;a \le 2.7445378437622284 \cdot 10^{+195}:\\
\;\;\;\;\sqrt[3]{-1} \cdot \left(t \cdot \frac{z}{a} - x \cdot \frac{y}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\\
\end{array}\]
Target
| Original | 7.2 |
|---|
| Target | 5.8 |
|---|
| Herbie | 6.6 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \lt -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z \lt 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\end{array}\]
Derivation
- Split input into 2 regimes
if a < 6.625574720452708e+86 or 2.7445378437622284e+195 < a
Initial program 6.7
\[\frac{x \cdot y - z \cdot t}{a}\]
- Using strategy
rm Applied div-inv6.8
\[\leadsto \color{blue}{\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}}\]
if 6.625574720452708e+86 < a < 2.7445378437622284e+195
Initial program 11.2
\[\frac{x \cdot y - z \cdot t}{a}\]
- Using strategy
rm Applied add-cube-cbrt12.0
\[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x \cdot y - z \cdot t} \cdot \sqrt[3]{x \cdot y - z \cdot t}\right) \cdot \sqrt[3]{x \cdot y - z \cdot t}}}{a}\]
Applied associate-/l*12.0
\[\leadsto \color{blue}{\frac{\sqrt[3]{x \cdot y - z \cdot t} \cdot \sqrt[3]{x \cdot y - z \cdot t}}{\frac{a}{\sqrt[3]{x \cdot y - z \cdot t}}}}\]
Taylor expanded around 0 62.7
\[\leadsto \color{blue}{\frac{z \cdot t}{a} \cdot {-1}^{\frac{1}{3}} - \frac{y \cdot x}{a} \cdot {-1}^{\frac{1}{3}}}\]
Applied simplify4.8
\[\leadsto \color{blue}{\sqrt[3]{-1} \cdot \left(t \cdot \frac{z}{a} - x \cdot \frac{y}{a}\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
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:herbie-target
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))