\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\right)\]
(FPCore (a b c)
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
↓
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma a (* c -3.0) (* b b))))
(if (<= (/ (- (sqrt (+ (* b b) (* c (* a -3.0)))) b) (* 3.0 a)) -8.0)
(* (- (* b b) t_0) (/ (/ -0.3333333333333333 a) (+ b (sqrt t_0))))
(pow
(fma
-2.0
(/ b c)
(fma
-3.0
(/ (* (* c (* a a)) -0.375) (pow b 3.0))
(fma
1.5
(/ a b)
(*
-3.0
(/
(*
(fma
-0.2222222222222222
(/ (* (pow a 4.0) 6.328125) a)
(* (pow a 3.0) 0.84375))
(* c c))
(pow b 5.0))))))
-1.0))))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
\[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a} \cdot -0.3333333333333333}\right)}^{3}}
\]
Applied egg-rr8.9
\[\leadsto \color{blue}{\frac{\left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right) \cdot -0.3333333333333333}{a \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}}
\]
Simplified8.9
\[\leadsto \color{blue}{\left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right) \cdot \frac{\frac{-0.3333333333333333}{a}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}
\]
Proof
[Start]8.9
\[ \frac{\left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right) \cdot -0.3333333333333333}{a \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}
\]
associate-/r* [=>]8.9
\[ \color{blue}{\frac{\frac{\left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right) \cdot -0.3333333333333333}{a}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}
\]
associate-*r/ [<=]8.9
\[ \frac{\color{blue}{\left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right) \cdot \frac{-0.3333333333333333}{a}}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}
\]
*-commutative [=>]8.9
\[ \frac{\color{blue}{\frac{-0.3333333333333333}{a} \cdot \left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}
\]
associate-*l/ [<=]8.9
\[ \color{blue}{\frac{\frac{-0.3333333333333333}{a}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}} \cdot \left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)}
\]
*-commutative [=>]8.9
\[ \color{blue}{\left(b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right) \cdot \frac{\frac{-0.3333333333333333}{a}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}
\]
if -8 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))
herbie shell --seed 2023011
(FPCore (a b c)
:name "Cubic critical, narrow range"
:precision binary64
:pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))