quadp (p42, positive)

Percentage Accurate: 51.7% → 85.6%
Time: 15.8s
Alternatives: 9
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 9 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: 51.7% 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.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+141}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-79}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e+141)
   (/ (- b) a)
   (if (<= b 3e-79)
     (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+141) {
		tmp = -b / a;
	} else if (b <= 3e-79) {
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-1d+141)) then
        tmp = -b / a
    else if (b <= 3d-79) then
        tmp = (sqrt(((b * b) - (4.0d0 * (a * c)))) - b) / (a * 2.0d0)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+141) {
		tmp = -b / a;
	} else if (b <= 3e-79) {
		tmp = (Math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1e+141:
		tmp = -b / a
	elif b <= 3e-79:
		tmp = (math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e+141)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 3e-79)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e+141)
		tmp = -b / a;
	elseif (b <= 3e-79)
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1e+141], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3e-79], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+141}:\\
\;\;\;\;\frac{-b}{a}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.00000000000000002e141

    1. Initial program 41.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. *-commutative41.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified91.1%

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

    if -1.00000000000000002e141 < b < 3e-79

    1. Initial program 80.6%

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

    if 3e-79 < b

    1. Initial program 12.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. associate-*r/87.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-187.9%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+141}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-79}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\ \mathbf{if}\;b \leq -4 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -5.6 \cdot 10^{-76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq -6.5 \cdot 10^{-97}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 1.28 \cdot 10^{-76}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ (+ b (sqrt (* c (* a -4.0)))) a))))
   (if (<= b -4e-59)
     (- (/ c b) (/ b a))
     (if (<= b -5.6e-76)
       t_0
       (if (<= b -6.5e-97)
         (/ (- b) a)
         (if (<= b 1.28e-76) t_0 (/ (- c) b)))))))
