quadp (p42, positive)

Percentage Accurate: 64.2% → 89.2%
Time: 11.9s
Alternatives: 5
Speedup: 12.9×

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 5 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: 64.2% 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: 89.2% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 36.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. *-commutative36.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified36.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. Step-by-step derivation
      1. add-sqr-sqrt36.8%

        \[\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. pow236.8%

        \[\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/236.8%

        \[\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-pow136.8%

        \[\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. sub-neg36.8%

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
      7. distribute-lft-neg-in36.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e156 < b < 1.99999999999999999e89

    1. Initial program 84.3%

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

    if 1.99999999999999999e89 < b

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified27.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. Step-by-step derivation
      1. add-sqr-sqrt18.3%

        \[\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. pow218.3%

        \[\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/218.3%

        \[\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-pow118.3%

        \[\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. sub-neg18.3%

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
      7. distribute-lft-neg-in18.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b}{a} + 0.5 \cdot \frac{b}{a}} \]
    8. Step-by-step derivation
      1. distribute-rgt-out60.5%

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{0} \]
      3. mul0-rgt98.2%

        \[\leadsto \color{blue}{0} \]
    9. Simplified98.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.1%

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

Alternative 2: 78.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c}{b} - \frac{b}{a}\\ t_1 := \left(\sqrt{c \cdot \left(a \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{if}\;b \leq -3.35 \cdot 10^{-31}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq -4 \cdot 10^{-75}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -1.55 \cdot 10^{-102}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-146}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (- (/ c b) (/ b a)))
        (t_1 (* (- (sqrt (* c (* a -4.0))) b) (/ 0.5 a))))
   (if (<= b -3.35e-31)
     t_0
     (if (<= b -4e-75)
       t_1
       (if (<= b -1.55e-102) t_0 (if (<= b 1.5e-146) t_1 0.0))))))
double code(double a, double b, double c) {
	double t_0 = (c / b) - (b / a);
	double t_1 = (sqrt((c * (a * -4.0))) - b) * (0.5 / a);
	double tmp;
	if (b <= -3.35e-31) {
		tmp = t_0;
	} else if (b <= -4e-75) {
		tmp = t_1;
	} else if (b <= -1.55e-102) {
		tmp = t_0;
	} else if (b <= 1.5e-146) {
		tmp = t_1;
	} else {
		tmp = 0.0;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = (c / b) - (b / a)
    t_1 = (sqrt((c * (a * (-4.0d0)))) - b) * (0.5d0 / a)
    if (b <= (-3.35d-31)) then
        tmp = t_0
    else if (b <= (-4d-75)) then
        tmp = t_1
    else if (b <= (-1.55d-102)) then
        tmp = t_0
    else if (b <= 1.5d-146) then
        tmp = t_1
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (c / b) - (b / a);
	double t_1 = (Math.sqrt((c * (a * -4.0))) - b) * (0.5 / a);
	double tmp;
	if (b <= -3.35e-31) {
		tmp = t_0;
	} else if (b <= -4e-75) {
		tmp = t_1;
	} else if (b <= -1.55e-102) {
		tmp = t_0;
	} else if (b <= 1.5e-146) {
		tmp = t_1;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (c / b) - (b / a)
	t_1 = (math.sqrt((c * (a * -4.0))) - b) * (0.5 / a)
	tmp = 0
	if b <= -3.35e-31:
		tmp = t_0
	elif b <= -4e-75:
		tmp = t_1
	elif b <= -1.55e-102:
		tmp = t_0
	elif b <= 1.5e-146:
		tmp = t_1
	else:
		tmp = 0.0
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(c / b) - Float64(b / a))
	t_1 = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) * Float64(0.5 / a))
	tmp = 0.0
	if (b <= -3.35e-31)
		tmp = t_0;
	elseif (b <= -4e-75)
		tmp = t_1;
	elseif (b <= -1.55e-102)
		tmp = t_0;
	elseif (b <= 1.5e-146)
		tmp = t_1;
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (c / b) - (b / a);
	t_1 = (sqrt((c * (a * -4.0))) - b) * (0.5 / a);
	tmp = 0.0;
	if (b <= -3.35e-31)
		tmp = t_0;
	elseif (b <= -4e-75)
		tmp = t_1;
	elseif (b <= -1.55e-102)
		tmp = t_0;
	elseif (b <= 1.5e-146)
		tmp = t_1;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.35e-31], t$95$0, If[LessEqual[b, -4e-75], t$95$1, If[LessEqual[b, -1.55e-102], t$95$0, If[LessEqual[b, 1.5e-146], t$95$1, 0.0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq -4 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -1.55 \cdot 10^{-102}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 1.5 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.35000000000000002e-31 or -3.9999999999999998e-75 < b < -1.55000000000000006e-102

    1. Initial program 65.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. *-commutative65.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified65.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 90.5%

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

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

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

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

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

    if -3.35000000000000002e-31 < b < -3.9999999999999998e-75 or -1.55000000000000006e-102 < b < 1.50000000000000009e-146

    1. Initial program 80.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. *-commutative80.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified80.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. Step-by-step derivation
      1. add-sqr-sqrt80.3%

        \[\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. pow280.3%

        \[\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/280.3%

        \[\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-pow180.4%

        \[\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. sub-neg80.4%

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
      7. distribute-lft-neg-in80.4%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(e^{0.25 \cdot \left(\log \left(-4 \cdot a\right) + -1 \cdot \log \left(\frac{1}{c}\right)\right)}\right)}^{2} - b}}{a \cdot 2} \]
    8. Simplified79.3%

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

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

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

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

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

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

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

    if 1.50000000000000009e-146 < b

    1. Initial program 51.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. *-commutative51.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified51.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. Step-by-step derivation
      1. add-sqr-sqrt35.6%

        \[\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. pow235.6%

        \[\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/235.6%

        \[\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-pow135.6%

        \[\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. sub-neg35.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b}{a} + 0.5 \cdot \frac{b}{a}} \]
    8. Step-by-step derivation
      1. distribute-rgt-out56.9%

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{0} \]
      3. mul0-rgt79.8%

        \[\leadsto \color{blue}{0} \]
    9. Simplified79.8%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.35 \cdot 10^{-31}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq -4 \cdot 10^{-75}:\\ \;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{elif}\;b \leq -1.55 \cdot 10^{-102}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-146}:\\ \;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 66.0% accurate, 9.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    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. Taylor expanded in b around -inf 68.3%

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

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

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

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

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

    if -2.35000000000000006e-293 < b

    1. Initial program 56.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. *-commutative56.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified56.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. Step-by-step derivation
      1. add-sqr-sqrt42.2%

        \[\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. pow242.2%

        \[\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/242.2%

        \[\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-pow142.2%

        \[\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. sub-neg42.2%

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
      7. distribute-lft-neg-in42.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b}{a} + 0.5 \cdot \frac{b}{a}} \]
    8. Step-by-step derivation
      1. distribute-rgt-out48.5%

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{0} \]
      3. mul0-rgt67.8%

        \[\leadsto \color{blue}{0} \]
    9. Simplified67.8%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.1%

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

Alternative 4: 65.8% accurate, 12.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified69.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 67.1%

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 55.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. *-commutative55.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified55.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. add-sqr-sqrt41.7%

        \[\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. pow241.7%

        \[\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/241.7%

        \[\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-pow141.7%

        \[\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. sub-neg41.7%

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
      7. distribute-lft-neg-in41.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b}{a} + 0.5 \cdot \frac{b}{a}} \]
    8. Step-by-step derivation
      1. distribute-rgt-out48.9%

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{0} \]
      3. mul0-rgt68.4%

        \[\leadsto \color{blue}{0} \]
    9. Simplified68.4%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.7%

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

Alternative 5: 32.9% accurate, 116.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 63.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. *-commutative63.6%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
  3. Simplified63.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. Step-by-step derivation
    1. add-sqr-sqrt57.4%

      \[\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. pow257.4%

      \[\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/257.4%

      \[\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-pow157.4%

      \[\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. sub-neg57.4%

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

      \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{a \cdot 2} \]
    7. distribute-lft-neg-in57.4%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-0.5 \cdot \frac{b}{a} + 0.5 \cdot \frac{b}{a}} \]
  8. Step-by-step derivation
    1. distribute-rgt-out22.9%

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

      \[\leadsto \frac{b}{a} \cdot \color{blue}{0} \]
    3. mul0-rgt31.6%

      \[\leadsto \color{blue}{0} \]
  9. Simplified31.6%

    \[\leadsto \color{blue}{0} \]
  10. Final simplification31.6%

    \[\leadsto 0 \]
  11. Add Preprocessing

Developer target: 78.0% 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 2024052 
(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)))