Average Error: 11.2 → 10.7
Time: 43.7s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a2 \le -1.6528172447439423 \cdot 10^{+267}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le -4.79432672961767 \cdot 10^{+85}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{if}\;a2 \le 2.1718258939700428 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{if}\;a2 \le 4.287825788642366 \cdot 10^{+156}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le 2.6190697471215337 \cdot 10^{+206}:\\
\;\;\;\;\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\end{array}\]
Target
| Original | 11.2 |
|---|
| Target | 10.7 |
|---|
| Herbie | 10.7 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 5 regimes
if a2 < -1.6528172447439423e+267 or 2.1718258939700428e-107 < a2 < 4.287825788642366e+156
Initial program 10.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac8.8
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -1.6528172447439423e+267 < a2 < -4.79432672961767e+85
Initial program 14.2
\[\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 -4.79432672961767e+85 < a2 < 2.1718258939700428e-107
Initial program 9.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*9.3
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied associate-/l*9.7
\[\leadsto \frac{\color{blue}{\frac{a1}{\frac{b1}{a2}}}}{b2}\]
if 4.287825788642366e+156 < a2 < 2.6190697471215337e+206
Initial program 17.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*13.5
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied clear-num13.9
\[\leadsto \color{blue}{\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}}\]
if 2.6190697471215337e+206 < 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 associate-/l*18.6
\[\leadsto \frac{\color{blue}{\frac{a1}{\frac{b1}{a2}}}}{b2}\]
- 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)))