double code(double a, double b, double c) {
	double t_0 = 0.5 * ((b + sqrt((c * (a * -4.0)))) / a);
	double tmp;
	if (b <= -4e-59) {
		tmp = (c / b) - (b / a);
	} else if (b <= -5.6e-76) {
		tmp = t_0;
	} else if (b <= -6.5e-97) {
		tmp = -b / a;
	} else if (b <= 1.28e-76) {
		tmp = t_0;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * ((b + sqrt((c * (a * (-4.0d0))))) / a)
    if (b <= (-4d-59)) then
        tmp = (c / b) - (b / a)
    else if (b <= (-5.6d-76)) then
        tmp = t_0
    else if (b <= (-6.5d-97)) then
        tmp = -b / a
    else if (b <= 1.28d-76) then
        tmp = t_0
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = 0.5 * ((b + Math.sqrt((c * (a * -4.0)))) / a);
	double tmp;
	if (b <= -4e-59) {
		tmp = (c / b) - (b / a);
	} else if (b <= -5.6e-76) {
		tmp = t_0;
	} else if (b <= -6.5e-97) {
		tmp = -b / a;
	} else if (b <= 1.28e-76) {
		tmp = t_0;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = 0.5 * ((b + math.sqrt((c * (a * -4.0)))) / a)
	tmp = 0
	if b <= -4e-59:
		tmp = (c / b) - (b / a)
	elif b <= -5.6e-76:
		tmp = t_0
	elif b <= -6.5e-97:
		tmp = -b / a
	elif b <= 1.28e-76:
		tmp = t_0
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	t_0 = Float64(0.5 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -4.0)))) / a))
	tmp = 0.0
	if (b <= -4e-59)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= -5.6e-76)
		tmp = t_0;
	elseif (b <= -6.5e-97)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 1.28e-76)
		tmp = t_0;
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = 0.5 * ((b + sqrt((c * (a * -4.0)))) / a);
	tmp = 0.0;
	if (b <= -4e-59)
		tmp = (c / b) - (b / a);
	elseif (b <= -5.6e-76)
		tmp = t_0;
	elseif (b <= -6.5e-97)
		tmp = -b / a;
	elseif (b <= 1.28e-76)
		tmp = t_0;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(0.5 * N[(N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4e-59], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5.6e-76], t$95$0, If[LessEqual[b, -6.5e-97], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 1.28e-76], t$95$0, N[((-c) / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\
\mathbf{if}\;b \leq -4 \cdot 10^{-59}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq -5.6 \cdot 10^{-76}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq -6.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 1.28 \cdot 10^{-76}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -4.0000000000000001e-59

    1. Initial program 71.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. *-commutative71.1%

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

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

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

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

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

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

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

    if -4.0000000000000001e-59 < b < -5.6000000000000002e-76 or -6.5000000000000004e-97 < b < 1.28e-76

    1. Initial program 72.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. *-commutative72.1%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{b} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1} \]
      8. fma-neg69.7%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}}\right)}^{-1} \]
      9. distribute-lft-neg-in69.7%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      10. *-commutative69.7%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \left(-4\right) \cdot \color{blue}{\left(c \cdot a\right)}\right)}}\right)}^{-1} \]
      11. associate-*r*69.7%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(-4\right) \cdot c\right) \cdot a}\right)}}\right)}^{-1} \]
      12. metadata-eval69.7%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \left(\color{blue}{-4} \cdot c\right) \cdot a\right)}}\right)}^{-1} \]
    6. Applied egg-rr69.7%

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

      \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)}}}\right)}^{-1} \]
    8. Step-by-step derivation
      1. associate-*r*69.7%

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

      \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{\left(-4 \cdot a\right) \cdot c}}}\right)}^{-1} \]
    10. Step-by-step derivation
      1. expm1-log1p-u45.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{a \cdot 2}{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}\right)}^{-1}\right)\right)} \]
      2. expm1-udef26.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{a \cdot 2}{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}\right)}^{-1}\right)} - 1} \]
      3. unpow-126.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\frac{a \cdot 2}{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}}}\right)} - 1 \]
      4. clear-num26.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}{a \cdot 2}}\right)} - 1 \]
      5. *-un-lft-identity26.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{1 \cdot \left(b + \sqrt{\left(-4 \cdot a\right) \cdot c}\right)}}{a \cdot 2}\right)} - 1 \]
      6. *-commutative26.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1 \cdot \left(b + \sqrt{\left(-4 \cdot a\right) \cdot c}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      7. times-frac26.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{2} \cdot \frac{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}{a}}\right)} - 1 \]
      8. metadata-eval26.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{0.5} \cdot \frac{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}{a}\right)} - 1 \]
      9. associate-*l*26.6%

        \[\leadsto e^{\mathsf{log1p}\left(0.5 \cdot \frac{b + \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)}}}{a}\right)} - 1 \]
    11. Applied egg-rr26.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(0.5 \cdot \frac{b + \sqrt{-4 \cdot \left(a \cdot c\right)}}{a}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def45.4%

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

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

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

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

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

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

    if -5.6000000000000002e-76 < b < -6.5000000000000004e-97

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified100.0%

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

    if 1.28e-76 < b

    1. Initial program 12.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. associate-*r/87.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-187.9%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -5.6 \cdot 10^{-76}:\\ \;\;\;\;0.5 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\ \mathbf{elif}\;b \leq -6.5 \cdot 10^{-97}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 1.28 \cdot 10^{-76}:\\ \;\;\;\;0.5 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b + \sqrt{c \cdot \left(a \cdot -4\right)}\\ \mathbf{if}\;b \leq -2 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -9.5 \cdot 10^{-76}:\\ \;\;\;\;\frac{0.5}{\frac{a}{t_0}}\\ \mathbf{elif}\;b \leq -4.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 3.2 \cdot 10^{-80}:\\ \;\;\;\;0.5 \cdot \frac{t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (+ b (sqrt (* c (* a -4.0))))))
   (if (<= b -2e-59)
     (- (/ c b) (/ b a))
     (if (<= b -9.5e-76)
       (/ 0.5 (/ a t_0))
       (if (<= b -4.6e-97)
         (/ (- b) a)
         (if (<= b 3.2e-80) (* 0.5 (/ t_0 a)) (/ (- c) b)))))))
