The quadratic formula (r1)

Percentage Accurate: 63.7% → 87.9%
Time: 18.0s
Alternatives: 8
Speedup: 11.6×

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 8 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: 63.7% 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: 87.9% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0}{a \cdot 2}\\


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

    1. Initial program 54.3%

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

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
      2. Add Preprocessing
      3. Taylor expanded in b around -inf 96.3%

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

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

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

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

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

      if -7.79999999999999983e141 < b < 1.07999999999999996e77

      1. Initial program 84.1%

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

      if 1.07999999999999996e77 < b

      1. Initial program 27.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification89.2%

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

    Alternative 2: 76.8% accurate, 1.0× speedup?

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

      1. Initial program 74.4%

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

          \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
        2. Add Preprocessing
        3. Taylor expanded in b around -inf 88.5%

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

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

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

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

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

        if -8.5000000000000001e-87 < b < 1.26e-182

        1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.26e-182 < b

        1. Initial program 48.8%

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification81.6%

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

      Alternative 3: 77.2% accurate, 1.0× speedup?

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

        1. Initial program 74.4%

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

            \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
          2. Add Preprocessing
          3. Taylor expanded in b around -inf 88.5%

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

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

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

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

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

          if -1.65e-87 < b < 1.26e-182

          1. Initial program 76.0%

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

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

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

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

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

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

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

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

          if 1.26e-182 < b

          1. Initial program 48.8%

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification82.0%

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

        Alternative 4: 65.0% accurate, 9.7× speedup?

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

          1. Initial program 73.6%

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

              \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
            2. Add Preprocessing
            3. Taylor expanded in b around -inf 70.7%

              \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
            4. Step-by-step derivation
              1. +-commutative70.7%

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

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

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

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

            if -2e-296 < b

            1. Initial program 54.3%

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

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

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

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

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

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

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

              \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification69.6%

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

          Alternative 5: 64.8% accurate, 11.6× speedup?

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

            1. Initial program 73.8%

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

                \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
              2. Add Preprocessing
              3. Taylor expanded in b around -inf 69.4%

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

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

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

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

              if -9.50000000000000032e-301 < b

              1. Initial program 54.0%

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

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

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification69.2%

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

            Alternative 6: 44.1% accurate, 12.9× speedup?

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

              1. Initial program 73.9%

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

                  \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
                2. Add Preprocessing
                3. Taylor expanded in b around -inf 55.5%

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

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

                    \[\leadsto \frac{\color{blue}{-b}}{a} \]
                5. Simplified55.5%

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

                if 7.2e-46 < b

                1. Initial program 45.5%

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

                    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
                  2. Add Preprocessing
                  3. Taylor expanded in b around -inf 2.5%

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

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

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

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

                    \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
                  6. Taylor expanded in c around inf 28.2%

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

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

                Alternative 7: 47.6% accurate, 12.9× speedup?

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

                      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
                    2. Add Preprocessing
                    3. Taylor expanded in b around -inf 68.5%

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

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

                        \[\leadsto \frac{\color{blue}{-b}}{a} \]
                    5. Simplified68.5%

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

                    if -1.999999999999994e-310 < b

                    1. Initial program 53.2%

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

                        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
                      2. Add Preprocessing
                      3. Taylor expanded in a around 0 22.6%

                        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
                      4. Step-by-step derivation
                        1. mul-1-neg22.6%

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

                          \[\leadsto \color{blue}{\frac{-c}{b}} \]
                      5. Simplified22.6%

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

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

                    Alternative 8: 11.7% accurate, 38.7× speedup?

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

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

                        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
                      2. Add Preprocessing
                      3. Taylor expanded in b around -inf 38.1%

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

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

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

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

                        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
                      6. Taylor expanded in c around inf 11.4%

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

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

                      Developer target: 71.1% accurate, 0.9× 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 2024023 
                      (FPCore (a b c)
                        :name "The quadratic formula (r1)"
                        :precision binary64
                      
                        :herbie-target
                        (if (< b 0.0) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))))
                      
                        (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))