Average Error: 11.1 → 11.1
Time: 1.1m
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a2 \le -1.4885660885833155 \cdot 10^{+267}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le -1.80664542272768 \cdot 10^{+86}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{if}\;a2 \le 1.1813823376050212 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{if}\;a2 \le 1.326772075669285 \cdot 10^{+158}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le 4.58511155200543 \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.1 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 5 regimes
if a2 < -1.4885660885833155e+267 or 1.1813823376050212e-107 < a2 < 1.326772075669285e+158
Initial program 10.1
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac9.6
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -1.4885660885833155e+267 < a2 < -1.80664542272768e+86
Initial program 14.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv14.2
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
if -1.80664542272768e+86 < a2 < 1.1813823376050212e-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.326772075669285e+158 < a2 < 4.58511155200543e+262
Initial program 18.1
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*17.4
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if 4.58511155200543e+262 < a2
Initial program 19.8
\[\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.2
\[\leadsto \frac{1}{\color{blue}{\frac{b2}{a1 \cdot a2} \cdot b1}}\]
Applied associate-/r*23.1
\[\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)))