double code(double a, double b, double c) {
	double t_0 = b + sqrt((c * (a * -4.0)));
	double tmp;
	if (b <= -2e-59) {
		tmp = (c / b) - (b / a);
	} else if (b <= -9.5e-76) {
		tmp = 0.5 / (a / t_0);
	} else if (b <= -4.6e-97) {
		tmp = -b / a;
	} else if (b <= 3.2e-80) {
		tmp = 0.5 * (t_0 / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = b + sqrt((c * (a * (-4.0d0))))
    if (b <= (-2d-59)) then
        tmp = (c / b) - (b / a)
    else if (b <= (-9.5d-76)) then
        tmp = 0.5d0 / (a / t_0)
    else if (b <= (-4.6d-97)) then
        tmp = -b / a
    else if (b <= 3.2d-80) then
        tmp = 0.5d0 * (t_0 / a)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = b + Math.sqrt((c * (a * -4.0)));
	double tmp;
	if (b <= -2e-59) {
		tmp = (c / b) - (b / a);
	} else if (b <= -9.5e-76) {
		tmp = 0.5 / (a / t_0);
	} else if (b <= -4.6e-97) {
		tmp = -b / a;
	} else if (b <= 3.2e-80) {
		tmp = 0.5 * (t_0 / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = b + math.sqrt((c * (a * -4.0)))
	tmp = 0
	if b <= -2e-59:
		tmp = (c / b) - (b / a)
	elif b <= -9.5e-76:
		tmp = 0.5 / (a / t_0)
	elif b <= -4.6e-97:
		tmp = -b / a
	elif b <= 3.2e-80:
		tmp = 0.5 * (t_0 / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	t_0 = Float64(b + sqrt(Float64(c * Float64(a * -4.0))))
	tmp = 0.0
	if (b <= -2e-59)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= -9.5e-76)
		tmp = Float64(0.5 / Float64(a / t_0));
	elseif (b <= -4.6e-97)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 3.2e-80)
		tmp = Float64(0.5 * Float64(t_0 / a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = b + sqrt((c * (a * -4.0)));
	tmp = 0.0;
	if (b <= -2e-59)
		tmp = (c / b) - (b / a);
	elseif (b <= -9.5e-76)
		tmp = 0.5 / (a / t_0);
	elseif (b <= -4.6e-97)
		tmp = -b / a;
	elseif (b <= 3.2e-80)
		tmp = 0.5 * (t_0 / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2e-59], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -9.5e-76], N[(0.5 / N[(a / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -4.6e-97], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3.2e-80], N[(0.5 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq -9.5 \cdot 10^{-76}:\\
\;\;\;\;\frac{0.5}{\frac{a}{t_0}}\\

\mathbf{elif}\;b \leq -4.6 \cdot 10^{-97}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 3.2 \cdot 10^{-80}:\\
\;\;\;\;0.5 \cdot \frac{t_0}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -2.0000000000000001e-59

    1. Initial program 71.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. *-commutative71.1%

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

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

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

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

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

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

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

    if -2.0000000000000001e-59 < b < -9.49999999999999984e-76

    1. Initial program 99.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. *-commutative99.2%

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1} \]
      7. add-sqr-sqrt88.3%

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

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}}\right)}^{-1} \]
      9. distribute-lft-neg-in88.3%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      10. *-commutative88.3%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \left(-4\right) \cdot \color{blue}{\left(c \cdot a\right)}\right)}}\right)}^{-1} \]
      11. associate-*r*88.3%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(-4\right) \cdot c\right) \cdot a}\right)}}\right)}^{-1} \]
      12. metadata-eval88.3%

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

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

      \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)}}}\right)}^{-1} \]
    8. Step-by-step derivation
      1. associate-*r*88.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{2 \cdot \frac{a}{b + \sqrt{-4 \cdot \left(a \cdot c\right)}}}} \]
    12. Step-by-step derivation
      1. associate-/r*88.3%

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

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

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

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

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

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

    if -9.49999999999999984e-76 < b < -4.59999999999999988e-97

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified100.0%

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

    if -4.59999999999999988e-97 < b < 3.1999999999999999e-80

    1. Initial program 69.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. *-commutative69.7%

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
      3. add-sqr-sqrt31.7%

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1} \]
      7. add-sqr-sqrt68.0%

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{b} + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1} \]
      8. fma-neg68.0%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}}\right)}^{-1} \]
      9. distribute-lft-neg-in68.0%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      10. *-commutative68.0%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \left(-4\right) \cdot \color{blue}{\left(c \cdot a\right)}\right)}}\right)}^{-1} \]
      11. associate-*r*68.0%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(-4\right) \cdot c\right) \cdot a}\right)}}\right)}^{-1} \]
      12. metadata-eval68.0%

        \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(b, b, \left(\color{blue}{-4} \cdot c\right) \cdot a\right)}}\right)}^{-1} \]
    6. Applied egg-rr68.0%

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

      \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)}}}\right)}^{-1} \]
    8. Step-by-step derivation
      1. associate-*r*68.0%

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

      \[\leadsto {\left(\frac{a \cdot 2}{b + \sqrt{\color{blue}{\left(-4 \cdot a\right) \cdot c}}}\right)}^{-1} \]
    10. Step-by-step derivation
      1. expm1-log1p-u44.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{a \cdot 2}{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}\right)}^{-1}\right)\right)} \]
      2. expm1-udef27.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{a \cdot 2}{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}\right)}^{-1}\right)} - 1} \]
      3. unpow-127.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\frac{a \cdot 2}{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}}}\right)} - 1 \]
      4. clear-num27.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}{a \cdot 2}}\right)} - 1 \]
      5. *-un-lft-identity27.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{1 \cdot \left(b + \sqrt{\left(-4 \cdot a\right) \cdot c}\right)}}{a \cdot 2}\right)} - 1 \]
      6. *-commutative27.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1 \cdot \left(b + \sqrt{\left(-4 \cdot a\right) \cdot c}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      7. times-frac27.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{2} \cdot \frac{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}{a}}\right)} - 1 \]
      8. metadata-eval27.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{0.5} \cdot \frac{b + \sqrt{\left(-4 \cdot a\right) \cdot c}}{a}\right)} - 1 \]
      9. associate-*l*27.5%

        \[\leadsto e^{\mathsf{log1p}\left(0.5 \cdot \frac{b + \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)}}}{a}\right)} - 1 \]
    11. Applied egg-rr27.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(0.5 \cdot \frac{b + \sqrt{-4 \cdot \left(a \cdot c\right)}}{a}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def44.7%

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

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

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

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

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

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

    if 3.1999999999999999e-80 < b

    1. Initial program 12.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. associate-*r/87.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-187.9%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -9.5 \cdot 10^{-76}:\\ \;\;\;\;\frac{0.5}{\frac{a}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}}\\ \mathbf{elif}\;b \leq -4.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 3.2 \cdot 10^{-80}:\\ \;\;\;\;0.5 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 80.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -1.52 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq -6.5 \cdot 10^{-97}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 3.6 \cdot 10^{-75}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0))))
   (if (<= b -1.52e-59)
     (- (/ c b) (/ b a))
     (if (<= b -3.8e-76)
       t_0
       (if (<= b -6.5e-97) (/ (- b) a) (if (<= b 3.6e-75) t_0 (/ (- c) b)))))))
