\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -1.3337681397070838 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(1.5 \cdot \frac{a \cdot c}{b} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.9979259851056098 \cdot 10^{-117}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.816879541232831 \cdot 10^{+141}:\\
\;\;\;\;\frac{\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a \cdot c}{b} \cdot -1.5}{a \cdot 3}\\
\end{array}(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b -1.3337681397070838e+154)
(/ (- (- (* 1.5 (/ (* a c) b)) b) b) (* a 3.0))
(if (<= b 1.9979259851056098e-117)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 3.816879541232831e+141)
(/
(/ (* a (* c -3.0)) (+ b (sqrt (- (* b b) (* c (* a 3.0))))))
(* a 3.0))
(/ (* (/ (* a c) b) -1.5) (* a 3.0))))))double code(double a, double b, double c) {
return (-b + sqrt((b * b) - ((3.0 * a) * c))) / (3.0 * a);
}
double code(double a, double b, double c) {
double tmp;
if (b <= -1.3337681397070838e+154) {
tmp = (((1.5 * ((a * c) / b)) - b) - b) / (a * 3.0);
} else if (b <= 1.9979259851056098e-117) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 3.816879541232831e+141) {
tmp = ((a * (c * -3.0)) / (b + sqrt((b * b) - (c * (a * 3.0))))) / (a * 3.0);
} else {
tmp = (((a * c) / b) * -1.5) / (a * 3.0);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.33376813970708378e154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 10.1
if -1.33376813970708378e154 < b < 1.9979259851056098e-117Initial program 11.1
if 1.9979259851056098e-117 < b < 3.81687954123283089e141Initial program 41.9
Simplified41.9
rmApplied flip--_binary64_175841.9
Simplified15.5
Simplified15.5
if 3.81687954123283089e141 < b Initial program 62.8
Simplified62.8
Taylor expanded around inf 14.9
Simplified14.9
Final simplification12.8
herbie shell --seed 2020343
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))