\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\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))))
(*
(/
(/
(*
(+ (* 6.0 (* c (* a (pow b 2.0)))) (* -9.0 (* (pow c 2.0) (pow a 2.0))))
(/ 1.0 (+ b (sqrt t_0))))
(+ (* b b) t_0))
a)
-0.3333333333333333)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
\[\leadsto \frac{\color{blue}{\frac{\left({b}^{4} - {\left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)}^{2}\right) \cdot \frac{1}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}{b \cdot b + \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}{a} \cdot -0.3333333333333333
\]
Taylor expanded in b around 0 0.7
\[\leadsto \frac{\frac{\color{blue}{\left(6 \cdot \left(c \cdot \left(a \cdot {b}^{2}\right)\right) + -9 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)} \cdot \frac{1}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}{b \cdot b + \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a} \cdot -0.3333333333333333
\]
Final simplification0.7
\[\leadsto \frac{\frac{\left(6 \cdot \left(c \cdot \left(a \cdot {b}^{2}\right)\right) + -9 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right) \cdot \frac{1}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}{b \cdot b + \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a} \cdot -0.3333333333333333
\]
Alternatives
Alternative 1
Error
0.7
Cost
28352
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
-0.3333333333333333 \cdot \frac{\frac{\frac{\mathsf{fma}\left(6, c \cdot \left(a \cdot \left(b \cdot b\right)\right), -9 \cdot \left(a \cdot \left(c \cdot \left(c \cdot a\right)\right)\right)\right)}{b + \sqrt{t_0}}}{b \cdot b + t_0}}{a}
\end{array}
\]
Alternative 2
Error
4.3
Cost
14912
\[-0.3333333333333333 \cdot \frac{\frac{\mathsf{fma}\left(3, c \cdot \left(a \cdot b\right), \left(c \cdot c\right) \cdot \left(-2.25 \cdot \frac{a \cdot a}{b}\right)\right)}{b \cdot b + \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a}
\]
Alternative 3
Error
4.3
Cost
14912
\[-0.3333333333333333 \cdot \frac{\frac{\mathsf{fma}\left(3, b \cdot \left(c \cdot a\right), \left(c \cdot c\right) \cdot \frac{-2.25 \cdot \left(a \cdot a\right)}{b}\right)}{b \cdot b + \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a}
\]
herbie shell --seed 2023066
(FPCore (a b c)
:name "Cubic critical, medium range"
:precision binary64
:pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))