?

Average Error: 33.5 → 12.1
Time: 21.5s
Precision: binary64
Cost: 13900

?

\[\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 -1.7 \cdot 10^{+151}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq -6.8 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}}{a}}{-3}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-290}:\\ \;\;\;\;\frac{b + \sqrt{a \cdot -3} \cdot \sqrt{c}}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - 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 -1.7e+151)
   (/ b (* a -1.5))
   (if (<= b -6.8e-158)
     (/ (/ (- b (sqrt (+ (* b b) (* a (* c -3.0))))) a) -3.0)
     (if (<= b 8.6e-290)
       (/ (+ b (* (sqrt (* a -3.0)) (sqrt c))) (* a 3.0))
       (if (<= b 1.4e-43)
         (/ (- (sqrt (+ (* b b) (* c (* a -3.0)))) 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 <= -1.7e+151) {
		tmp = b / (a * -1.5);
	} else if (b <= -6.8e-158) {
		tmp = ((b - sqrt(((b * b) + (a * (c * -3.0))))) / a) / -3.0;
	} else if (b <= 8.6e-290) {
		tmp = (b + (sqrt((a * -3.0)) * sqrt(c))) / (a * 3.0);
	} else if (b <= 1.4e-43) {
		tmp = (sqrt(((b * b) + (c * (a * -3.0)))) - 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 <= (-1.7d+151)) then
        tmp = b / (a * (-1.5d0))
    else if (b <= (-6.8d-158)) then
        tmp = ((b - sqrt(((b * b) + (a * (c * (-3.0d0)))))) / a) / (-3.0d0)
    else if (b <= 8.6d-290) then
        tmp = (b + (sqrt((a * (-3.0d0))) * sqrt(c))) / (a * 3.0d0)
    else if (b <= 1.4d-43) then
        tmp = (sqrt(((b * b) + (c * (a * (-3.0d0))))) - 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 <= -1.7e+151) {
		tmp = b / (a * -1.5);
	} else if (b <= -6.8e-158) {
		tmp = ((b - Math.sqrt(((b * b) + (a * (c * -3.0))))) / a) / -3.0;
	} else if (b <= 8.6e-290) {
		tmp = (b + (Math.sqrt((a * -3.0)) * Math.sqrt(c))) / (a * 3.0);
	} else if (b <= 1.4e-43) {
		tmp = (Math.sqrt(((b * b) + (c * (a * -3.0)))) - 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 <= -1.7e+151:
		tmp = b / (a * -1.5)
	elif b <= -6.8e-158:
		tmp = ((b - math.sqrt(((b * b) + (a * (c * -3.0))))) / a) / -3.0
	elif b <= 8.6e-290:
		tmp = (b + (math.sqrt((a * -3.0)) * math.sqrt(c))) / (a * 3.0)
	elif b <= 1.4e-43:
		tmp = (math.sqrt(((b * b) + (c * (a * -3.0)))) - 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 <= -1.7e+151)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= -6.8e-158)
		tmp = Float64(Float64(Float64(b - sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0))))) / a) / -3.0);
	elseif (b <= 8.6e-290)
		tmp = Float64(Float64(b + Float64(sqrt(Float64(a * -3.0)) * sqrt(c))) / Float64(a * 3.0));
	elseif (b <= 1.4e-43)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -3.0)))) - 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 <= -1.7e+151)
		tmp = b / (a * -1.5);
	elseif (b <= -6.8e-158)
		tmp = ((b - sqrt(((b * b) + (a * (c * -3.0))))) / a) / -3.0;
	elseif (b <= 8.6e-290)
		tmp = (b + (sqrt((a * -3.0)) * sqrt(c))) / (a * 3.0);
	elseif (b <= 1.4e-43)
		tmp = (sqrt(((b * b) + (c * (a * -3.0)))) - 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, -1.7e+151], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -6.8e-158], N[(N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 8.6e-290], N[(N[(b + N[(N[Sqrt[N[(a * -3.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.4e-43], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -3.0), $MachinePrecision]), $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 -1.7 \cdot 10^{+151}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

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

\mathbf{elif}\;b \leq 8.6 \cdot 10^{-290}:\\
\;\;\;\;\frac{b + \sqrt{a \cdot -3} \cdot \sqrt{c}}{a \cdot 3}\\

\mathbf{elif}\;b \leq 1.4 \cdot 10^{-43}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - 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 5 regimes
  2. if b < -1.7e151

    1. Initial program 63.4

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

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) \cdot \frac{-0.3333333333333333}{a}} \]
      Proof

      [Start]63.4

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

      remove-double-neg [<=]63.4

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

      sub-neg [<=]63.4

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

      div-sub [=>]63.4

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

      neg-mul-1 [=>]63.4

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

      associate-*l/ [<=]63.4

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

      distribute-frac-neg [=>]63.4

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

      fma-neg [=>]63.4

      \[ \color{blue}{\mathsf{fma}\left(\frac{-1}{3 \cdot a}, b, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right)} \]

      /-rgt-identity [<=]63.4

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \color{blue}{\frac{b}{1}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      metadata-eval [<=]63.4

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{b}{\color{blue}{\frac{-1}{-1}}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      associate-/l* [<=]63.4

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \color{blue}{\frac{b \cdot -1}{-1}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      *-commutative [<=]63.4

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{\color{blue}{-1 \cdot b}}{-1}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      neg-mul-1 [<=]63.4

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{\color{blue}{-b}}{-1}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      fma-neg [<=]63.4

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

      neg-mul-1 [=>]63.4

      \[ \frac{-1}{3 \cdot a} \cdot \frac{-b}{-1} - \color{blue}{-1 \cdot \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    3. Applied egg-rr63.4

      \[\leadsto \color{blue}{\frac{\frac{b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a}}{-3}} \]
    4. Taylor expanded in a around 0 63.3

      \[\leadsto \frac{\frac{b - \sqrt{\color{blue}{{b}^{2}}}}{a}}{-3} \]
    5. Simplified63.3

      \[\leadsto \frac{\frac{b - \sqrt{\color{blue}{b \cdot b}}}{a}}{-3} \]
      Proof

      [Start]63.3

      \[ \frac{\frac{b - \sqrt{{b}^{2}}}{a}}{-3} \]

      unpow2 [=>]63.3

      \[ \frac{\frac{b - \sqrt{\color{blue}{b \cdot b}}}{a}}{-3} \]
    6. Taylor expanded in b around -inf 2.6

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
      Proof

      [Start]2.6

      \[ -0.6666666666666666 \cdot \frac{b}{a} \]

      associate-*r/ [=>]2.6

      \[ \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} \]

      associate-*l/ [<=]2.6

      \[ \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]

      *-commutative [=>]2.6

      \[ \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    8. Applied egg-rr2.5

      \[\leadsto \color{blue}{\frac{b}{a \cdot -1.5}} \]

    if -1.7e151 < b < -6.7999999999999999e-158

    1. Initial program 6.0

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

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) \cdot \frac{-0.3333333333333333}{a}} \]
      Proof

      [Start]6.0

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

      remove-double-neg [<=]6.0

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

      sub-neg [<=]6.0

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

      div-sub [=>]6.0

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

      neg-mul-1 [=>]6.0

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

      associate-*l/ [<=]6.0

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

      distribute-frac-neg [=>]6.0

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

      fma-neg [=>]6.0

      \[ \color{blue}{\mathsf{fma}\left(\frac{-1}{3 \cdot a}, b, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right)} \]

      /-rgt-identity [<=]6.0

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \color{blue}{\frac{b}{1}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      metadata-eval [<=]6.0

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{b}{\color{blue}{\frac{-1}{-1}}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      associate-/l* [<=]6.0

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \color{blue}{\frac{b \cdot -1}{-1}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      *-commutative [<=]6.0

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{\color{blue}{-1 \cdot b}}{-1}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      neg-mul-1 [<=]6.0

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{\color{blue}{-b}}{-1}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      fma-neg [<=]6.0

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

      neg-mul-1 [=>]6.0

      \[ \frac{-1}{3 \cdot a} \cdot \frac{-b}{-1} - \color{blue}{-1 \cdot \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    3. Applied egg-rr6.1

      \[\leadsto \color{blue}{\frac{\frac{b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a}}{-3}} \]
    4. Applied egg-rr6.1

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

    if -6.7999999999999999e-158 < b < 8.6000000000000004e-290

    1. Initial program 14.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around 0 14.8

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

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

      [Start]14.8

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

      *-commutative [<=]14.8

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

      associate-*r* [=>]14.7

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

      *-commutative [<=]14.7

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

      *-commutative [=>]14.7

      \[ \frac{\left(-b\right) + \sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}}}{3 \cdot a} \]
    4. Applied egg-rr34.3

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

      \[\leadsto \frac{\color{blue}{b + \sqrt{a \cdot -3} \cdot \sqrt{c}}}{3 \cdot a} \]
      Proof

      [Start]34.3

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

      cancel-sign-sub [=>]34.3

      \[ \frac{\color{blue}{b + \sqrt{c} \cdot \sqrt{a \cdot -3}}}{3 \cdot a} \]

      *-commutative [<=]34.3

      \[ \frac{b + \color{blue}{\sqrt{a \cdot -3} \cdot \sqrt{c}}}{3 \cdot a} \]

    if 8.6000000000000004e-290 < b < 1.3999999999999999e-43

    1. Initial program 22.9

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

    if 1.3999999999999999e-43 < b

    1. Initial program 53.6

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

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) \cdot \frac{-0.3333333333333333}{a}} \]
      Proof

      [Start]53.6

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

      remove-double-neg [<=]53.6

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

      sub-neg [<=]53.6

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

      div-sub [=>]54.5

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

      neg-mul-1 [=>]54.5

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

      associate-*l/ [<=]55.4

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

      distribute-frac-neg [=>]55.4

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

      fma-neg [=>]57.9

      \[ \color{blue}{\mathsf{fma}\left(\frac{-1}{3 \cdot a}, b, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right)} \]

      /-rgt-identity [<=]57.9

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \color{blue}{\frac{b}{1}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      metadata-eval [<=]57.9

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{b}{\color{blue}{\frac{-1}{-1}}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      associate-/l* [<=]57.9

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \color{blue}{\frac{b \cdot -1}{-1}}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      *-commutative [<=]57.9

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{\color{blue}{-1 \cdot b}}{-1}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      neg-mul-1 [<=]57.9

      \[ \mathsf{fma}\left(\frac{-1}{3 \cdot a}, \frac{\color{blue}{-b}}{-1}, -\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)\right) \]

      fma-neg [<=]55.4

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

      neg-mul-1 [=>]55.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{+151}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq -6.8 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}}{a}}{-3}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-290}:\\ \;\;\;\;\frac{b + \sqrt{a \cdot -3} \cdot \sqrt{c}}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Error10.1
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{+151}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-43}:\\ \;\;\;\;\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
Error10.1
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -5.1 \cdot 10^{+150}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 1.26 \cdot 10^{-43}:\\ \;\;\;\;\frac{\frac{b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}}{a}}{-3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 3
Error13.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-94}:\\ \;\;\;\;\frac{\frac{b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot 1.5\right)}{-3}}{a}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-43}:\\ \;\;\;\;\left(b - \sqrt{-3 \cdot \left(a \cdot c\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 4
Error13.8
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot 1.5\right)}{-3}}{a}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-43}:\\ \;\;\;\;\left(b - \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 5
Error13.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{\frac{b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot 1.5\right)}{-3}}{a}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a} \cdot 0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 6
Error13.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{-94}:\\ \;\;\;\;\frac{\frac{b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot 1.5\right)}{-3}}{a}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-43}:\\ \;\;\;\;-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 7
Error13.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -2.25 \cdot 10^{-94}:\\ \;\;\;\;\frac{\frac{b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot 1.5\right)}{-3}}{a}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 8
Error23.1
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-230}:\\ \;\;\;\;\frac{\frac{b}{a} \cdot 2}{-3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 9
Error23.1
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq 1.02 \cdot 10^{-231}:\\ \;\;\;\;\frac{\frac{b + b}{-3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 10
Error23.2
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{-227}:\\ \;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 11
Error23.1
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 3 \cdot 10^{-228}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 12
Error40.0
Cost320
\[-0.5 \cdot \frac{c}{b} \]
Alternative 13
Error56.2
Cost64
\[0 \]

Error

Reproduce?

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