Average Error: 11.2 → 11.0
Time: 36.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a1 \le -5.9072306555862726 \cdot 10^{+113}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{if}\;a1 \le -1.082614028386092 \cdot 10^{-152}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a1 \le 5.994603634720681 \cdot 10^{-289}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{if}\;a1 \le 2.683450364693028 \cdot 10^{+72}:\\
\;\;\;\;\frac{1}{b2 \cdot \frac{\frac{b1}{a1}}{a2}}\\
\mathbf{if}\;a1 \le 1.581041614064881 \cdot 10^{+201}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{else}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\end{array}\]
Target
| Original | 11.2 |
|---|
| Target | 10.7 |
|---|
| Herbie | 11.0 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 4 regimes
if a1 < -5.9072306555862726e+113 or 1.581041614064881e+201 < a1
Initial program 17.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv17.8
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
if -5.9072306555862726e+113 < a1 < -1.082614028386092e-152
Initial program 7.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac8.0
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -1.082614028386092e-152 < a1 < 5.994603634720681e-289 or 2.683450364693028e+72 < a1 < 1.581041614064881e+201
Initial program 11.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*11.5
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied associate-/l*11.4
\[\leadsto \frac{\color{blue}{\frac{a1}{\frac{b1}{a2}}}}{b2}\]
if 5.994603634720681e-289 < a1 < 2.683450364693028e+72
Initial program 9.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*8.8
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied clear-num9.1
\[\leadsto \color{blue}{\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}}\]
- Using strategy
rm Applied div-inv9.3
\[\leadsto \frac{1}{\color{blue}{b2 \cdot \frac{1}{\frac{a1 \cdot a2}{b1}}}}\]
Applied simplify8.8
\[\leadsto \frac{1}{b2 \cdot \color{blue}{\frac{\frac{b1}{a1}}{a2}}}\]
- Recombined 4 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))