Average Error: 11.0 → 2.2
Time: 36.1s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le -2.6089023308796636 \cdot 10^{+306}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le -1.2180714020774775 \cdot 10^{-304}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le 8.746547490695171 \cdot 10^{-299}:\\
\;\;\;\;\frac{\left(a1 \cdot a2\right) \cdot \frac{1}{b2}}{b1}\\
\mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le 3.4733057543004296 \cdot 10^{+301}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(a1 \cdot a2\right) \cdot \frac{1}{b2}}{b1}\\
\end{array}\]
Try it out
Enter valid numbers for all inputs
Target
| Original | 11.0 |
|---|
| Target | 11.1 |
|---|
| Herbie | 2.2 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if (/ (/ a2 b1) b2) < -2.6089023308796636e+306
Initial program 13.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*15.8
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
if -2.6089023308796636e+306 < (/ (/ a2 b1) b2) < -1.2180714020774775e-304 or 8.746547490695171e-299 < (/ (/ a2 b1) b2) < 3.4733057543004296e+301
Initial program 12.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac12.7
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied div-inv12.8
\[\leadsto \color{blue}{\left(a1 \cdot \frac{1}{b1}\right)} \cdot \frac{a2}{b2}\]
Applied associate-*l*6.6
\[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b1} \cdot \frac{a2}{b2}\right)}\]
Applied simplify0.5
\[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b1}}{b2}}\]
if -1.2180714020774775e-304 < (/ (/ a2 b1) b2) < 8.746547490695171e-299 or 3.4733057543004296e+301 < (/ (/ a2 b1) b2)
Initial program 7.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac6.9
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied associate-*l/6.7
\[\leadsto \color{blue}{\frac{a1 \cdot \frac{a2}{b2}}{b1}}\]
- Using strategy
rm Applied div-inv6.7
\[\leadsto \frac{a1 \cdot \color{blue}{\left(a2 \cdot \frac{1}{b2}\right)}}{b1}\]
Applied associate-*r*3.6
\[\leadsto \frac{\color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b2}}}{b1}\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed 2018178
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))