Average Error: 11.0 → 2.6
Time: 36.0s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} = -\infty:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} \le -9.6332906908877 \cdot 10^{-314}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} \le 3.6275582312081 \cdot 10^{-316}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} \le 1.7474528032472565 \cdot 10^{+248}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}\]
Target
| Original | 11.0 |
|---|
| Target | 10.7 |
|---|
| Herbie | 2.6 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if (* (* a1 a2) (/ 1 (* b1 b2))) < -inf.0
Initial program 57.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac9.3
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Using strategy
rm Applied div-inv9.4
\[\leadsto \color{blue}{\left(a1 \cdot \frac{1}{b1}\right)} \cdot \frac{a2}{b2}\]
Applied associate-*l*17.1
\[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b1} \cdot \frac{a2}{b2}\right)}\]
Applied simplify17.0
\[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b1}}{b2}}\]
if -inf.0 < (* (* a1 a2) (/ 1 (* b1 b2))) < -9.6332906908877e-314 or 3.6275582312081e-316 < (* (* a1 a2) (/ 1 (* b1 b2))) < 1.7474528032472565e+248
Initial program 0.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv0.6
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
if -9.6332906908877e-314 < (* (* a1 a2) (/ 1 (* b1 b2))) < 3.6275582312081e-316 or 1.7474528032472565e+248 < (* (* a1 a2) (/ 1 (* b1 b2)))
Initial program 20.8
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac3.9
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed '#(1071852389 864846987 1238109217 3425890003 4124793586 650694553)'
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))