Average Error: 11.4 → 11.3
Time: 48.4s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a2 \le -2.3202426462417963 \cdot 10^{+179}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;a2 \le -6.640614917846202 \cdot 10^{+93}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\mathbf{if}\;a2 \le -2.6747100950332953 \cdot 10^{+35}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{if}\;a2 \le -2.472259593292502 \cdot 10^{-252}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\mathbf{if}\;a2 \le 2.0078718873968006 \cdot 10^{-187}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;a2 \le 2.1232744344167772 \cdot 10^{-104}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;a2 \le 2.6359795409171187 \cdot 10^{+186}:\\
\;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\
\end{array}\]
Target
| Original | 11.4 |
|---|
| Target | 11.1 |
|---|
| Herbie | 11.3 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 4 regimes
if a2 < -2.3202426462417963e+179 or -2.472259593292502e-252 < a2 < 2.0078718873968006e-187
Initial program 13.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*13.6
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
if -2.3202426462417963e+179 < a2 < -6.640614917846202e+93 or -2.6747100950332953e+35 < a2 < -2.472259593292502e-252 or 2.6359795409171187e+186 < a2
Initial program 11.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac11.4
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied associate-*l/11.4
\[\leadsto \color{blue}{\frac{a1 \cdot \frac{a2}{b2}}{b1}}\]
if -6.640614917846202e+93 < a2 < -2.6747100950332953e+35 or 2.1232744344167772e-104 < a2 < 2.6359795409171187e+186
Initial program 9.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*9.9
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Using strategy
rm Applied associate-/l*9.9
\[\leadsto \frac{\color{blue}{\frac{a1}{\frac{b1}{a2}}}}{b2}\]
if 2.0078718873968006e-187 < a2 < 2.1232744344167772e-104
Initial program 9.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*9.3
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
- Recombined 4 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))