double code(double a, double b, double c) {
	double t_0 = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	double tmp;
	if (b <= -1.52e-59) {
		tmp = (c / b) - (b / a);
	} else if (b <= -3.8e-76) {
		tmp = t_0;
	} else if (b <= -6.5e-97) {
		tmp = -b / a;
	} else if (b <= 3.6e-75) {
		tmp = t_0;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (sqrt((c * (a * (-4.0d0)))) - b) / (a * 2.0d0)
    if (b <= (-1.52d-59)) then
        tmp = (c / b) - (b / a)
    else if (b <= (-3.8d-76)) then
        tmp = t_0
    else if (b <= (-6.5d-97)) then
        tmp = -b / a
    else if (b <= 3.6d-75) then
        tmp = t_0
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (Math.sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	double tmp;
	if (b <= -1.52e-59) {
		tmp = (c / b) - (b / a);
	} else if (b <= -3.8e-76) {
		tmp = t_0;
	} else if (b <= -6.5e-97) {
		tmp = -b / a;
	} else if (b <= 3.6e-75) {
		tmp = t_0;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (math.sqrt((c * (a * -4.0))) - b) / (a * 2.0)
	tmp = 0
	if b <= -1.52e-59:
		tmp = (c / b) - (b / a)
	elif b <= -3.8e-76:
		tmp = t_0
	elif b <= -6.5e-97:
		tmp = -b / a
	elif b <= 3.6e-75:
		tmp = t_0
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0))
	tmp = 0.0
	if (b <= -1.52e-59)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= -3.8e-76)
		tmp = t_0;
	elseif (b <= -6.5e-97)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 3.6e-75)
		tmp = t_0;
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	tmp = 0.0;
	if (b <= -1.52e-59)
		tmp = (c / b) - (b / a);
	elseif (b <= -3.8e-76)
		tmp = t_0;
	elseif (b <= -6.5e-97)
		tmp = -b / a;
	elseif (b <= 3.6e-75)
		tmp = t_0;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.52e-59], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -3.8e-76], t$95$0, If[LessEqual[b, -6.5e-97], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3.6e-75], t$95$0, N[((-c) / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -1.52 \cdot 10^{-59}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq -3.8 \cdot 10^{-76}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq -6.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 3.6 \cdot 10^{-75}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.51999999999999998e-59

    1. Initial program 71.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. *-commutative71.1%

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

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

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

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

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

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

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

    if -1.51999999999999998e-59 < b < -3.8000000000000002e-76 or -6.5000000000000004e-97 < b < 3.6e-75

    1. Initial program 72.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. *-commutative72.1%

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around 0 70.4%

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

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

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

    if -3.8000000000000002e-76 < b < -6.5000000000000004e-97

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified100.0%

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

    if 3.6e-75 < b

    1. Initial program 12.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. associate-*r/87.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-187.9%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.52 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-76}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -6.5 \cdot 10^{-97}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 3.6 \cdot 10^{-75}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 67.9% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 75.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. *-commutative75.8%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 26.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. associate-*r/68.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-168.9%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified68.9%

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

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

Alternative 6: 42.9% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.2 \cdot 10^{+38}:\\
\;\;\;\;\frac{-b}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 7.19999999999999938e38

    1. Initial program 66.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. *-commutative66.2%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified41.2%

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

    if 7.19999999999999938e38 < b

    1. Initial program 7.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. *-commutative7.6%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(2 \cdot \frac{a \cdot c}{b} + -1 \cdot b\right)}}{a \cdot 2} \]
      2. mul-1-neg2.2%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(2 \cdot \frac{a \cdot c}{b} - b\right)}}{a \cdot 2} \]
      4. associate-/l*2.3%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(\frac{a \cdot 2}{\frac{b}{c}} - b\right)}}{a \cdot 2} \]
    8. Taylor expanded in b around 0 31.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 7.2 \cdot 10^{+38}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.7% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 75.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. *-commutative75.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified64.2%

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

    if -4.999999999999985e-310 < b

    1. Initial program 26.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. associate-*r/68.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-168.9%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified68.9%

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

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

