Average Error: 44.3 → 12.0
Time: 3.9s
Precision: binary64
\[1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992 \land 1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992 \land 1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{c}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \frac{-1.5}{\sqrt[3]{3} \cdot b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{c}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \frac{-1.5}{\sqrt[3]{3} \cdot b}
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (* (/ c (* (cbrt 3.0) (cbrt 3.0))) (/ -1.5 (* (cbrt 3.0) b))))
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 / (cbrt(3.0) * cbrt(3.0))) * (-1.5 / (cbrt(3.0) * b));
}

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 44.3

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

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
  3. Taylor expanded around inf 12.0

    \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
  4. Using strategy rm
  5. Applied associate-/l*_binary6411.9

    \[\leadsto \color{blue}{\frac{-1.5}{\frac{3 \cdot a}{\frac{a \cdot c}{b}}}}\]
  6. Simplified11.7

    \[\leadsto \frac{-1.5}{\color{blue}{\frac{3}{\frac{c}{b}}}}\]
  7. Using strategy rm
  8. Applied div-inv_binary6411.8

    \[\leadsto \frac{-1.5}{\frac{3}{\color{blue}{c \cdot \frac{1}{b}}}}\]
  9. Applied add-cube-cbrt_binary6411.8

    \[\leadsto \frac{-1.5}{\frac{\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}}}{c \cdot \frac{1}{b}}}\]
  10. Applied times-frac_binary6412.0

    \[\leadsto \frac{-1.5}{\color{blue}{\frac{\sqrt[3]{3} \cdot \sqrt[3]{3}}{c} \cdot \frac{\sqrt[3]{3}}{\frac{1}{b}}}}\]
  11. Applied *-un-lft-identity_binary6412.0

    \[\leadsto \frac{\color{blue}{1 \cdot -1.5}}{\frac{\sqrt[3]{3} \cdot \sqrt[3]{3}}{c} \cdot \frac{\sqrt[3]{3}}{\frac{1}{b}}}\]
  12. Applied times-frac_binary6412.0

    \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt[3]{3} \cdot \sqrt[3]{3}}{c}} \cdot \frac{-1.5}{\frac{\sqrt[3]{3}}{\frac{1}{b}}}}\]
  13. Simplified12.0

    \[\leadsto \color{blue}{\frac{c}{\sqrt[3]{3} \cdot \sqrt[3]{3}}} \cdot \frac{-1.5}{\frac{\sqrt[3]{3}}{\frac{1}{b}}}\]
  14. Simplified12.0

    \[\leadsto \frac{c}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \color{blue}{\frac{-1.5}{b \cdot \sqrt[3]{3}}}\]
  15. Final simplification12.0

    \[\leadsto \frac{c}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \frac{-1.5}{\sqrt[3]{3} \cdot b}\]

Reproduce

herbie shell --seed 2020253 
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :precision binary64
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))