Average Error: 11.1 → 2.5
Time: 33.9s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le -9.815105028843137 \cdot 10^{+227}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le -6.270049032267763 \cdot 10^{-270}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le 4.947781671806845 \cdot 10^{-296}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le 4.528110892709925 \cdot 10^{+306}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\mathbf{else}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\end{array}\]
Try it out
Enter valid numbers for all inputs
Target
| Original | 11.1 |
|---|
| Target | 11.1 |
|---|
| Herbie | 2.5 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if (/ (/ a2 b2) b1) < -9.815105028843137e+227 or -6.270049032267763e-270 < (/ (/ a2 b2) b1) < 4.947781671806845e-296
Initial program 8.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*4.8
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
if -9.815105028843137e+227 < (/ (/ a2 b2) b1) < -6.270049032267763e-270 or 4.947781671806845e-296 < (/ (/ a2 b2) b1) < 4.528110892709925e+306
Initial program 12.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv12.8
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
- Using strategy
rm Applied associate-*l*6.7
\[\leadsto \color{blue}{a1 \cdot \left(a2 \cdot \frac{1}{b1 \cdot b2}\right)}\]
Applied simplify0.5
\[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b2}}{b1}}\]
if 4.528110892709925e+306 < (/ (/ a2 b2) b1)
Initial program 11.8
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv12.3
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed 2018201
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))