Average Error: 10.5 → 10.7
Time: 35.0s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;b2 \le -8.50757008846661 \cdot 10^{-77}:\\
\;\;\;\;{\left(\frac{a1}{b2} \cdot \frac{a2}{b1}\right)}^{1}\\
\mathbf{if}\;b2 \le 3.235465207188241 \cdot 10^{-304}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;b2 \le 2.00345658715073 \cdot 10^{-263}:\\
\;\;\;\;{\left(\frac{a1}{b2} \cdot \frac{a2}{b1}\right)}^{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\end{array}\]
Target
| Original | 10.5 |
|---|
| Target | 11.3 |
|---|
| Herbie | 10.7 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if b2 < -8.50757008846661e-77 or 3.235465207188241e-304 < b2 < 2.00345658715073e-263
Initial program 10.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv10.1
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
- Using strategy
rm Applied pow110.1
\[\leadsto \left(a1 \cdot a2\right) \cdot \color{blue}{{\left(\frac{1}{b1 \cdot b2}\right)}^{1}}\]
Applied pow110.1
\[\leadsto \color{blue}{{\left(a1 \cdot a2\right)}^{1}} \cdot {\left(\frac{1}{b1 \cdot b2}\right)}^{1}\]
Applied pow-prod-down10.1
\[\leadsto \color{blue}{{\left(\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\right)}^{1}}\]
Applied simplify10.1
\[\leadsto {\color{blue}{\left(\frac{a1}{b2} \cdot \frac{a2}{b1}\right)}}^{1}\]
if -8.50757008846661e-77 < b2 < 3.235465207188241e-304
Initial program 13.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*14.1
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
if 2.00345658715073e-263 < b2
Initial program 10.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*10.1
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
- Recombined 3 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1063185673 2139736501 2393378123 1907444849 1070993796 1007244912)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))