Average Error: 10.9 → 10.5
Time: 6.7s
Precision: 64
Internal precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;a2 \le -1.3325061181107773 \cdot 10^{+217}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;a2 \le -4.969955314137239 \cdot 10^{-254}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;a2 \le 1.5686396626431321 \cdot 10^{-35}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;a2 \le 1.975073998090622 \cdot 10^{+166}:\\
\;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}\]
Target
| Original | 10.9 |
| Comparison | 10.8 |
| Herbie | 10.5 |
\[ \frac{a1}{b1} \cdot \frac{a2}{b2} \]
Derivation
- Split input into 4 regimes.
-
if a2 < -1.3325061181107773e+217 or -4.969955314137239e-254 < a2 < 1.5686396626431321e-35
Initial program 11.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm
Applied times-frac 10.5
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm
Applied div-inv 10.6
\[\leadsto \color{blue}{\left(a1 \cdot \frac{1}{b1}\right)} \cdot \frac{a2}{b2}\]
Applied associate-*l* 10.8
\[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b1} \cdot \frac{a2}{b2}\right)}\]
Applied simplify 11.0
\[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b1}}{b2}}\]
if -1.3325061181107773e+217 < a2 < -4.969955314137239e-254
Initial program 9.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
if 1.5686396626431321e-35 < a2 < 1.975073998090622e+166
Initial program 10.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm
Applied times-frac 9.0
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm
Applied associate-*r/ 8.2
\[\leadsto \color{blue}{\frac{\frac{a1}{b1} \cdot a2}{b2}}\]
if 1.975073998090622e+166 < a2
Initial program 18.8
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm
Applied times-frac 17.3
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Recombined 4 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))