Average Error: 10.8 → 11.4
Time: 34.5s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;b2 \le -3.7336115954943806 \cdot 10^{-256}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;b2 \le 3.5692492730548654 \cdot 10^{-81}:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\
\mathbf{if}\;b2 \le 5.3390353255440594 \cdot 10^{-05}:\\
\;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\
\mathbf{if}\;b2 \le 7.531030339659655 \cdot 10^{+251}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\
\end{array}\]
Target
| Original | 10.8 |
|---|
| Target | 11.7 |
|---|
| Herbie | 11.4 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 4 regimes
if b2 < -3.7336115954943806e-256
Initial program 10.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac11.0
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied div-inv11.0
\[\leadsto \color{blue}{\left(a1 \cdot \frac{1}{b1}\right)} \cdot \frac{a2}{b2}\]
Applied associate-*l*11.1
\[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b1} \cdot \frac{a2}{b2}\right)}\]
Applied simplify11.3
\[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b1}}{b2}}\]
if -3.7336115954943806e-256 < b2 < 3.5692492730548654e-81
Initial program 14.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac18.4
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied div-inv18.5
\[\leadsto \frac{a1}{b1} \cdot \color{blue}{\left(a2 \cdot \frac{1}{b2}\right)}\]
Applied associate-*r*15.7
\[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}}\]
if 3.5692492730548654e-81 < b2 < 5.3390353255440594e-05 or 7.531030339659655e+251 < b2
Initial program 10.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied clear-num10.4
\[\leadsto \color{blue}{\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}}\]
if 5.3390353255440594e-05 < b2 < 7.531030339659655e+251
Initial program 9.6
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac8.6
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Recombined 4 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1063313015 2771194459 1594909340 1344785158 2223560818 546365448)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))