Average Error: 11.0 → 2.8
Time: 28.5s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{a1}{b1} \cdot a2 \le -4.400783426764326 \cdot 10^{+202}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;\frac{a1}{b1} \cdot a2 \le -3.630518211079796 \cdot 10^{-288}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{if}\;\frac{a1}{b1} \cdot a2 \le 4.758519206875224 \cdot 10^{-309}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;\frac{a1}{b1} \cdot a2 \le 8.44930068305971 \cdot 10^{+182}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\end{array}\]
Target
| Original | 11.0 |
|---|
| Target | 10.8 |
|---|
| Herbie | 2.8 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 2 regimes
if (* (/ a1 b1) a2) < -4.400783426764326e+202 or -3.630518211079796e-288 < (* (/ a1 b1) a2) < 4.758519206875224e-309 or 8.44930068305971e+182 < (* (/ a1 b1) a2)
Initial program 9.8
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*5.8
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if -4.400783426764326e+202 < (* (/ a1 b1) a2) < -3.630518211079796e-288 or 4.758519206875224e-309 < (* (/ a1 b1) a2) < 8.44930068305971e+182
Initial program 11.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac7.1
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied associate-*r/0.5
\[\leadsto \color{blue}{\frac{\frac{a1}{b1} \cdot a2}{b2}}\]
- Recombined 2 regimes into one program.
Runtime
herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))