The quadratic formula (r2)

Percentage Accurate: 52.1% → 85.8%
Time: 10.4s
Alternatives: 7
Speedup: 19.1×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
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) - (4.0d0 * (a * c))))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b - Math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
def code(a, b, c):
	return (-b - math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 52.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
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) - (4.0d0 * (a * c))))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b - Math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
def code(a, b, c):
	return (-b - math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}

Alternative 1: 85.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{-91}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{+74}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.3e-91)
   (/ (- c) b)
   (if (<= b 1.5e+74)
     (* -0.5 (/ (+ b (sqrt (- (* b b) (* c (* a 4.0))))) a))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.3e-91) {
		tmp = -c / b;
	} else if (b <= 1.5e+74) {
		tmp = -0.5 * ((b + sqrt(((b * b) - (c * (a * 4.0))))) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
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.3d-91)) then
        tmp = -c / b
    else if (b <= 1.5d+74) then
        tmp = (-0.5d0) * ((b + sqrt(((b * b) - (c * (a * 4.0d0))))) / a)
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.3e-91) {
		tmp = -c / b;
	} else if (b <= 1.5e+74) {
		tmp = -0.5 * ((b + Math.sqrt(((b * b) - (c * (a * 4.0))))) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.3e-91:
		tmp = -c / b
	elif b <= 1.5e+74:
		tmp = -0.5 * ((b + math.sqrt(((b * b) - (c * (a * 4.0))))) / a)
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.3e-91)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 1.5e+74)
		tmp = Float64(-0.5 * Float64(Float64(b + sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0))))) / a));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.3e-91)
		tmp = -c / b;
	elseif (b <= 1.5e+74)
		tmp = -0.5 * ((b + sqrt(((b * b) - (c * (a * 4.0))))) / a);
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.3e-91], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 1.5e+74], N[(-0.5 * N[(N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{-91}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 1.5 \cdot 10^{+74}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.30000000000000007e-91

    1. Initial program 17.7%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified17.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. mul-1-neg86.3%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac86.3%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    6. Simplified86.3%

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

    if -1.30000000000000007e-91 < b < 1.5e74

    1. Initial program 84.1%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. sub-neg84.1%

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{2 \cdot a} \]
      2. distribute-neg-out84.1%

        \[\leadsto \frac{\color{blue}{-\left(b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{2 \cdot a} \]
      3. neg-mul-184.1%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{2 \cdot a} \]
      4. times-frac84.1%

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a}} \]
      5. metadata-eval84.1%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a} \]
      6. remove-double-neg84.1%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\left(-\left(-b\right)\right)} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a} \]
      7. neg-sub084.1%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\left(0 - \left(-b\right)\right)} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a} \]
      8. associate-+l-84.1%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0 - \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{a} \]
    3. Simplified84.2%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)}}{a}} \]
    4. Step-by-step derivation
      1. fma-udef84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{b \cdot b + \left(a \cdot c\right) \cdot -4}}}{a} \]
      2. *-commutative84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b + \color{blue}{-4 \cdot \left(a \cdot c\right)}}}{a} \]
      3. metadata-eval84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b + \color{blue}{\left(-4\right)} \cdot \left(a \cdot c\right)}}{a} \]
      4. cancel-sign-sub-inv84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}{a} \]
      5. associate-*l*84.2%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{a} \]
      6. prod-diff83.9%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(4 \cdot a\right)\right) + \mathsf{fma}\left(-c, 4 \cdot a, c \cdot \left(4 \cdot a\right)\right)}}}{a} \]
      7. *-commutative83.9%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(4 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-c, 4 \cdot a, c \cdot \left(4 \cdot a\right)\right)}}{a} \]
      8. fma-neg83.9%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)} + \mathsf{fma}\left(-c, 4 \cdot a, c \cdot \left(4 \cdot a\right)\right)}}{a} \]
      9. associate-+l-83.9%

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

      \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{b \cdot b - \left(a \cdot \left(c \cdot -4\right) - \left(a \cdot \left(c \cdot -4\right) + a \cdot \left(c \cdot -4\right)\right)\right)}}}{a} \]
    6. Step-by-step derivation
      1. associate--r+83.9%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(\color{blue}{0} - a \cdot \left(c \cdot -4\right)\right)}}{a} \]
      3. neg-sub084.2%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{\left(-a \cdot \left(c \cdot -4\right)\right)}}}{a} \]
      4. associate-*r*84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(-\color{blue}{\left(a \cdot c\right) \cdot -4}\right)}}{a} \]
      5. distribute-rgt-neg-in84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{\left(a \cdot c\right) \cdot \left(--4\right)}}}{a} \]
      6. metadata-eval84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(a \cdot c\right) \cdot \color{blue}{4}}}{a} \]
      7. *-commutative84.1%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{\left(c \cdot a\right)} \cdot 4}}{a} \]
      8. associate-*r*84.2%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{c \cdot \left(a \cdot 4\right)}}}{a} \]
    7. Simplified84.2%

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

    if 1.5e74 < b

    1. Initial program 55.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative55.8%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg55.8%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative55.8%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg55.8%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*55.8%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative55.8%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified55.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    5. Step-by-step derivation
      1. +-commutative95.8%

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      2. mul-1-neg95.8%

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg95.8%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified95.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{-91}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{+74}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 2: 80.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{-91}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 7.9:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.3e-91)
   (/ (- c) b)
   (if (<= b 7.9)
     (* -0.5 (/ (+ b (sqrt (* a (* c -4.0)))) a))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.3e-91) {
		tmp = -c / b;
	} else if (b <= 7.9) {
		tmp = -0.5 * ((b + sqrt((a * (c * -4.0)))) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
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.3d-91)) then
        tmp = -c / b
    else if (b <= 7.9d0) then
        tmp = (-0.5d0) * ((b + sqrt((a * (c * (-4.0d0))))) / a)
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.3e-91) {
		tmp = -c / b;
	} else if (b <= 7.9) {
		tmp = -0.5 * ((b + Math.sqrt((a * (c * -4.0)))) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2.3e-91:
		tmp = -c / b
	elif b <= 7.9:
		tmp = -0.5 * ((b + math.sqrt((a * (c * -4.0)))) / a)
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.3e-91)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 7.9)
		tmp = Float64(-0.5 * Float64(Float64(b + sqrt(Float64(a * Float64(c * -4.0)))) / a));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.3e-91)
		tmp = -c / b;
	elseif (b <= 7.9)
		tmp = -0.5 * ((b + sqrt((a * (c * -4.0)))) / a);
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-91], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 7.9], N[(-0.5 * N[(N[(b + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-91}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 7.9:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -2.29999999999999996e-91

    1. Initial program 17.7%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative17.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified17.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. mul-1-neg86.3%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac86.3%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    6. Simplified86.3%

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

    if -2.29999999999999996e-91 < b < 7.9000000000000004

    1. Initial program 82.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. sub-neg82.5%

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{2 \cdot a} \]
      2. distribute-neg-out82.5%

        \[\leadsto \frac{\color{blue}{-\left(b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{2 \cdot a} \]
      3. neg-mul-182.5%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{2 \cdot a} \]
      4. times-frac82.5%

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a}} \]
      5. metadata-eval82.5%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a} \]
      6. remove-double-neg82.5%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\left(-\left(-b\right)\right)} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a} \]
      7. neg-sub082.5%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\left(0 - \left(-b\right)\right)} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a} \]
      8. associate-+l-82.5%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0 - \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}}{a} \]
    3. Simplified82.6%

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

      \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)}}}{a} \]
    5. Step-by-step derivation
      1. *-commutative74.9%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4}}}{a} \]
      2. associate-*r*74.9%

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{a \cdot \left(c \cdot -4\right)}}}{a} \]
    6. Simplified74.9%

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

    if 7.9000000000000004 < b

    1. Initial program 62.7%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative62.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg62.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative62.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg62.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*62.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative62.7%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified62.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    5. Step-by-step derivation
      1. +-commutative94.3%

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      2. mul-1-neg94.3%

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg94.3%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified94.3%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{-91}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 7.9:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 3: 67.2% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5e-310) (/ (- c) b) (- (/ c b) (/ b a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-310) {
		tmp = -c / b;
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
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 <= (-5d-310)) then
        tmp = -c / b
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-310) {
		tmp = -c / b;
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5e-310:
		tmp = -c / b
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e-310)
		tmp = Float64(Float64(-c) / b);
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -5e-310)
		tmp = -c / b;
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[((-c) / b), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -4.999999999999985e-310

    1. Initial program 34.2%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative34.2%

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

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative34.2%

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

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*34.2%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative34.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. mul-1-neg66.8%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac66.8%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    6. Simplified66.8%

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

    if -4.999999999999985e-310 < b

    1. Initial program 72.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative72.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    5. Step-by-step derivation
      1. +-commutative66.0%

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      2. mul-1-neg66.0%

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg66.0%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified66.0%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 4: 41.0% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.4 \cdot 10^{+84}:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c) :precision binary64 (if (<= b -4.4e+84) (/ c b) (/ (- b) a)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.4e+84) {
		tmp = c / b;
	} else {
		tmp = -b / a;
	}
	return tmp;
}
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 <= (-4.4d+84)) then
        tmp = c / b
    else
        tmp = -b / a
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.4e+84) {
		tmp = c / b;
	} else {
		tmp = -b / a;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -4.4e+84:
		tmp = c / b
	else:
		tmp = -b / a
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -4.4e+84)
		tmp = Float64(c / b);
	else
		tmp = Float64(Float64(-b) / a);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -4.4e+84)
		tmp = c / b;
	else
		tmp = -b / a;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -4.4e+84], N[(c / b), $MachinePrecision], N[((-b) / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.4 \cdot 10^{+84}:\\
\;\;\;\;\frac{c}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -4.3999999999999997e84

    1. Initial program 13.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative13.6%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg13.6%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative13.6%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg13.6%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*13.6%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative13.6%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified13.6%

      \[\leadsto \color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. clear-num13.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
      2. associate-/r/13.6%

        \[\leadsto \color{blue}{\frac{1}{a \cdot 2} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      3. *-commutative13.6%

        \[\leadsto \frac{1}{\color{blue}{2 \cdot a}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      4. associate-/r*13.6%

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{a}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      5. metadata-eval13.6%

        \[\leadsto \frac{\color{blue}{0.5}}{a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      6. add-sqr-sqrt7.9%

        \[\leadsto \frac{0.5}{a} \cdot \left(\left(-b\right) - \color{blue}{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\right) \]
      7. cancel-sign-sub-inv7.9%

        \[\leadsto \frac{0.5}{a} \cdot \color{blue}{\left(\left(-b\right) + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} \]
      8. add-sqr-sqrt13.6%

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{-b} \cdot \sqrt{-b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
      9. sqrt-unprod6.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
      10. sqr-neg6.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(\sqrt{\color{blue}{b \cdot b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
      11. sqrt-prod0.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
      12. add-sqr-sqrt4.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{b} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    5. Applied egg-rr3.7%

      \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)} \]
    6. Taylor expanded in b around inf 0.0%

      \[\leadsto \color{blue}{-0.25 \cdot \frac{c \cdot {\left(\sqrt{-4}\right)}^{2}}{b}} \]
    7. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{-0.25 \cdot \left(c \cdot {\left(\sqrt{-4}\right)}^{2}\right)}{b}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{-0.25 \cdot \color{blue}{\left({\left(\sqrt{-4}\right)}^{2} \cdot c\right)}}{b} \]
      3. unpow20.0%

        \[\leadsto \frac{-0.25 \cdot \left(\color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)} \cdot c\right)}{b} \]
      4. rem-square-sqrt28.6%

        \[\leadsto \frac{-0.25 \cdot \left(\color{blue}{-4} \cdot c\right)}{b} \]
      5. associate-*r*28.6%

        \[\leadsto \frac{\color{blue}{\left(-0.25 \cdot -4\right) \cdot c}}{b} \]
      6. metadata-eval28.6%

        \[\leadsto \frac{\color{blue}{1} \cdot c}{b} \]
      7. *-lft-identity28.6%

        \[\leadsto \frac{\color{blue}{c}}{b} \]
    8. Simplified28.6%

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

    if -4.3999999999999997e84 < b

    1. Initial program 65.1%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative65.1%

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

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

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

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*65.1%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative65.1%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    5. Step-by-step derivation
      1. associate-*r/44.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
      2. mul-1-neg44.7%

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified44.7%

      \[\leadsto \color{blue}{\frac{-b}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.4 \cdot 10^{+84}:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 5: 67.1% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.7 \cdot 10^{-307}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.7e-307) (/ (- c) b) (/ (- b) a)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.7e-307) {
		tmp = -c / b;
	} else {
		tmp = -b / a;
	}
	return tmp;
}
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.7d-307)) then
        tmp = -c / b
    else
        tmp = -b / a
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.7e-307) {
		tmp = -c / b;
	} else {
		tmp = -b / a;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2.7e-307:
		tmp = -c / b
	else:
		tmp = -b / a
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.7e-307)
		tmp = Float64(Float64(-c) / b);
	else
		tmp = Float64(Float64(-b) / a);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.7e-307)
		tmp = -c / b;
	else
		tmp = -b / a;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-307], N[((-c) / b), $MachinePrecision], N[((-b) / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-307}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -2.69999999999999985e-307

    1. Initial program 34.2%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative34.2%

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

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative34.2%

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

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*34.2%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative34.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. mul-1-neg66.8%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac66.8%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    6. Simplified66.8%

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

    if -2.69999999999999985e-307 < b

    1. Initial program 72.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
      3. *-commutative72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\left(-b\right) \cdot \left(-b\right) - 4 \cdot \color{blue}{\left(a \cdot c\right)}}}{2 \cdot a} \]
      4. sqr-neg72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      5. associate-*r*72.5%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
      6. *-commutative72.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    5. Step-by-step derivation
      1. associate-*r/65.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
      2. mul-1-neg65.7%

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified65.7%

      \[\leadsto \color{blue}{\frac{-b}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.7 \cdot 10^{-307}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 6: 2.6% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{b}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ b a))
double code(double a, double b, double c) {
	return b / a;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = b / a
end function
public static double code(double a, double b, double c) {
	return b / a;
}
def code(a, b, c):
	return b / a
function code(a, b, c)
	return Float64(b / a)
end
function tmp = code(a, b, c)
	tmp = b / a;
end
code[a_, b_, c_] := N[(b / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{b}{a}
\end{array}
Derivation
  1. Initial program 54.4%

    \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative54.4%

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

      \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
    3. *-commutative54.4%

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

      \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    5. associate-*r*54.4%

      \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
    6. *-commutative54.4%

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Step-by-step derivation
    1. clear-num54.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
    2. associate-/r/54.4%

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

      \[\leadsto \frac{1}{\color{blue}{2 \cdot a}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
    4. associate-/r*54.4%

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{a}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
    5. metadata-eval54.4%

      \[\leadsto \frac{\color{blue}{0.5}}{a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
    6. add-sqr-sqrt52.9%

      \[\leadsto \frac{0.5}{a} \cdot \left(\left(-b\right) - \color{blue}{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\right) \]
    7. cancel-sign-sub-inv52.9%

      \[\leadsto \frac{0.5}{a} \cdot \color{blue}{\left(\left(-b\right) + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} \]
    8. add-sqr-sqrt16.0%

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

      \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    10. sqr-neg30.4%

      \[\leadsto \frac{0.5}{a} \cdot \left(\sqrt{\color{blue}{b \cdot b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    11. sqrt-prod24.0%

      \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    12. add-sqr-sqrt37.7%

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

    \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)} \]
  6. Taylor expanded in b around -inf 2.7%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  7. Final simplification2.7%

    \[\leadsto \frac{b}{a} \]

Alternative 7: 10.4% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{c}{b} \end{array} \]
(FPCore (a b c) :precision binary64 (/ c b))
double code(double a, double b, double c) {
	return c / b;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = c / b
end function
public static double code(double a, double b, double c) {
	return c / b;
}
def code(a, b, c):
	return c / b
function code(a, b, c)
	return Float64(c / b)
end
function tmp = code(a, b, c)
	tmp = c / b;
end
code[a_, b_, c_] := N[(c / b), $MachinePrecision]
\begin{array}{l}

\\
\frac{c}{b}
\end{array}
Derivation
  1. Initial program 54.4%

    \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative54.4%

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

      \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a} \]
    3. *-commutative54.4%

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

      \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    5. associate-*r*54.4%

      \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
    6. *-commutative54.4%

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Step-by-step derivation
    1. clear-num54.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
    2. associate-/r/54.4%

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

      \[\leadsto \frac{1}{\color{blue}{2 \cdot a}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
    4. associate-/r*54.4%

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{a}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
    5. metadata-eval54.4%

      \[\leadsto \frac{\color{blue}{0.5}}{a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
    6. add-sqr-sqrt52.9%

      \[\leadsto \frac{0.5}{a} \cdot \left(\left(-b\right) - \color{blue}{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\right) \]
    7. cancel-sign-sub-inv52.9%

      \[\leadsto \frac{0.5}{a} \cdot \color{blue}{\left(\left(-b\right) + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} \]
    8. add-sqr-sqrt16.0%

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

      \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    10. sqr-neg30.4%

      \[\leadsto \frac{0.5}{a} \cdot \left(\sqrt{\color{blue}{b \cdot b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    11. sqrt-prod24.0%

      \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \left(-\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \]
    12. add-sqr-sqrt37.7%

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

    \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)} \]
  6. Taylor expanded in b around inf 0.0%

    \[\leadsto \color{blue}{-0.25 \cdot \frac{c \cdot {\left(\sqrt{-4}\right)}^{2}}{b}} \]
  7. Step-by-step derivation
    1. associate-*r/0.0%

      \[\leadsto \color{blue}{\frac{-0.25 \cdot \left(c \cdot {\left(\sqrt{-4}\right)}^{2}\right)}{b}} \]
    2. *-commutative0.0%

      \[\leadsto \frac{-0.25 \cdot \color{blue}{\left({\left(\sqrt{-4}\right)}^{2} \cdot c\right)}}{b} \]
    3. unpow20.0%

      \[\leadsto \frac{-0.25 \cdot \left(\color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)} \cdot c\right)}{b} \]
    4. rem-square-sqrt8.3%

      \[\leadsto \frac{-0.25 \cdot \left(\color{blue}{-4} \cdot c\right)}{b} \]
    5. associate-*r*8.3%

      \[\leadsto \frac{\color{blue}{\left(-0.25 \cdot -4\right) \cdot c}}{b} \]
    6. metadata-eval8.3%

      \[\leadsto \frac{\color{blue}{1} \cdot c}{b} \]
    7. *-lft-identity8.3%

      \[\leadsto \frac{\color{blue}{c}}{b} \]
  8. Simplified8.3%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  9. Final simplification8.3%

    \[\leadsto \frac{c}{b} \]

Developer target: 70.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - t_0}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* 4.0 (* a c))))))
   (if (< b 0.0)
     (/ c (* a (/ (+ (- b) t_0) (* 2.0 a))))
     (/ (- (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (4.0 * (a * c))));
	double tmp;
	if (b < 0.0) {
		tmp = c / (a * ((-b + t_0) / (2.0 * a)));
	} else {
		tmp = (-b - t_0) / (2.0 * a);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b * b) - (4.0d0 * (a * c))))
    if (b < 0.0d0) then
        tmp = c / (a * ((-b + t_0) / (2.0d0 * a)))
    else
        tmp = (-b - t_0) / (2.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - (4.0 * (a * c))));
	double tmp;
	if (b < 0.0) {
		tmp = c / (a * ((-b + t_0) / (2.0 * a)));
	} else {
		tmp = (-b - t_0) / (2.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - (4.0 * (a * c))))
	tmp = 0
	if b < 0.0:
		tmp = c / (a * ((-b + t_0) / (2.0 * a)))
	else:
		tmp = (-b - t_0) / (2.0 * a)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))
	tmp = 0.0
	if (b < 0.0)
		tmp = Float64(c / Float64(a * Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a))));
	else
		tmp = Float64(Float64(Float64(-b) - t_0) / Float64(2.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((b * b) - (4.0 * (a * c))));
	tmp = 0.0;
	if (b < 0.0)
		tmp = c / (a * ((-b + t_0) / (2.0 * a)));
	else
		tmp = (-b - t_0) / (2.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Less[b, 0.0], N[(c / N[(a * N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{2 \cdot a}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023293 
(FPCore (a b c)
  :name "The quadratic formula (r2)"
  :precision binary64

  :herbie-target
  (if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))

  (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))