Average Error: 10.5 → 3.0
Time: 45.2s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{\frac{a2}{b2}} \cdot \sqrt[3]{\frac{a2}{b2}}\right)\right) \cdot \sqrt[3]{\frac{a2}{b2}} \le -2.3363736251944115 \cdot 10^{+289}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{\frac{a2}{b2}} \cdot \sqrt[3]{\frac{a2}{b2}}\right)\right) \cdot \sqrt[3]{\frac{a2}{b2}} \le -6.1980387051091 \cdot 10^{-318}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{\frac{a2}{b2}} \cdot \sqrt[3]{\frac{a2}{b2}}\right)\right) \cdot \sqrt[3]{\frac{a2}{b2}} \le 4.0826872913750024 \cdot 10^{-308}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{\frac{a2}{b2}} \cdot \sqrt[3]{\frac{a2}{b2}}\right)\right) \cdot \sqrt[3]{\frac{a2}{b2}} \le 8.71237314266599 \cdot 10^{+300}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\
\end{array}\]
Try it out
Enter valid numbers for all inputs
Target
| Original | 10.5 |
|---|
| Target | 10.3 |
|---|
| Herbie | 3.0 |
|---|
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]
Derivation
- Split input into 4 regimes
if (* (* (/ a1 b1) (* (cbrt (/ a2 b2)) (cbrt (/ a2 b2)))) (cbrt (/ a2 b2))) < -2.3363736251944115e+289
Initial program 11.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
if -2.3363736251944115e+289 < (* (* (/ a1 b1) (* (cbrt (/ a2 b2)) (cbrt (/ a2 b2)))) (cbrt (/ a2 b2))) < -6.1980387051091e-318 or 4.0826872913750024e-308 < (* (* (/ a1 b1) (* (cbrt (/ a2 b2)) (cbrt (/ a2 b2)))) (cbrt (/ a2 b2))) < 8.71237314266599e+300
Initial program 15.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied times-frac0.9
\[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
if -6.1980387051091e-318 < (* (* (/ a1 b1) (* (cbrt (/ a2 b2)) (cbrt (/ a2 b2)))) (cbrt (/ a2 b2))) < 4.0826872913750024e-308
Initial program 2.1
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*3.5
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if 8.71237314266599e+300 < (* (* (/ a1 b1) (* (cbrt (/ a2 b2)) (cbrt (/ a2 b2)))) (cbrt (/ a2 b2)))
Initial program 5.5
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*13.9
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Recombined 4 regimes into one program.
Runtime
herbie shell --seed 2018296 +o rules:numerics
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))