Average Error: 10.9 → 3.2
Time: 22.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} = -\infty:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le -8.076390584628404 \cdot 10^{-276}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le -0.0:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le 2.733858414759234 \cdot 10^{+282}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\
\end{array}\]
Target
| Original | 10.9 |
|---|
| Target | 10.6 |
|---|
| Herbie | 3.2 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 4 regimes
if (/ a1 (/ (* b1 b2) a2)) < -inf.0
Initial program 38.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac13.4
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -inf.0 < (/ a1 (/ (* b1 b2) a2)) < -8.076390584628404e-276 or -0.0 < (/ a1 (/ (* b1 b2) a2)) < 2.733858414759234e+282
Initial program 7.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*0.9
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if -8.076390584628404e-276 < (/ a1 (/ (* b1 b2) a2)) < -0.0
Initial program 10.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac4.2
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied associate-*l/4.5
\[\leadsto \color{blue}{\frac{a1 \cdot \frac{a2}{b2}}{b1}}\]
if 2.733858414759234e+282 < (/ a1 (/ (* b1 b2) a2))
Initial program 32.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac18.0
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied div-inv18.0
\[\leadsto \frac{a1}{b1} \cdot \color{blue}{\left(a2 \cdot \frac{1}{b2}\right)}\]
Applied associate-*r*12.0
\[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}}\]
- Recombined 4 regimes into one program.
Runtime
herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))