Average Error: 44.1 → 42.3
Time: 40.8s
Precision: 64
Internal Precision: 2880
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \le -2.7615828727287344 \cdot 10^{-307}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\left(b + b\right)}{a \cdot 3}\\
\end{array}\]
Derivation
- Split input into 2 regimes
if (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)) < -2.7615828727287344e-307
Initial program 24.3
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
if -2.7615828727287344e-307 < (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))
Initial program 61.9
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
- Using strategy
rm Applied add-log-exp62.1
\[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(e^{\left(3 \cdot a\right) \cdot c}\right)}}}{3 \cdot a}\]
Taylor expanded around -inf 58.5
\[\leadsto \frac{\left(-b\right) + \color{blue}{-1 \cdot b}}{3 \cdot a}\]
Applied simplify58.5
\[\leadsto \color{blue}{\frac{-\left(b + b\right)}{a \cdot 3}}\]
- Recombined 2 regimes into one program.
Runtime
herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)'
(FPCore (a b c d)
:name "Cubic critical, medium range"
:pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))