Average Error: 28.6 → 0.3
Time: 8.2s
Precision: binary64
\[\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)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
\[\frac{-c}{b + \sqrt{{b}^{2} - \sqrt[3]{27 \cdot \left(\left(c \cdot a\right) \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right)\right)}}} \]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{-c}{b + \sqrt{{b}^{2} - \sqrt[3]{27 \cdot \left(\left(c \cdot a\right) \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right)\right)}}}
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (/
  (- c)
  (+
   b
   (sqrt (- (pow b 2.0) (cbrt (* 27.0 (* (* c a) (* (* c a) (* c a))))))))))
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) {
	return -c / (b + sqrt(pow(b, 2.0) - cbrt(27.0 * ((c * a) * ((c * a) * (c * a))))));
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 28.6

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Simplified28.6

    \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}} \]
  3. Applied flip--_binary6428.6

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b \cdot b}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} + b}} \cdot \frac{0.3333333333333333}{a} \]
  4. Applied associate-*l/_binary6428.6

    \[\leadsto \color{blue}{\frac{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b \cdot b\right) \cdot \frac{0.3333333333333333}{a}}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} + b}} \]
  5. Simplified0.6

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, c \cdot -3, 0\right) \cdot \frac{0.3333333333333333}{a}}}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} + b} \]
  6. Taylor expanded in a around 0 0.3

    \[\leadsto \frac{\color{blue}{-1 \cdot c}}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} + b} \]
  7. Simplified0.3

    \[\leadsto \frac{\color{blue}{-c}}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} + b} \]
  8. Taylor expanded in a around 0 0.3

    \[\leadsto \frac{-c}{\sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(c \cdot a\right)}} + b} \]
  9. Applied add-cbrt-cube_binary640.3

    \[\leadsto \frac{-c}{\sqrt{{b}^{2} - 3 \cdot \color{blue}{\sqrt[3]{\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right) \cdot \left(c \cdot a\right)}}} + b} \]
  10. Applied add-cbrt-cube_binary640.3

    \[\leadsto \frac{-c}{\sqrt{{b}^{2} - \color{blue}{\sqrt[3]{\left(3 \cdot 3\right) \cdot 3}} \cdot \sqrt[3]{\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right) \cdot \left(c \cdot a\right)}} + b} \]
  11. Applied cbrt-unprod_binary640.3

    \[\leadsto \frac{-c}{\sqrt{{b}^{2} - \color{blue}{\sqrt[3]{\left(\left(3 \cdot 3\right) \cdot 3\right) \cdot \left(\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right) \cdot \left(c \cdot a\right)\right)}}} + b} \]
  12. Final simplification0.3

    \[\leadsto \frac{-c}{b + \sqrt{{b}^{2} - \sqrt[3]{27 \cdot \left(\left(c \cdot a\right) \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right)\right)}}} \]

Reproduce

herbie shell --seed 2022095 
(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)))