Average Error: 28.5 → 9.2
Time: 7.8s
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}\]
\[\begin{array}{l} \mathbf{if}\;b \leq 4.25354810227258:\\ \;\;\;\;\frac{\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}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c \cdot c}{b \cdot b} \cdot 0.25 - \frac{a}{\log \left(e^{\frac{{b}^{6}}{a \cdot {c}^{4}}}\right)} \cdot 0.140625}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \leq 4.25354810227258:\\
\;\;\;\;\frac{\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}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{c \cdot c}{b \cdot b} \cdot 0.25 - \frac{a}{\log \left(e^{\frac{{b}^{6}}{a \cdot {c}^{4}}}\right)} \cdot 0.140625}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\\

\end{array}
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (if (<= b 4.25354810227258)
   (/
    (/
     (- (- (* b b) (* (* 3.0 a) c)) (* b b))
     (+ b (sqrt (- (* b b) (* (* 3.0 a) c)))))
    (* 3.0 a))
   (/
    (-
     (* (/ (* c c) (* b b)) 0.25)
     (* (/ a (log (exp (/ (pow b 6.0) (* a (pow c 4.0)))))) 0.140625))
    (- (* (/ c b) -0.5) (* (/ (* a (* c c)) (pow b 3.0)) -0.375)))))
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) {
	double tmp;
	if (b <= 4.25354810227258) {
		tmp = ((((b * b) - ((3.0 * a) * c)) - (b * b)) / (b + sqrt((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
	} else {
		tmp = ((((c * c) / (b * b)) * 0.25) - ((a / log(exp(pow(b, 6.0) / (a * pow(c, 4.0))))) * 0.140625)) / (((c / b) * -0.5) - (((a * (c * c)) / pow(b, 3.0)) * -0.375));
	}
	return tmp;
}

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. Split input into 2 regimes
  2. if b < 4.2535481022725801

    1. Initial program 12.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified12.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--_binary64_244012.5

      \[\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. Simplified11.5

      \[\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. Simplified11.5

      \[\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}\]

    if 4.2535481022725801 < b

    1. Initial program 32.6

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

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

      \[\leadsto \color{blue}{-\left(0.5 \cdot \frac{c}{b} + 0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)}\]
    4. Simplified8.6

      \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5 + \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\]
    5. Using strategy rm
    6. Applied flip-+_binary64_24398.6

      \[\leadsto \color{blue}{\frac{\left(\frac{c}{b} \cdot -0.5\right) \cdot \left(\frac{c}{b} \cdot -0.5\right) - \left(\frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375\right) \cdot \left(\frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375\right)}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}}\]
    7. Simplified8.8

      \[\leadsto \frac{\color{blue}{\frac{c \cdot c}{b \cdot b} \cdot 0.25 - \frac{a}{\frac{{b}^{6}}{{c}^{4} \cdot a}} \cdot 0.140625}}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\]
    8. Using strategy rm
    9. Applied add-log-exp_binary64_25048.6

      \[\leadsto \frac{\frac{c \cdot c}{b \cdot b} \cdot 0.25 - \frac{a}{\color{blue}{\log \left(e^{\frac{{b}^{6}}{{c}^{4} \cdot a}}\right)}} \cdot 0.140625}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\]
    10. Simplified8.6

      \[\leadsto \frac{\frac{c \cdot c}{b \cdot b} \cdot 0.25 - \frac{a}{\log \color{blue}{\left(e^{\frac{{b}^{6}}{a \cdot {c}^{4}}}\right)}} \cdot 0.140625}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.25354810227258:\\ \;\;\;\;\frac{\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}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c \cdot c}{b \cdot b} \cdot 0.25 - \frac{a}{\log \left(e^{\frac{{b}^{6}}{a \cdot {c}^{4}}}\right)} \cdot 0.140625}{\frac{c}{b} \cdot -0.5 - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot -0.375}\\ \end{array}\]

Reproduce

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