Average Error: 11.5 → 8.2
Time: 19.0s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 = -\infty:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;b1 \cdot b2 \le -1.2671471622282456 \cdot 10^{-174}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;b1 \cdot b2 \le 4.365816539968595 \cdot 10^{-199}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;b1 \cdot b2 \le 3.3016234208263416 \cdot 10^{+193}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}\]
Target
| Original | 11.5 |
|---|
| Target | 10.6 |
|---|
| Herbie | 8.2 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if (* b1 b2) or 3.3016234208263416e+193 < (* b1 b2)
Initial program 18.1
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac4.0
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if (* b1 b2) < -1.2671471622282456e-174 or 4.365816539968595e-199 < (* b1 b2) < 3.3016234208263416e+193
Initial program 4.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*4.6
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if -1.2671471622282456e-174 < (* b1 b2) < 4.365816539968595e-199
Initial program 30.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))