Average Error: 10.8 → 2.7
Time: 1.2m
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -1.3968466779217588 \cdot 10^{+288}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -4.265685843674341 \cdot 10^{-308}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 1.5586659615523882 \cdot 10^{-284}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 5.515640896192062 \cdot 10^{+297}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\end{array}\]
Try it out
Enter valid numbers for all inputs
Target
| Original | 10.8 |
|---|
| Target | 10.9 |
|---|
| Herbie | 2.7 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 4 regimes
if (* (/ a1 b1) (/ a2 b2)) < -1.3968466779217588e+288
Initial program 12.3
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*17.6
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if -1.3968466779217588e+288 < (* (/ a1 b1) (/ a2 b2)) < -4.265685843674341e-308 or 1.5586659615523882e-284 < (* (/ a1 b1) (/ a2 b2)) < 5.515640896192062e+297
Initial program 15.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac0.7
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -4.265685843674341e-308 < (* (/ a1 b1) (/ a2 b2)) < 1.5586659615523882e-284
Initial program 2.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*3.3
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
if 5.515640896192062e+297 < (* (/ a1 b1) (/ a2 b2))
Initial program 5.7
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Recombined 4 regimes into one program.
Runtime
herbie shell --seed '#(1072967564 1937075727 894099792 790700740 1036514779 1027793188)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))