Average Error: 11.1 → 2.1
Time: 36.0s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.7782620897866231 \cdot 10^{+308}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.889169551734579 \cdot 10^{-299}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 8.260540744229808 \cdot 10^{-278}:\\
\;\;\;\;\log_* (1 + (e^{\frac{a1}{b2} \cdot \frac{a2}{b1}} - 1)^*)\\
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 3.556060957443843 \cdot 10^{+304}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}\]
Try it out
Enter valid numbers for all inputs
Target
| Original | 11.1 |
|---|
| Target | 11.1 |
|---|
| Herbie | 2.1 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 3 regimes
if (/ (* a1 a2) (* b1 b2)) < -1.7782620897866231e+308 or 3.556060957443843e+304 < (/ (* a1 a2) (* b1 b2))
Initial program 60.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac6.2
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -1.7782620897866231e+308 < (/ (* a1 a2) (* b1 b2)) < -1.889169551734579e-299 or 8.260540744229808e-278 < (/ (* a1 a2) (* b1 b2)) < 3.556060957443843e+304
Initial program 0.8
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
if -1.889169551734579e-299 < (/ (* a1 a2) (* b1 b2)) < 8.260540744229808e-278
Initial program 13.2
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied div-inv13.2
\[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
- Using strategy
rm Applied log1p-expm1-u13.2
\[\leadsto \color{blue}{\log_* (1 + (e^{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}} - 1)^*)}\]
Applied simplify3.1
\[\leadsto \log_* (1 + \color{blue}{(e^{\frac{a1}{b2} \cdot \frac{a2}{b1}} - 1)^*})\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed 2018201 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))