Average Error: 11.1 → 11.2
Time: 49.8s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a2 \le -1.3049912669920272 \cdot 10^{+267}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le -5.204804899648365 \cdot 10^{+85}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{if}\;a2 \le 1.9311573662551773 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{if}\;a2 \le 1.8210459333730642 \cdot 10^{+157}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le 5.2905133291937936 \cdot 10^{+262}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\
\end{array}\]
Target
| Original | 11.1 |
|---|
| Target | 10.8 |
|---|
| Herbie | 11.2 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 5 regimes
if a2 < -1.3049912669920272e+267 or 1.9311573662551773e-107 < a2 < 1.8210459333730642e+157
Initial program 9.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac9.5
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -1.3049912669920272e+267 < a2 < -5.204804899648365e+85
Initial program 14.1
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv14.3
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
if -5.204804899648365e+85 < a2 < 1.9311573662551773e-107
Initial program 9.6
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*9.2
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied associate-/l*9.8
\[\leadsto \frac{\color{blue}{\frac{a1}{\frac{b1}{a2}}}}{b2}\]
if 1.8210459333730642e+157 < a2 < 5.2905133291937936e+262
Initial program 18.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*17.6
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if 5.2905133291937936e+262 < a2
Initial program 20.1
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*21.9
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied clear-num22.2
\[\leadsto \color{blue}{\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}}\]
- Using strategy
rm Applied associate-/r/23.5
\[\leadsto \frac{1}{\color{blue}{\frac{b2}{a1 \cdot a2} \cdot b1}}\]
Applied associate-/r*23.4
\[\leadsto \color{blue}{\frac{\frac{1}{\frac{b2}{a1 \cdot a2}}}{b1}}\]
Applied simplify24.5
\[\leadsto \frac{\color{blue}{\frac{a2}{\frac{b2}{a1}}}}{b1}\]
- Recombined 5 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 (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))