\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 -3.4636505911042224 \cdot 10^{+153}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -9.314290514286912 \cdot 10^{-291}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.893343540885068 \cdot 10^{+150}:\\
\;\;\;\;\frac{-c}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\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 -3.4636505911042224e+153)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -9.314290514286912e-291)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 7.893343540885068e+150)
(/ (- c) (+ b (sqrt (- (* b b) (* 3.0 (* c a))))))
(* (/ c b) -0.5)))))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 <= -3.4636505911042224e+153) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -9.314290514286912e-291) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 7.893343540885068e+150) {
tmp = -c / (b + sqrt((b * b) - (3.0 * (c * a))));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.463650591104222e153Initial program 63.7
Simplified63.7
rmApplied flip--_binary64_175864.0
Simplified62.8
Simplified62.7
Taylor expanded around -inf 2.3
if -3.463650591104222e153 < b < -9.3142905142869118e-291Initial program 8.3
Simplified8.3
if -9.3142905142869118e-291 < b < 7.8933435408850678e150Initial program 33.4
Simplified33.4
rmApplied flip--_binary64_175833.4
Simplified15.7
Simplified15.7
rmApplied *-un-lft-identity_binary64_178315.7
Applied times-frac_binary64_178915.7
Simplified15.7
Simplified8.6
rmApplied associate-*r/_binary64_17258.6
Applied associate-*r/_binary64_17258.5
Simplified8.3
if 7.8933435408850678e150 < b Initial program 63.6
Simplified63.6
rmApplied flip--_binary64_175863.6
Simplified39.7
Simplified39.7
Taylor expanded around 0 1.5
Final simplification6.3
herbie shell --seed 2021024
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))