Average Error: 10.9 → 11.0
Time: 30.1s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;a2 \le -3.0479637035265785 \cdot 10^{+207}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le -7.20153105055616 \cdot 10^{+66}:\\
\;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\
\mathbf{if}\;a2 \le -1.5416890105866388 \cdot 10^{-97}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;a2 \le -2.1538731346239785 \cdot 10^{-256}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;a2 \le 5.701154346137465 \cdot 10^{-243}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le 7.219968817692392 \cdot 10^{-103}:\\
\;\;\;\;\left(a1 \cdot \frac{1}{b1 \cdot b2}\right) \cdot a2\\
\mathbf{if}\;a2 \le 1.7037602706608895 \cdot 10^{+94}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;a2 \le 3.2705679617905636 \cdot 10^{+171}:\\
\;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\
\mathbf{if}\;a2 \le 9.309401273607693 \cdot 10^{+249}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\
\end{array}\]
Target
| Original | 10.9 |
|---|
| Target | 11.4 |
|---|
| Herbie | 11.0 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 6 regimes
if a2 < -3.0479637035265785e+207 or -2.1538731346239785e-256 < a2 < 5.701154346137465e-243
Initial program 14.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac14.4
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -3.0479637035265785e+207 < a2 < -7.20153105055616e+66 or 1.7037602706608895e+94 < a2 < 3.2705679617905636e+171 or 9.309401273607693e+249 < a2
Initial program 13.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*13.6
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
- Using strategy
rm Applied div-inv13.7
\[\leadsto \frac{a1}{\color{blue}{\left(b1 \cdot b2\right) \cdot \frac{1}{a2}}}\]
Applied associate-/r*12.9
\[\leadsto \color{blue}{\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}}\]
if -7.20153105055616e+66 < a2 < -1.5416890105866388e-97
Initial program 7.8
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*7.5
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
- Using strategy
rm Applied div-inv7.7
\[\leadsto \color{blue}{a1 \cdot \frac{1}{\frac{b1 \cdot b2}{a2}}}\]
Applied simplify8.1
\[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b1}}{b2}}\]
if -1.5416890105866388e-97 < a2 < -2.1538731346239785e-256
Initial program 9.6
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*9.4
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
if 5.701154346137465e-243 < a2 < 7.219968817692392e-103
Initial program 9.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*9.1
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
- Using strategy
rm Applied associate-/r/10.1
\[\leadsto \color{blue}{\frac{a1}{b1 \cdot b2} \cdot a2}\]
- Using strategy
rm Applied div-inv10.2
\[\leadsto \color{blue}{\left(a1 \cdot \frac{1}{b1 \cdot b2}\right)} \cdot a2\]
if 7.219968817692392e-103 < a2 < 1.7037602706608895e+94 or 3.2705679617905636e+171 < a2 < 9.309401273607693e+249
Initial program 9.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac10.0
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Recombined 6 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1063154770 1824007522 645063331 41291047 494775821 1237684644)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))