Average Error: 10.5 → 3.0
Time: 43.8s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\left(\sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}} \cdot \sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}}\right) \cdot \sqrt[3]{\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)} \le -1.0704377314425847 \cdot 10^{+304}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;\left(\sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}} \cdot \sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}}\right) \cdot \sqrt[3]{\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)} \le -6.1980387051091 \cdot 10^{-318}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;\left(\sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}} \cdot \sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}}\right) \cdot \sqrt[3]{\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)} \le 2.5475085141972532 \cdot 10^{-297}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\
\mathbf{if}\;\left(\sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}} \cdot \sqrt[3]{\frac{a1}{b1} \cdot \frac{a2}{b2}}\right) \cdot \sqrt[3]{\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)} \le 4.0521763659347775 \cdot 10^{+294}:\\
\;\;\;\;\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 (* (* (cbrt (* (/ a1 b1) (/ a2 b2))) (cbrt (* (/ a1 b1) (/ a2 b2)))) (cbrt (* (* (cbrt (/ a1 b1)) (cbrt (/ a1 b1))) (* (cbrt (/ a1 b1)) (/ a2 b2))))) < -1.0704377314425847e+304
Initial program 9.9
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
if -1.0704377314425847e+304 < (* (* (cbrt (* (/ a1 b1) (/ a2 b2))) (cbrt (* (/ a1 b1) (/ a2 b2)))) (cbrt (* (* (cbrt (/ a1 b1)) (cbrt (/ a1 b1))) (* (cbrt (/ a1 b1)) (/ a2 b2))))) < -6.1980387051091e-318 or 2.5475085141972532e-297 < (* (* (cbrt (* (/ a1 b1) (/ a2 b2))) (cbrt (* (/ a1 b1) (/ a2 b2)))) (cbrt (* (* (cbrt (/ a1 b1)) (cbrt (/ a1 b1))) (* (cbrt (/ a1 b1)) (/ a2 b2))))) < 4.0521763659347775e+294
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 < (* (* (cbrt (* (/ a1 b1) (/ a2 b2))) (cbrt (* (/ a1 b1) (/ a2 b2)))) (cbrt (* (* (cbrt (/ a1 b1)) (cbrt (/ a1 b1))) (* (cbrt (/ a1 b1)) (/ a2 b2))))) < 2.5475085141972532e-297
Initial program 2.4
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/l*3.8
\[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
if 4.0521763659347775e+294 < (* (* (cbrt (* (/ a1 b1) (/ a2 b2))) (cbrt (* (/ a1 b1) (/ a2 b2)))) (cbrt (* (* (cbrt (/ a1 b1)) (cbrt (/ a1 b1))) (* (cbrt (/ a1 b1)) (/ a2 b2)))))
Initial program 6.0
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
- Using strategy
rm Applied associate-/r*14.0
\[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
- Recombined 4 regimes into one program.
Runtime
herbie shell --seed 2018296
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))