Average Error: 11.2 → 2.5
Time: 42.1s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} = -\infty:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -6.1104555447917 \cdot 10^{-315}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 1.2496181882040065 \cdot 10^{-305}:\\
\;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 5.4538264489329024 \cdot 10^{+302}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\
\end{array}\]
Target
| Original | 11.2 |
|---|
| Target | 11.3 |
|---|
| Herbie | 2.5 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if (* (/ a1 b1) (/ a2 b2)) < -inf.0
Initial program 8.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*15.1
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied associate-/l*14.3
\[\leadsto \frac{\color{blue}{\frac{a1}{\frac{b1}{a2}}}}{b2}\]
if -inf.0 < (* (/ a1 b1) (/ a2 b2)) < -6.1104555447917e-315 or 1.2496181882040065e-305 < (* (/ a1 b1) (/ a2 b2)) < 5.4538264489329024e+302
Initial program 16.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac0.8
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -6.1104555447917e-315 < (* (/ a1 b1) (/ a2 b2)) < 1.2496181882040065e-305 or 5.4538264489329024e+302 < (* (/ a1 b1) (/ a2 b2))
Initial program 3.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied clear-num3.7
\[\leadsto \color{blue}{\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}}\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))