Alternative 8: 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 48.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. *-commutative48.1%

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-sqr-sqrt47.1%

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

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

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

      \[\leadsto \frac{\left(-b\right) + {\color{blue}{\left({\left(b \cdot b - 4 \cdot \left(a \cdot c\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a \cdot 2} \]
    5. fma-neg47.1%

      \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
    6. distribute-lft-neg-in47.1%

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

      \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4\right) \cdot \color{blue}{\left(c \cdot a\right)}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
    8. associate-*r*47.1%

      \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \color{blue}{\left(\left(-4\right) \cdot c\right) \cdot a}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
    9. metadata-eval47.1%

      \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(\color{blue}{-4} \cdot c\right) \cdot a\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
    10. metadata-eval47.1%

      \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot c\right) \cdot a\right)\right)}^{\color{blue}{0.25}}\right)}^{2}}{a \cdot 2} \]
  6. Applied egg-rr47.1%

    \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot c\right) \cdot a\right)\right)}^{0.25}\right)}^{2}}}{a \cdot 2} \]
  7. Taylor expanded in b around -inf 29.2%

    \[\leadsto \color{blue}{2 \cdot \left(-0.5 \cdot \frac{b}{a}\right)} \]
  8. Step-by-step derivation
    1. associate-*r*29.2%

      \[\leadsto \color{blue}{\left(2 \cdot -0.5\right) \cdot \frac{b}{a}} \]
    2. metadata-eval29.2%

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

      \[\leadsto \color{blue}{-\frac{b}{a}} \]
    4. add-sqr-sqrt14.2%

      \[\leadsto -\frac{b}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
    5. sqrt-unprod14.8%

      \[\leadsto -\frac{b}{\color{blue}{\sqrt{a \cdot a}}} \]
    6. sqr-neg14.8%

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

      \[\leadsto -\frac{b}{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}} \]
    8. add-sqr-sqrt2.8%

      \[\leadsto -\frac{b}{\color{blue}{-a}} \]
    9. distribute-frac-neg2.8%

      \[\leadsto \color{blue}{\frac{-b}{-a}} \]
    10. expm1-log1p-u2.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-b}{-a}\right)\right)} \]
    11. frac-2neg2.1%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{b}{a}}\right)\right) \]
    12. expm1-udef2.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{b}{a}\right)} - 1} \]
  9. Applied egg-rr2.4%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{b}{a}\right)} - 1} \]
  10. Step-by-step derivation
    1. expm1-def2.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{b}{a}\right)\right)} \]
    2. expm1-log1p2.8%

      \[\leadsto \color{blue}{\frac{b}{a}} \]
  11. Simplified2.8%

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

    \[\leadsto \frac{b}{a} \]
  13. Add Preprocessing

