Average Error: 28.6 → 0.4
Time: 8.6s
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}{\left(b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right) \cdot \frac{-1}{c}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{1}{\left(b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right) \cdot \frac{-1}{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) (* c (* a 3.0))))) (/ -1.0 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) - (c * (a * 3.0)))) * (-1.0 / 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.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}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
  3. Using strategy rm
  4. Applied flip--_binary6428.7

    \[\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. Simplified27.6

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

    \[\leadsto \frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{\color{blue}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
  7. Using strategy rm
  8. Applied add-cbrt-cube_binary6427.7

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

    \[\leadsto \frac{\sqrt[3]{\color{blue}{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \left(\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right)}}}{3 \cdot a}\]
  10. Using strategy rm
  11. Applied frac-times_binary6427.7

    \[\leadsto \frac{\sqrt[3]{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \color{blue}{\frac{\left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b\right) \cdot \left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b\right)}{\left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}{3 \cdot a}\]
  12. Applied frac-times_binary6427.7

    \[\leadsto \frac{\sqrt[3]{\color{blue}{\frac{\left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b\right) \cdot \left(\left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b\right) \cdot \left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b\right)\right)}{\left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \left(\left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \left(b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}}}}{3 \cdot a}\]
  13. Applied cbrt-div_binary6427.7

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

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

    \[\leadsto \frac{\frac{a \cdot \left(c \cdot -3\right)}{\color{blue}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
  16. Using strategy rm
  17. Applied clear-num_binary640.6

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

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

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

Reproduce

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