Average Error: 33.7 → 10.2
Time: 18.2s
Precision: binary64
Cost: 7624
\[\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 -2.4 \cdot 10^{+95}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4.7 \cdot 10^{-67}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \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 -2.4e+95)
   (/ b (* a -1.5))
   (if (<= b 4.7e-67)
     (/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
     (* -0.5 (/ c 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) {
	double tmp;
	if (b <= -2.4e+95) {
		tmp = b / (a * -1.5);
	} else if (b <= 4.7e-67) {
		tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-2.4d+95)) then
        tmp = b / (a * (-1.5d0))
    else if (b <= 4.7d-67) then
        tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
    else
        tmp = (-0.5d0) * (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.4e+95) {
		tmp = b / (a * -1.5);
	} else if (b <= 4.7e-67) {
		tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
def code(a, b, c):
	tmp = 0
	if b <= -2.4e+95:
		tmp = b / (a * -1.5)
	elif b <= 4.7e-67:
		tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0)
	else:
		tmp = -0.5 * (c / b)
	return tmp
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.4e+95)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= 4.7e-67)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.4e+95)
		tmp = b / (a * -1.5);
	elseif (b <= 4.7e-67)
		tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	else
		tmp = -0.5 * (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := If[LessEqual[b, -2.4e+95], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.7e-67], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\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 -2.4 \cdot 10^{+95}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

\mathbf{elif}\;b \leq 4.7 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b < -2.4e95

    1. Initial program 44.5

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}} \]
      Proof
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -3)))) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 3)))))) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a c) (neg.f64 3))))) b) (*.f64 3 a)): 8 points increase in error, 9 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 a c) 3))))) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 3 (*.f64 a c)))))) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 3 a) c))))) b) (*.f64 3 a)): 1 points increase in error, 9 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) b) (*.f64 3 a)): 0 points increase in error, 1 points decrease in error
      (/.f64 (-.f64 (Rewrite<= /-rgt-identity_binary64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))) 1)) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))) (Rewrite<= metadata-eval (/.f64 -1 -1))) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))) -1) -1)) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) -1) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) -1) b) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (Rewrite<= /-rgt-identity_binary64 (/.f64 b 1))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (/.f64 b (Rewrite<= metadata-eval (/.f64 -1 -1)))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 b -1) -1))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1 b)) -1)) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 b)) -1)) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (neg.f64 b)) -1)) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (Rewrite=> sub-neg_binary64 (+.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (neg.f64 (neg.f64 b)))) -1) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (+.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (Rewrite=> remove-double-neg_binary64 b)) -1) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 b (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) -1) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (Rewrite<= sub-neg_binary64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) -1) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r*_binary64 (/.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 -1 (*.f64 3 a)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) (*.f64 -1 (*.f64 3 a))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (Rewrite<= metadata-eval (neg.f64 -1)) (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) (*.f64 -1 (*.f64 3 a))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> times-frac_binary64 (*.f64 (/.f64 (neg.f64 -1) -1) (/.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite=> metadata-eval 1) -1) (/.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite=> metadata-eval -1) (/.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 -1 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) (*.f64 3 a))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 b)) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in b around inf 45.4

      \[\leadsto \frac{\sqrt{\color{blue}{{b}^{2}}} - b}{3 \cdot a} \]
    4. Simplified45.4

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b}} - b}{3 \cdot a} \]
      Proof
      (*.f64 b b): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unpow2_binary64 (pow.f64 b 2)): 0 points increase in error, 1 points decrease in error
    5. Taylor expanded in b around -inf 4.3

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    6. Simplified4.2

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
      Proof
      (*.f64 b (/.f64 -2/3 a)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 -2/3 a) b)): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 -2/3 b) a)): 40 points increase in error, 30 points decrease in error
      (Rewrite<= associate-*r/_binary64 (*.f64 -2/3 (/.f64 b a))): 34 points increase in error, 48 points decrease in error
    7. Taylor expanded in b around 0 4.3

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    8. Simplified4.1

      \[\leadsto \color{blue}{\frac{b}{a \cdot -1.5}} \]
      Proof
      (/.f64 b (*.f64 a -3/2)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/l/_binary64 (/.f64 (/.f64 b -3/2) a)): 31 points increase in error, 27 points decrease in error
      (/.f64 (/.f64 b (Rewrite<= metadata-eval (/.f64 1 -2/3))) a): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 b -2/3) 1)) a): 25 points increase in error, 32 points decrease in error
      (/.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 -2/3 b)) 1) a): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite=> /-rgt-identity_binary64 (*.f64 -2/3 b)) a): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r/_binary64 (*.f64 -2/3 (/.f64 b a))): 34 points increase in error, 48 points decrease in error

    if -2.4e95 < b < 4.70000000000000004e-67

    1. Initial program 13.5

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

    if 4.70000000000000004e-67 < b

    1. Initial program 53.7

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

      \[\leadsto \color{blue}{\frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a} \cdot -0.3333333333333333} \]
      Proof
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -3))))) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 3))))))) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a c) (neg.f64 3)))))) a) -1/3): 5 points increase in error, 10 points decrease in error
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 a c) 3)))))) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 3 (*.f64 a c))))))) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 3 a) c)))))) a) -1/3): 4 points increase in error, 4 points decrease in error
      (*.f64 (/.f64 (-.f64 b (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) a) -1/3): 0 points increase in error, 1 points decrease in error
      (*.f64 (/.f64 (Rewrite<= /-rgt-identity_binary64 (/.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) 1)) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (/.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (Rewrite<= metadata-eval (/.f64 -1 -1))) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) -1)) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) -1) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) -1) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (/.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))))) -1) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (/.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c))))) -1) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (/.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 b)) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) a) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 -1 a))) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (Rewrite<= neg-mul-1_binary64 (neg.f64 a))) -1/3): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (neg.f64 a)) (Rewrite<= metadata-eval (/.f64 -1 3))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (*.f64 (neg.f64 a) 3))): 16 points increase in error, 35 points decrease in error
      (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 a 3)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 3 a)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (Rewrite=> neg-mul-1_binary64 (*.f64 -1 (*.f64 3 a)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) -1) (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 3 a) -1))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> times-frac_binary64 (*.f64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) (/.f64 -1 -1))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) (Rewrite=> metadata-eval 1)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) (Rewrite<= metadata-eval (neg.f64 -1))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r/_binary64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (/.f64 (*.f64 3 a) (neg.f64 -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (/.f64 (*.f64 3 a) (Rewrite=> metadata-eval 1))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (Rewrite=> /-rgt-identity_binary64 (*.f64 3 a))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in b around inf 8.9

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{+95}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4.7 \cdot 10^{-67}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Error10.3
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -1.05 \cdot 10^{+96}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-69}:\\ \;\;\;\;\frac{b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}}{a} \cdot -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 2
Error13.5
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -4.5 \cdot 10^{-85}:\\ \;\;\;\;\frac{1.5 \cdot \frac{c}{\frac{b}{a}} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.75 \cdot 10^{-71}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 3
Error13.5
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -4.7 \cdot 10^{-85}:\\ \;\;\;\;\frac{1.5 \cdot \frac{c}{\frac{b}{a}} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-69}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{-3 \cdot \left(a \cdot c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 4
Error13.5
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -2.5 \cdot 10^{-87}:\\ \;\;\;\;\frac{1.5 \cdot \frac{c}{\frac{b}{a}} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 5
Error23.2
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 3.4 \cdot 10^{-225}:\\ \;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 6
Error23.2
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 3.05 \cdot 10^{-226}:\\ \;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 7
Error23.2
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 2.9 \cdot 10^{-226}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 8
Error40.2
Cost320
\[-0.5 \cdot \frac{c}{b} \]
Alternative 9
Error56.1
Cost64
\[0 \]

Error

Reproduce

herbie shell --seed 2022331 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))