Cubic critical

?

Percentage Accurate: 52.4% → 86.0%
Time: 23.9s
Precision: binary64
Cost: 13964

?

\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
\[\begin{array}{l} t_0 := a \cdot \left(-3 \cdot c\right)\\ \mathbf{if}\;b \leq -1.35 \cdot 10^{+130}:\\ \;\;\;\;{\left(-3 \cdot \frac{a \cdot 0.5}{b}\right)}^{-1}\\ \mathbf{elif}\;b \leq -5.5 \cdot 10^{-125}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b + t_0}\right)}{a}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-93}:\\ \;\;\;\;\frac{\frac{b - \mathsf{hypot}\left(\sqrt{t_0}, b\right)}{a}}{-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
 (let* ((t_0 (* a (* -3.0 c))))
   (if (<= b -1.35e+130)
     (pow (* -3.0 (/ (* a 0.5) b)) -1.0)
     (if (<= b -5.5e-125)
       (/ (* -0.3333333333333333 (- b (sqrt (+ (* b b) t_0)))) a)
       (if (<= b 1.6e-93)
         (/ (/ (- b (hypot (sqrt t_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 t_0 = a * (-3.0 * c);
	double tmp;
	if (b <= -1.35e+130) {
		tmp = pow((-3.0 * ((a * 0.5) / b)), -1.0);
	} else if (b <= -5.5e-125) {
		tmp = (-0.3333333333333333 * (b - sqrt(((b * b) + t_0)))) / a;
	} else if (b <= 1.6e-93) {
		tmp = ((b - hypot(sqrt(t_0), b)) / a) / -3.0;
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
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 t_0 = a * (-3.0 * c);
	double tmp;
	if (b <= -1.35e+130) {
		tmp = Math.pow((-3.0 * ((a * 0.5) / b)), -1.0);
	} else if (b <= -5.5e-125) {
		tmp = (-0.3333333333333333 * (b - Math.sqrt(((b * b) + t_0)))) / a;
	} else if (b <= 1.6e-93) {
		tmp = ((b - Math.hypot(Math.sqrt(t_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):
	t_0 = a * (-3.0 * c)
	tmp = 0
	if b <= -1.35e+130:
		tmp = math.pow((-3.0 * ((a * 0.5) / b)), -1.0)
	elif b <= -5.5e-125:
		tmp = (-0.3333333333333333 * (b - math.sqrt(((b * b) + t_0)))) / a
	elif b <= 1.6e-93:
		tmp = ((b - math.hypot(math.sqrt(t_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)
	t_0 = Float64(a * Float64(-3.0 * c))
	tmp = 0.0
	if (b <= -1.35e+130)
		tmp = Float64(-3.0 * Float64(Float64(a * 0.5) / b)) ^ -1.0;
	elseif (b <= -5.5e-125)
		tmp = Float64(Float64(-0.3333333333333333 * Float64(b - sqrt(Float64(Float64(b * b) + t_0)))) / a);
	elseif (b <= 1.6e-93)
		tmp = Float64(Float64(Float64(b - hypot(sqrt(t_0), b)) / 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)
	t_0 = a * (-3.0 * c);
	tmp = 0.0;
	if (b <= -1.35e+130)
		tmp = (-3.0 * ((a * 0.5) / b)) ^ -1.0;
	elseif (b <= -5.5e-125)
		tmp = (-0.3333333333333333 * (b - sqrt(((b * b) + t_0)))) / a;
	elseif (b <= 1.6e-93)
		tmp = ((b - hypot(sqrt(t_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_] := Block[{t$95$0 = N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.35e+130], N[Power[N[(-3.0 * N[(N[(a * 0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], If[LessEqual[b, -5.5e-125], N[(N[(-0.3333333333333333 * N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.6e-93], N[(N[(N[(b - N[Sqrt[N[Sqrt[t$95$0], $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $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}
t_0 := a \cdot \left(-3 \cdot c\right)\\
\mathbf{if}\;b \leq -1.35 \cdot 10^{+130}:\\
\;\;\;\;{\left(-3 \cdot \frac{a \cdot 0.5}{b}\right)}^{-1}\\

\mathbf{elif}\;b \leq -5.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b + t_0}\right)}{a}\\

\mathbf{elif}\;b \leq 1.6 \cdot 10^{-93}:\\
\;\;\;\;\frac{\frac{b - \mathsf{hypot}\left(\sqrt{t_0}, b\right)}{a}}{-3}\\

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


\end{array}

Local Percentage Accuracy?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 16 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each of Herbie's proposed alternatives. Up and to the right is better. Each dot represents an alternative program; the red square represents the initial program.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 4 regimes
  2. if b < -1.3499999999999999e130

    1. Initial program 45.1%

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

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

      [Start]45.1

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

      /-rgt-identity [<=]45.1

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

      metadata-eval [<=]45.1

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

      associate-/r/ [=>]45.1

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

      metadata-eval [=>]45.1

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

      metadata-eval [<=]45.1

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

      times-frac [<=]45.1

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

      *-commutative [<=]45.1

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

      times-frac [=>]45.0

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

      *-commutative [<=]45.0

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

      associate-/r* [=>]45.0

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

      associate-*l/ [=>]45.0

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

      \[\leadsto \color{blue}{{\left(-3 \cdot \frac{a}{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}\right)}^{-1}} \]
      Step-by-step derivation

      [Start]45.0

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

      clear-num [=>]45.1

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

      inv-pow [=>]45.1

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

      *-un-lft-identity [=>]45.1

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

      times-frac [=>]45.1

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

      metadata-eval [=>]45.1

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

      fma-udef [=>]45.1

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

      add-sqr-sqrt [=>]21.3

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

      hypot-def [=>]44.1

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

      associate-*l* [=>]44.1

      \[ {\left(-3 \cdot \frac{a}{b - \mathsf{hypot}\left(b, \sqrt{\color{blue}{a \cdot \left(c \cdot -3\right)}}\right)}\right)}^{-1} \]
    4. Taylor expanded in b around -inf 98.2%

      \[\leadsto {\left(-3 \cdot \color{blue}{\left(0.5 \cdot \frac{a}{b}\right)}\right)}^{-1} \]
    5. Simplified98.2%

      \[\leadsto {\left(-3 \cdot \color{blue}{\frac{a \cdot 0.5}{b}}\right)}^{-1} \]
      Step-by-step derivation

      [Start]98.2

      \[ {\left(-3 \cdot \left(0.5 \cdot \frac{a}{b}\right)\right)}^{-1} \]

      *-commutative [=>]98.2

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

      associate-*l/ [=>]98.2

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

    if -1.3499999999999999e130 < b < -5.4999999999999997e-125

    1. Initial program 95.8%

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

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

      [Start]95.8

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

      /-rgt-identity [<=]95.8

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

      metadata-eval [<=]95.8

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

      associate-/r/ [=>]95.8

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

      metadata-eval [=>]95.8

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

      metadata-eval [<=]95.8

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

      times-frac [<=]95.8

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

      *-commutative [<=]95.8

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

      times-frac [=>]95.8

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

      *-commutative [<=]95.8

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

      associate-/r* [=>]95.9

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

      associate-*l/ [=>]96.0

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

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

      [Start]96.0

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

      fma-udef [=>]96.0

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

      associate-*l* [=>]96.0

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

    if -5.4999999999999997e-125 < b < 1.5999999999999999e-93

    1. Initial program 71.5%

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

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

      [Start]71.5

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

      /-rgt-identity [<=]71.5

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

      metadata-eval [<=]71.5

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

      associate-/r/ [=>]71.5

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

      metadata-eval [=>]71.5

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

      metadata-eval [<=]71.5

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

      times-frac [<=]71.5

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

      *-commutative [<=]71.5

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

      times-frac [=>]71.5

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

      *-commutative [<=]71.5

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

      associate-/r* [=>]71.4

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

      associate-*l/ [=>]71.5

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

      \[\leadsto \color{blue}{{\left(-3 \cdot \frac{a}{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}\right)}^{-1}} \]
      Step-by-step derivation

      [Start]71.5

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

      clear-num [=>]71.4

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

      inv-pow [=>]71.4

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

      *-un-lft-identity [=>]71.4

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

      times-frac [=>]71.4

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

      metadata-eval [=>]71.4

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

      fma-udef [=>]71.4

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

      add-sqr-sqrt [=>]71.4

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

      hypot-def [=>]79.3

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

      associate-*l* [=>]79.4

      \[ {\left(-3 \cdot \frac{a}{b - \mathsf{hypot}\left(b, \sqrt{\color{blue}{a \cdot \left(c \cdot -3\right)}}\right)}\right)}^{-1} \]
    4. Applied egg-rr79.4%

      \[\leadsto \color{blue}{\frac{\frac{b - \mathsf{hypot}\left(\sqrt{a \cdot \left(c \cdot -3\right)}, b\right)}{a}}{-3}} \]
      Step-by-step derivation

      [Start]79.4

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

      unpow-1 [=>]79.4

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

      *-commutative [=>]79.4

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

      associate-/r* [=>]79.3

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

      clear-num [<=]79.4

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

      hypot-udef [=>]71.5

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

      add-sqr-sqrt [<=]71.5

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

      +-commutative [=>]71.5

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

      add-sqr-sqrt [=>]71.5

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

      hypot-def [=>]79.4

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

    if 1.5999999999999999e-93 < b

    1. Initial program 20.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{+130}:\\ \;\;\;\;{\left(-3 \cdot \frac{a \cdot 0.5}{b}\right)}^{-1}\\ \mathbf{elif}\;b \leq -5.5 \cdot 10^{-125}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b + a \cdot \left(-3 \cdot c\right)}\right)}{a}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-93}:\\ \;\;\;\;\frac{\frac{b - \mathsf{hypot}\left(\sqrt{a \cdot \left(-3 \cdot c\right)}, b\right)}{a}}{-3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy86.0%
Cost13964
\[\begin{array}{l} t_0 := a \cdot \left(-3 \cdot c\right)\\ \mathbf{if}\;b \leq -1.75 \cdot 10^{+130}:\\ \;\;\;\;{\left(-3 \cdot \frac{a \cdot 0.5}{b}\right)}^{-1}\\ \mathbf{elif}\;b \leq -3 \cdot 10^{-125}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b + t_0}\right)}{a}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-93}:\\ \;\;\;\;\frac{-0.3333333333333333}{\frac{a}{b - \mathsf{hypot}\left(\sqrt{t_0}, b\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 2
Accuracy86.0%
Cost13964
\[\begin{array}{l} t_0 := a \cdot \left(-3 \cdot c\right)\\ \mathbf{if}\;b \leq -1.1 \cdot 10^{+129}:\\ \;\;\;\;{\left(-3 \cdot \frac{a \cdot 0.5}{b}\right)}^{-1}\\ \mathbf{elif}\;b \leq -1.2 \cdot 10^{-124}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b + t_0}\right)}{a}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-93}:\\ \;\;\;\;\frac{\frac{b - \mathsf{hypot}\left(b, \sqrt{t_0}\right)}{-3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 3
Accuracy85.6%
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -1.55 \cdot 10^{+126}:\\ \;\;\;\;{\left(-3 \cdot \frac{a \cdot 0.5}{b}\right)}^{-1}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-93}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{b \cdot b + a \cdot \left(-3 \cdot c\right)}\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 4
Accuracy80.5%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -7 \cdot 10^{-124}:\\ \;\;\;\;\frac{0.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-93}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{a \cdot \left(-3 \cdot c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 5
Accuracy80.5%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -6.2 \cdot 10^{-124}:\\ \;\;\;\;\frac{0.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-93}:\\ \;\;\;\;\left(\sqrt{a \cdot \left(-3 \cdot c\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 6
Accuracy80.5%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -7 \cdot 10^{-124}:\\ \;\;\;\;\frac{0.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-93}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{c \cdot \left(-3 \cdot a\right)}\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 7
Accuracy80.5%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -6.4 \cdot 10^{-124}:\\ \;\;\;\;\frac{0.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-93}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(-3 \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 8
Accuracy68.1%
Cost964
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{c}{b} \cdot -1.5 + 2 \cdot \frac{b}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 9
Accuracy68.1%
Cost836
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 10
Accuracy68.0%
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 11
Accuracy47.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 12
Accuracy68.0%
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 13
Accuracy68.0%
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 14
Accuracy68.0%
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
Alternative 15
Accuracy34.4%
Cost320
\[-0.5 \cdot \frac{c}{b} \]

Reproduce?

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