?

Average Accuracy: 47.0% → 86.9%
Time: 17.0s
Precision: binary64
Cost: 14028

?

\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\begin{array}{l} \mathbf{if}\;b \leq -3.1 \cdot 10^{+83}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -6 \cdot 10^{-308}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 6.8 \cdot 10^{-24}:\\ \;\;\;\;\frac{c \cdot \left(-2\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (if (<= b -3.1e+83)
   (/ (- b) a)
   (if (<= b -6e-308)
     (/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.0))
     (if (<= b 6.8e-24)
       (/ (* c (- 2.0)) (+ b (hypot b (sqrt (* c (* a -4.0))))))
       (/ (- c) b)))))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
	double tmp;
	if (b <= -3.1e+83) {
		tmp = -b / a;
	} else if (b <= -6e-308) {
		tmp = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	} else if (b <= 6.8e-24) {
		tmp = (c * -2.0) / (b + hypot(b, sqrt((c * (a * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -3.1e+83) {
		tmp = -b / a;
	} else if (b <= -6e-308) {
		tmp = (Math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	} else if (b <= 6.8e-24) {
		tmp = (c * -2.0) / (b + Math.hypot(b, Math.sqrt((c * (a * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
def code(a, b, c):
	tmp = 0
	if b <= -3.1e+83:
		tmp = -b / a
	elif b <= -6e-308:
		tmp = (math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0)
	elif b <= 6.8e-24:
		tmp = (c * -2.0) / (b + math.hypot(b, math.sqrt((c * (a * -4.0)))))
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function code(a, b, c)
	tmp = 0.0
	if (b <= -3.1e+83)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= -6e-308)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - b) / Float64(a * 2.0));
	elseif (b <= 6.8e-24)
		tmp = Float64(Float64(c * Float64(-2.0)) / Float64(b + hypot(b, sqrt(Float64(c * Float64(a * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -3.1e+83)
		tmp = -b / a;
	elseif (b <= -6e-308)
		tmp = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	elseif (b <= 6.8e-24)
		tmp = (c * -2.0) / (b + hypot(b, sqrt((c * (a * -4.0)))));
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := If[LessEqual[b, -3.1e+83], N[((-b) / a), $MachinePrecision], If[LessEqual[b, -6e-308], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.8e-24], N[(N[(c * (-2.0)), $MachinePrecision] / N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{+83}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq -6 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\

\mathbf{elif}\;b \leq 6.8 \cdot 10^{-24}:\\
\;\;\;\;\frac{c \cdot \left(-2\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}\\

\mathbf{else}:\\
\;\;\;\;\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 4 regimes
  2. if b < -3.09999999999999992e83

    1. Initial program 33.4%

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

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

      [Start]33.4

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

      neg-sub0 [=>]33.4

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

      associate-+l- [=>]33.4

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

      sub0-neg [=>]33.4

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

      neg-mul-1 [=>]33.4

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

      associate-*l/ [<=]33.3

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

      *-commutative [=>]33.3

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

      associate-/r* [=>]33.3

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

      /-rgt-identity [<=]33.3

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

      metadata-eval [<=]33.3

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Simplified93.5%

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

      [Start]93.5

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

      associate-*r/ [=>]93.5

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

      mul-1-neg [=>]93.5

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

    if -3.09999999999999992e83 < b < -6.00000000000000044e-308

    1. Initial program 85.9%

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

    if -6.00000000000000044e-308 < b < 6.79999999999999985e-24

    1. Initial program 61.6%

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

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

      [Start]61.6

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

      neg-sub0 [=>]61.6

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

      associate-+l- [=>]61.6

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

      sub0-neg [=>]61.6

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

      neg-mul-1 [=>]61.6

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

      associate-*l/ [<=]61.5

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

      *-commutative [=>]61.5

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

      associate-/r* [=>]61.5

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

      /-rgt-identity [<=]61.5

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

      metadata-eval [<=]61.5

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

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

      [Start]61.5

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

      fma-udef [=>]61.5

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

      add-sqr-sqrt [=>]60.3

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

      hypot-def [=>]60.3

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

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

      [Start]60.3

      \[ \left(b - \mathsf{hypot}\left(\sqrt{a \cdot \left(c \cdot -4\right)}, b\right)\right) \cdot \frac{-0.5}{a} \]

      associate-*r* [=>]60.3

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

      *-commutative [<=]60.3

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

      associate-*l* [=>]60.3

      \[ \left(b - \mathsf{hypot}\left(\sqrt{\color{blue}{c \cdot \left(a \cdot -4\right)}}, b\right)\right) \cdot \frac{-0.5}{a} \]
    5. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b \cdot b - \mathsf{fma}\left(b, b, \left(c \cdot -4\right) \cdot a\right)}{\left(a \cdot -2\right) \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{\left(c \cdot -4\right) \cdot a}\right)\right)}} \]
      Proof

      [Start]60.3

      \[ \left(b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)\right) \cdot \frac{-0.5}{a} \]

      *-commutative [=>]60.3

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

      clear-num [=>]60.3

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

      flip-- [=>]60.3

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

      frac-times [=>]50.9

      \[ \color{blue}{\frac{1 \cdot \left(b \cdot b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right) \cdot \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)\right)}{\frac{a}{-0.5} \cdot \left(b + \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)\right)}} \]
    6. Simplified54.8%

      \[\leadsto \color{blue}{\frac{\frac{-0.5}{a}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \left(-c \cdot \left(a \cdot -4\right)\right)} \]
      Proof

      [Start]50.9

      \[ \frac{b \cdot b - \mathsf{fma}\left(b, b, \left(c \cdot -4\right) \cdot a\right)}{\left(a \cdot -2\right) \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{\left(c \cdot -4\right) \cdot a}\right)\right)} \]

      *-lft-identity [<=]50.9

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

      times-frac [=>]60.2

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

      *-commutative [=>]60.2

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

      associate-/r* [=>]60.2

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

      metadata-eval [=>]60.2

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

      associate-*r/ [=>]60.3

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

      associate-/l* [=>]60.2

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

      associate-/r/ [=>]50.9

      \[ \color{blue}{\frac{\frac{-0.5}{a}}{b + \mathsf{hypot}\left(b, \sqrt{\left(c \cdot -4\right) \cdot a}\right)} \cdot \left(b \cdot b - \mathsf{fma}\left(b, b, \left(c \cdot -4\right) \cdot a\right)\right)} \]
    7. Applied egg-rr54.2%

      \[\leadsto \color{blue}{0 - \frac{-0.5}{a \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(-4 \cdot c\right)}\right)\right)} \cdot \left(a \cdot \left(-4 \cdot c\right)\right)} \]
      Proof

      [Start]54.8

      \[ \frac{\frac{-0.5}{a}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \left(-c \cdot \left(a \cdot -4\right)\right) \]

      distribute-rgt-neg-out [=>]54.8

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

      neg-sub0 [=>]54.8

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

      associate-/l/ [=>]54.2

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

      *-commutative [=>]54.2

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

      *-commutative [=>]54.2

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

      associate-*l* [=>]54.2

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

      *-commutative [=>]54.2

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

      associate-*l* [=>]54.2

      \[ 0 - \frac{-0.5}{a \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(-4 \cdot c\right)}\right)\right)} \cdot \color{blue}{\left(a \cdot \left(-4 \cdot c\right)\right)} \]
    8. Simplified78.2%

      \[\leadsto \color{blue}{-\frac{c \cdot 2}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}} \]
      Proof

      [Start]54.2

      \[ 0 - \frac{-0.5}{a \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(-4 \cdot c\right)}\right)\right)} \cdot \left(a \cdot \left(-4 \cdot c\right)\right) \]

      neg-sub0 [<=]54.2

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

      associate-*l/ [=>]55.0

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

      *-commutative [=>]55.0

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

      times-frac [=>]65.3

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

      associate-*r/ [=>]65.4

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

      *-commutative [=>]65.4

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

      associate-/l* [=>]78.3

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

      *-inverses [=>]78.3

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

      /-rgt-identity [=>]78.3

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

      *-commutative [=>]78.3

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

      rem-square-sqrt [<=]0.0

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

      unpow2 [<=]0.0

      \[ -\frac{\left(c \cdot \color{blue}{{\left(\sqrt{-4}\right)}^{2}}\right) \cdot -0.5}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(-4 \cdot c\right)}\right)} \]

      associate-*l* [=>]0.0

      \[ -\frac{\color{blue}{c \cdot \left({\left(\sqrt{-4}\right)}^{2} \cdot -0.5\right)}}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(-4 \cdot c\right)}\right)} \]

      unpow2 [=>]0.0

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

      rem-square-sqrt [=>]78.3

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

      metadata-eval [=>]78.3

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

      associate-*r* [=>]78.2

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

      *-commutative [=>]78.2

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

    if 6.79999999999999985e-24 < b

    1. Initial program 14.4%

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

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

      [Start]14.4

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

      neg-sub0 [=>]14.4

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

      associate-+l- [=>]14.4

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

      sub0-neg [=>]14.4

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

      neg-mul-1 [=>]14.4

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

      associate-*l/ [<=]14.4

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

      *-commutative [=>]14.4

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

      associate-/r* [=>]14.4

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

      /-rgt-identity [<=]14.4

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

      metadata-eval [<=]14.4

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Simplified89.3%

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
      Proof

      [Start]89.3

      \[ -1 \cdot \frac{c}{b} \]

      associate-*r/ [=>]89.3

      \[ \color{blue}{\frac{-1 \cdot c}{b}} \]

      mul-1-neg [=>]89.3

      \[ \frac{\color{blue}{-c}}{b} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification86.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.1 \cdot 10^{+83}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -6 \cdot 10^{-308}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 6.8 \cdot 10^{-24}:\\ \;\;\;\;\frac{c \cdot \left(-2\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy84.1%
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -4.7 \cdot 10^{+83}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{-70}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 2
Accuracy78.7%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -1.05 \cdot 10^{-67}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 1.16 \cdot 10^{-68}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 3
Accuracy64.9%
Cost708
\[\begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{-281}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
Alternative 4
Accuracy38.5%
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq 1.9 \cdot 10^{+19}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]
Alternative 5
Accuracy64.9%
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq 1.4 \cdot 10^{-252}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 6
Accuracy2.6%
Cost192
\[\frac{b}{a} \]
Alternative 7
Accuracy11.7%
Cost192
\[\frac{c}{b} \]

Error

Reproduce?

herbie shell --seed 2023147 
(FPCore (a b c)
  :name "Quadratic roots, full range"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))