- Split input into 2 regimes
if (if (>= b 0) (/ (* 2 c) (- (- b) (* (* (cbrt (sqrt (fma (* 4 a) (- c) (* b b)))) (cbrt (sqrt (fma (* 4 a) (- c) (* b b))))) (cbrt (sqrt (fma (* 4 a) (- c) (* b b))))))) (/ (- (sqrt (fma (* 4 a) (- c) (* b b))) b) (* a 2))) < -2.9857892093808253e-202 or 5.5827589937171e-318 < (if (>= b 0) (/ (* 2 c) (- (- b) (* (* (cbrt (sqrt (fma (* 4 a) (- c) (* b b)))) (cbrt (sqrt (fma (* 4 a) (- c) (* b b))))) (cbrt (sqrt (fma (* 4 a) (- c) (* b b))))))) (/ (- (sqrt (fma (* 4 a) (- c) (* b b))) b) (* a 2)))
Initial program 14.5
\[\begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}\]
Initial simplification14.5
\[\leadsto \begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\]
- Using strategy
rm Applied add-sqr-sqrt14.5
\[\leadsto \begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\color{blue}{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\]
Applied sqrt-prod14.6
\[\leadsto \begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\sqrt{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\]
if -2.9857892093808253e-202 < (if (>= b 0) (/ (* 2 c) (- (- b) (* (* (cbrt (sqrt (fma (* 4 a) (- c) (* b b)))) (cbrt (sqrt (fma (* 4 a) (- c) (* b b))))) (cbrt (sqrt (fma (* 4 a) (- c) (* b b))))))) (/ (- (sqrt (fma (* 4 a) (- c) (* b b))) b) (* a 2))) < 5.5827589937171e-318
Initial program 34.6
\[\begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}\]
Initial simplification34.6
\[\leadsto \begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\]
Taylor expanded around 0 10.3
\[\leadsto \begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\]
- Using strategy
rm Applied add-log-exp11.6
\[\leadsto \begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}}\right)\\
\end{array}\]
- Recombined 2 regimes into one program.
Final simplification13.8
\[\leadsto \begin{array}{l}
\mathbf{if}\;\begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt[3]{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \left(\sqrt[3]{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt[3]{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array} \le -2.9857892093808253 \cdot 10^{-202}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;\begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt[3]{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \left(\sqrt[3]{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt[3]{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array} \le 5.5827589937171 \cdot 10^{-318}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}}\right)\\
\end{array}\\
\mathbf{elif}\;b \ge 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\
\end{array}\]