The quadratic formula (r1)

Percentage Accurate: 51.9% → 85.2%
Time: 9.0s
Alternatives: 6
Speedup: 2.5×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{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(Float64(4.0 * 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[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{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 6 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.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{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(Float64(4.0 * 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[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 85.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+153}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 3.3 \cdot 10^{-84}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5e+153)
   (- (/ c b) (/ b a))
   (if (<= b 3.3e-84)
     (/ (+ (- b) (sqrt (fma (* c a) -4.0 (* b b)))) (* 2.0 a))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e+153) {
		tmp = (c / b) - (b / a);
	} else if (b <= 3.3e-84) {
		tmp = (-b + sqrt(fma((c * a), -4.0, (b * b)))) / (2.0 * a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e+153)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 3.3e-84)
		tmp = Float64(Float64(Float64(-b) + sqrt(fma(Float64(c * a), -4.0, Float64(b * b)))) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -5e+153], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.3e-84], N[(N[((-b) + N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 39.3%

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
      3. distribute-rgt-inN/A

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

        \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \color{blue}{\frac{1 \cdot b}{a}}\right) \]
      5. *-lft-identityN/A

        \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \frac{\color{blue}{b}}{a}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -\color{blue}{\mathsf{fma}\left(-1 \cdot \frac{c}{{b}^{2}}, b, \frac{b}{a}\right)} \]
      7. associate-*r/N/A

        \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{-1 \cdot c}{{b}^{2}}}, b, \frac{b}{a}\right) \]
      8. mul-1-negN/A

        \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(c\right)}}{{b}^{2}}, b, \frac{b}{a}\right) \]
      9. lower-/.f64N/A

        \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(c\right)}{{b}^{2}}}, b, \frac{b}{a}\right) \]
      10. lower-neg.f64N/A

        \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{-c}}{{b}^{2}}, b, \frac{b}{a}\right) \]
      11. unpow2N/A

        \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
      12. lower-*.f64N/A

        \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
      13. lower-/.f6499.2

        \[\leadsto -\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \color{blue}{\frac{b}{a}}\right) \]
    5. Applied rewrites99.2%

      \[\leadsto \color{blue}{-\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \frac{b}{a}\right)} \]
    6. Taylor expanded in c around 0

      \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
    7. Step-by-step derivation
      1. Applied rewrites100.0%

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

      if -5.00000000000000018e153 < b < 3.29999999999999984e-84

      1. Initial program 82.4%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \]
        3. fp-cancel-sub-sign-invN/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b + \left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c}}}{2 \cdot a} \]
        4. +-commutativeN/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\mathsf{neg}\left(4 \cdot a\right)\right) \cdot c + b \cdot b}}}{2 \cdot a} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\mathsf{neg}\left(\color{blue}{4 \cdot a}\right)\right) \cdot c + b \cdot b}}{2 \cdot a} \]
        6. distribute-lft-neg-inN/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot a\right)} \cdot c + b \cdot b}}{2 \cdot a} \]
        7. associate-*r*N/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\mathsf{neg}\left(4\right)\right) \cdot \left(a \cdot c\right)} + b \cdot b}}{2 \cdot a} \]
        8. *-commutativeN/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot \left(\mathsf{neg}\left(4\right)\right)} + b \cdot b}}{2 \cdot a} \]
        9. lower-fma.f64N/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(a \cdot c, \mathsf{neg}\left(4\right), b \cdot b\right)}}}{2 \cdot a} \]
        10. *-commutativeN/A

          \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(\color{blue}{c \cdot a}, \mathsf{neg}\left(4\right), b \cdot b\right)}}{2 \cdot a} \]
        11. lower-*.f64N/A

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

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

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

      if 3.29999999999999984e-84 < b

      1. Initial program 11.1%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Add Preprocessing
      3. Taylor expanded in a around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      4. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
        2. mul-1-negN/A

          \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(c\right)}}{b} \]
        3. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(c\right)}{b}} \]
        4. lower-neg.f6489.4

          \[\leadsto \frac{\color{blue}{-c}}{b} \]
      5. Applied rewrites89.4%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    8. Recombined 3 regimes into one program.
    9. Add Preprocessing

    Alternative 2: 80.5% accurate, 0.9× speedup?

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

      1. Initial program 68.5%

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

        \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
        2. lower-neg.f64N/A

          \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
        3. distribute-rgt-inN/A

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

          \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \color{blue}{\frac{1 \cdot b}{a}}\right) \]
        5. *-lft-identityN/A

          \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \frac{\color{blue}{b}}{a}\right) \]
        6. lower-fma.f64N/A

          \[\leadsto -\color{blue}{\mathsf{fma}\left(-1 \cdot \frac{c}{{b}^{2}}, b, \frac{b}{a}\right)} \]
        7. associate-*r/N/A

          \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{-1 \cdot c}{{b}^{2}}}, b, \frac{b}{a}\right) \]
        8. mul-1-negN/A

          \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(c\right)}}{{b}^{2}}, b, \frac{b}{a}\right) \]
        9. lower-/.f64N/A

          \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(c\right)}{{b}^{2}}}, b, \frac{b}{a}\right) \]
        10. lower-neg.f64N/A

          \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{-c}}{{b}^{2}}, b, \frac{b}{a}\right) \]
        11. unpow2N/A

          \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
        12. lower-*.f64N/A

          \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
        13. lower-/.f6487.8

          \[\leadsto -\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \color{blue}{\frac{b}{a}}\right) \]
      5. Applied rewrites87.8%

        \[\leadsto \color{blue}{-\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \frac{b}{a}\right)} \]
      6. Taylor expanded in c around 0

        \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
      7. Step-by-step derivation
        1. Applied rewrites88.2%

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

        if -6.0000000000000002e-59 < b < 1.8199999999999999e-90

        1. Initial program 77.8%

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

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

            \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4}}}{2 \cdot a} \]
          2. lower-*.f64N/A

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

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

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

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

        if 1.8199999999999999e-90 < b

        1. Initial program 11.1%

          \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. Add Preprocessing
        3. Taylor expanded in a around 0

          \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
        4. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
          2. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(c\right)}}{b} \]
          3. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(c\right)}{b}} \]
          4. lower-neg.f6489.4

            \[\leadsto \frac{\color{blue}{-c}}{b} \]
        5. Applied rewrites89.4%

          \[\leadsto \color{blue}{\frac{-c}{b}} \]
      8. Recombined 3 regimes into one program.
      9. Add Preprocessing

      Alternative 3: 66.7% accurate, 1.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4 \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 -4e-310) (- (/ c b) (/ b a)) (/ (- c) b)))
      double code(double a, double b, double c) {
      	double tmp;
      	if (b <= -4e-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 <= (-4d-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 <= -4e-310) {
      		tmp = (c / b) - (b / a);
      	} else {
      		tmp = -c / b;
      	}
      	return tmp;
      }
      
      def code(a, b, c):
      	tmp = 0
      	if b <= -4e-310:
      		tmp = (c / b) - (b / a)
      	else:
      		tmp = -c / b
      	return tmp
      
      function code(a, b, c)
      	tmp = 0.0
      	if (b <= -4e-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 <= -4e-310)
      		tmp = (c / b) - (b / a);
      	else
      		tmp = -c / b;
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_, c_] := If[LessEqual[b, -4e-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 -4 \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 < -3.999999999999988e-310

        1. Initial program 74.2%

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

          \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
        4. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \color{blue}{\mathsf{neg}\left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
          2. lower-neg.f64N/A

            \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
          3. distribute-rgt-inN/A

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

            \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \color{blue}{\frac{1 \cdot b}{a}}\right) \]
          5. *-lft-identityN/A

            \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \frac{\color{blue}{b}}{a}\right) \]
          6. lower-fma.f64N/A

            \[\leadsto -\color{blue}{\mathsf{fma}\left(-1 \cdot \frac{c}{{b}^{2}}, b, \frac{b}{a}\right)} \]
          7. associate-*r/N/A

            \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{-1 \cdot c}{{b}^{2}}}, b, \frac{b}{a}\right) \]
          8. mul-1-negN/A

            \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(c\right)}}{{b}^{2}}, b, \frac{b}{a}\right) \]
          9. lower-/.f64N/A

            \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(c\right)}{{b}^{2}}}, b, \frac{b}{a}\right) \]
          10. lower-neg.f64N/A

            \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{-c}}{{b}^{2}}, b, \frac{b}{a}\right) \]
          11. unpow2N/A

            \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
          12. lower-*.f64N/A

            \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
          13. lower-/.f6466.4

            \[\leadsto -\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \color{blue}{\frac{b}{a}}\right) \]
        5. Applied rewrites66.4%

          \[\leadsto \color{blue}{-\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \frac{b}{a}\right)} \]
        6. Taylor expanded in c around 0

          \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
        7. Step-by-step derivation
          1. Applied rewrites67.7%

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

          if -3.999999999999988e-310 < b

          1. Initial program 26.3%

            \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
          2. Add Preprocessing
          3. Taylor expanded in a around 0

            \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
            2. mul-1-negN/A

              \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(c\right)}}{b} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(c\right)}{b}} \]
            4. lower-neg.f6470.1

              \[\leadsto \frac{\color{blue}{-c}}{b} \]
          5. Applied rewrites70.1%

            \[\leadsto \color{blue}{\frac{-c}{b}} \]
        8. Recombined 2 regimes into one program.
        9. Add Preprocessing

        Alternative 4: 66.5% accurate, 2.5× speedup?

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

          1. Initial program 74.2%

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

            \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
            2. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
            3. mul-1-negN/A

              \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(b\right)}}{a} \]
            4. lower-neg.f6467.4

              \[\leadsto \frac{\color{blue}{-b}}{a} \]
          5. Applied rewrites67.4%

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

          if -3.999999999999988e-310 < b

          1. Initial program 26.3%

            \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
          2. Add Preprocessing
          3. Taylor expanded in a around 0

            \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
            2. mul-1-negN/A

              \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(c\right)}}{b} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(c\right)}{b}} \]
            4. lower-neg.f6470.1

              \[\leadsto \frac{\color{blue}{-c}}{b} \]
          5. Applied rewrites70.1%

            \[\leadsto \color{blue}{\frac{-c}{b}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 5: 42.0% accurate, 2.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.05 \cdot 10^{-29}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \end{array} \]
        (FPCore (a b c) :precision binary64 (if (<= b 2.05e-29) (/ (- b) a) (/ c b)))
        double code(double a, double b, double c) {
        	double tmp;
        	if (b <= 2.05e-29) {
        		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 <= 2.05d-29) 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 <= 2.05e-29) {
        		tmp = -b / a;
        	} else {
        		tmp = c / b;
        	}
        	return tmp;
        }
        
        def code(a, b, c):
        	tmp = 0
        	if b <= 2.05e-29:
        		tmp = -b / a
        	else:
        		tmp = c / b
        	return tmp
        
        function code(a, b, c)
        	tmp = 0.0
        	if (b <= 2.05e-29)
        		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 <= 2.05e-29)
        		tmp = -b / a;
        	else
        		tmp = c / b;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_] := If[LessEqual[b, 2.05e-29], N[((-b) / a), $MachinePrecision], N[(c / b), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;b \leq 2.05 \cdot 10^{-29}:\\
        \;\;\;\;\frac{-b}{a}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{c}{b}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if b < 2.0499999999999999e-29

          1. Initial program 70.4%

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

            \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
            2. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
            3. mul-1-negN/A

              \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(b\right)}}{a} \]
            4. lower-neg.f6448.7

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

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

          if 2.0499999999999999e-29 < b

          1. Initial program 10.7%

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

            \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
          4. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
            2. lower-neg.f64N/A

              \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
            3. distribute-rgt-inN/A

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

              \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \color{blue}{\frac{1 \cdot b}{a}}\right) \]
            5. *-lft-identityN/A

              \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \frac{\color{blue}{b}}{a}\right) \]
            6. lower-fma.f64N/A

              \[\leadsto -\color{blue}{\mathsf{fma}\left(-1 \cdot \frac{c}{{b}^{2}}, b, \frac{b}{a}\right)} \]
            7. associate-*r/N/A

              \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{-1 \cdot c}{{b}^{2}}}, b, \frac{b}{a}\right) \]
            8. mul-1-negN/A

              \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(c\right)}}{{b}^{2}}, b, \frac{b}{a}\right) \]
            9. lower-/.f64N/A

              \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(c\right)}{{b}^{2}}}, b, \frac{b}{a}\right) \]
            10. lower-neg.f64N/A

              \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{-c}}{{b}^{2}}, b, \frac{b}{a}\right) \]
            11. unpow2N/A

              \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
            12. lower-*.f64N/A

              \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
            13. lower-/.f642.5

              \[\leadsto -\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \color{blue}{\frac{b}{a}}\right) \]
          5. Applied rewrites2.5%

            \[\leadsto \color{blue}{-\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \frac{b}{a}\right)} \]
          6. Taylor expanded in a around inf

            \[\leadsto \frac{c}{\color{blue}{b}} \]
          7. Step-by-step derivation
            1. Applied rewrites29.5%

              \[\leadsto \frac{c}{\color{blue}{b}} \]
          8. Recombined 2 regimes into one program.
          9. Add Preprocessing

          Alternative 6: 10.2% accurate, 4.2× 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 47.0%

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

            \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
          4. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
            2. lower-neg.f64N/A

              \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
            3. distribute-rgt-inN/A

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

              \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \color{blue}{\frac{1 \cdot b}{a}}\right) \]
            5. *-lft-identityN/A

              \[\leadsto -\left(\left(-1 \cdot \frac{c}{{b}^{2}}\right) \cdot b + \frac{\color{blue}{b}}{a}\right) \]
            6. lower-fma.f64N/A

              \[\leadsto -\color{blue}{\mathsf{fma}\left(-1 \cdot \frac{c}{{b}^{2}}, b, \frac{b}{a}\right)} \]
            7. associate-*r/N/A

              \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{-1 \cdot c}{{b}^{2}}}, b, \frac{b}{a}\right) \]
            8. mul-1-negN/A

              \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(c\right)}}{{b}^{2}}, b, \frac{b}{a}\right) \]
            9. lower-/.f64N/A

              \[\leadsto -\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(c\right)}{{b}^{2}}}, b, \frac{b}{a}\right) \]
            10. lower-neg.f64N/A

              \[\leadsto -\mathsf{fma}\left(\frac{\color{blue}{-c}}{{b}^{2}}, b, \frac{b}{a}\right) \]
            11. unpow2N/A

              \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
            12. lower-*.f64N/A

              \[\leadsto -\mathsf{fma}\left(\frac{-c}{\color{blue}{b \cdot b}}, b, \frac{b}{a}\right) \]
            13. lower-/.f6430.0

              \[\leadsto -\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \color{blue}{\frac{b}{a}}\right) \]
          5. Applied rewrites30.0%

            \[\leadsto \color{blue}{-\mathsf{fma}\left(\frac{-c}{b \cdot b}, b, \frac{b}{a}\right)} \]
          6. Taylor expanded in a around inf

            \[\leadsto \frac{c}{\color{blue}{b}} \]
          7. Step-by-step derivation
            1. Applied rewrites13.3%

              \[\leadsto \frac{c}{\color{blue}{b}} \]
            2. Add Preprocessing

            Developer Target 1: 69.9% accurate, 0.7× speedup?

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

            Reproduce

            ?
            herbie shell --seed 2024337 
            (FPCore (a b c)
              :name "The quadratic formula (r1)"
              :precision binary64
            
              :alt
              (! :herbie-platform default (let ((d (- (* b b) (* (* 4 a) c)))) (let ((r1 (/ (+ (- b) (sqrt d)) (* 2 a)))) (let ((r2 (/ (- (- b) (sqrt d)) (* 2 a)))) (if (< b 0) r1 (/ c (* a r2)))))))
            
              (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))