Alternative 9: 11.0% 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 48.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. *-commutative48.1%

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

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

    \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(-1 \cdot b + 2 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 2} \]
  6. Step-by-step derivation
    1. +-commutative27.3%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(2 \cdot \frac{a \cdot c}{b} - b\right)}}{a \cdot 2} \]
    4. associate-/l*29.0%

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

      \[\leadsto \frac{\left(-b\right) + \left(\color{blue}{\frac{2 \cdot a}{\frac{b}{c}}} - b\right)}{a \cdot 2} \]
    6. *-commutative29.0%

      \[\leadsto \frac{\left(-b\right) + \left(\frac{\color{blue}{a \cdot 2}}{\frac{b}{c}} - b\right)}{a \cdot 2} \]
  7. Simplified29.0%

    \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(\frac{a \cdot 2}{\frac{b}{c}} - b\right)}}{a \cdot 2} \]
  8. Taylor expanded in b around 0 11.7%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  9. Final simplification11.7%

    \[\leadsto \frac{c}{b} \]
  10. Add Preprocessing

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{b}{2}\right|\\ t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\ t_2 := \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\ \;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\ \end{array}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{t_2 - \frac{b}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{\frac{b}{2} + t_2}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fabs (/ b 2.0)))
        (t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
        (t_2
         (if (== (copysign a c) a)
           (* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
           (hypot (/ b 2.0) t_1))))
   (if (< b 0.0) (/ (- t_2 (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) t_2)))))
double code(double a, double b, double c) {
	double t_0 = fabs((b / 2.0));
	double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
	double tmp;
	if (copysign(a, c) == a) {
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	} else {
		tmp = hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.abs((b / 2.0));
	double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
	double tmp;
	if (Math.copySign(a, c) == a) {
		tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
	} else {
		tmp = Math.hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.fabs((b / 2.0))
	t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c))
	tmp = 0
	if math.copysign(a, c) == a:
		tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1))
	else:
		tmp = math.hypot((b / 2.0), t_1)
	t_2 = tmp
	tmp_1 = 0
	if b < 0.0:
		tmp_1 = (t_2 - (b / 2.0)) / a
	else:
		tmp_1 = -c / ((b / 2.0) + t_2)
	return tmp_1
function code(a, b, c)
	t_0 = abs(Float64(b / 2.0))
	t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c)))
	tmp = 0.0
	if (copysign(a, c) == a)
		tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1)));
	else
		tmp = hypot(Float64(b / 2.0), t_1);
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b < 0.0)
		tmp_1 = Float64(Float64(t_2 - Float64(b / 2.0)) / a);
	else
		tmp_1 = Float64(Float64(-c) / Float64(Float64(b / 2.0) + t_2));
	end
	return tmp_1
end
function tmp_3 = code(a, b, c)
	t_0 = abs((b / 2.0));
	t_1 = sqrt(abs(a)) * sqrt(abs(c));
	tmp = 0.0;
	if ((sign(c) * abs(a)) == a)
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	else
		tmp = hypot((b / 2.0), t_1);
	end
	t_2 = tmp;
	tmp_2 = 0.0;
	if (b < 0.0)
		tmp_2 = (t_2 - (b / 2.0)) / a;
	else
		tmp_2 = -c / ((b / 2.0) + t_2);
	end
	tmp_3 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-c) / N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\


\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{t_2 - \frac{b}{2}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{\frac{b}{2} + t_2}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024013 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64
  :herbie-expected 10

  :herbie-target
  (if (< b 0.0) (/ (- (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))) (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))))))

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