Average Error: 28.5 → 0.4
Time: 3.9s
Precision: binary64
\[1.0536712127723509 \cdot 10^{-08} < a \land a < 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} < b \land b < 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} < c \land c < 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{1}{\frac{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-c}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{1}{\frac{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-c}}
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (/ 1.0 (/ (+ b (sqrt (- (* b b) (* (* 3.0 a) c)))) (- c))))
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 1.0 / ((b + sqrt((b * b) - ((3.0 * a) * c))) / -c);
}

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.5

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

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
  3. Using strategy rm
  4. Applied flip--_binary6428.6

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

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

    \[\leadsto \frac{\frac{\left(b \cdot b\right) \cdot 0 - \left(3 \cdot a\right) \cdot c}{\color{blue}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
  7. Using strategy rm
  8. Applied associate-/l/_binary640.5

    \[\leadsto \color{blue}{\frac{\left(b \cdot b\right) \cdot 0 - \left(3 \cdot a\right) \cdot c}{\left(3 \cdot a\right) \cdot \left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
  9. Using strategy rm
  10. Applied *-un-lft-identity_binary640.5

    \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(b \cdot b\right) \cdot 0 - \left(3 \cdot a\right) \cdot c\right)}}{\left(3 \cdot a\right) \cdot \left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
  11. Applied associate-/l*_binary640.5

    \[\leadsto \color{blue}{\frac{1}{\frac{\left(3 \cdot a\right) \cdot \left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\left(b \cdot b\right) \cdot 0 - \left(3 \cdot a\right) \cdot c}}}\]
  12. Simplified0.4

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

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

Reproduce

herbie shell --seed 2020288 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))