The quadratic formula (r2)

Percentage Accurate: 51.1% → 85.3%
Time: 14.7s
Alternatives: 9
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 51.1% accurate, 1.0× speedup?

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

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

Alternative 1: 85.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 20.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2e-101 < b < 1.99999999999999987e146

    1. Initial program 86.7%

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

    if 1.99999999999999987e146 < b

    1. Initial program 43.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 20.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.44999999999999993e-102 < b < 5.5000000000000001e-70

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{b + \color{blue}{e^{\log \left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right) \cdot 0.5}}}{a} \]
    5. Applied egg-rr74.7%

      \[\leadsto -0.5 \cdot \frac{b + \color{blue}{e^{\log \left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right) \cdot 0.5}}}{a} \]
    6. Taylor expanded in c around -inf 34.9%

      \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(4 \cdot a\right) + -1 \cdot \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{a} \]
    7. Step-by-step derivation
      1. mul-1-neg34.9%

        \[\leadsto -0.5 \cdot \frac{b + e^{\left(\log \left(4 \cdot a\right) + \color{blue}{\left(-\log \left(\frac{-1}{c}\right)\right)}\right) \cdot 0.5}}{a} \]
      2. unsub-neg34.9%

        \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{a} \]
      3. *-commutative34.9%

        \[\leadsto -0.5 \cdot \frac{b + e^{\left(\log \color{blue}{\left(a \cdot 4\right)} - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}{a} \]
    8. Simplified34.9%

      \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{a} \]
    9. Step-by-step derivation
      1. clear-num34.9%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{a}{b + e^{\left(\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}}} \]
      2. inv-pow34.9%

        \[\leadsto -0.5 \cdot \color{blue}{{\left(\frac{a}{b + e^{\left(\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}\right)}^{-1}} \]
      3. exp-prod27.7%

        \[\leadsto -0.5 \cdot {\left(\frac{a}{b + \color{blue}{{\left(e^{\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)}\right)}^{0.5}}}\right)}^{-1} \]
      4. unpow1/227.7%

        \[\leadsto -0.5 \cdot {\left(\frac{a}{b + \color{blue}{\sqrt{e^{\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)}}}}\right)}^{-1} \]
      5. diff-log67.9%

        \[\leadsto -0.5 \cdot {\left(\frac{a}{b + \sqrt{e^{\color{blue}{\log \left(\frac{a \cdot 4}{\frac{-1}{c}}\right)}}}}\right)}^{-1} \]
      6. add-exp-log72.3%

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{a}{b + \sqrt{-4 \cdot \frac{a}{\frac{1}{c}}}}}} \]
      2. *-commutative72.3%

        \[\leadsto -0.5 \cdot \frac{1}{\frac{a}{b + \sqrt{\color{blue}{\frac{a}{\frac{1}{c}} \cdot -4}}}} \]
      3. associate-/r/72.3%

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

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

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

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

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

    if 5.5000000000000001e-70 < b

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 80.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 20.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8e-102 < b < 2.7000000000000001e-70

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7000000000000001e-70 < b

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 20.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999973e-102 < b < 1.3499999999999999e-69

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{b + \color{blue}{e^{\log \left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right) \cdot 0.5}}}{a} \]
    5. Applied egg-rr74.7%

      \[\leadsto -0.5 \cdot \frac{b + \color{blue}{e^{\log \left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right) \cdot 0.5}}}{a} \]
    6. Taylor expanded in c around -inf 34.9%

      \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(4 \cdot a\right) + -1 \cdot \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{a} \]
    7. Step-by-step derivation
      1. mul-1-neg34.9%

        \[\leadsto -0.5 \cdot \frac{b + e^{\left(\log \left(4 \cdot a\right) + \color{blue}{\left(-\log \left(\frac{-1}{c}\right)\right)}\right) \cdot 0.5}}{a} \]
      2. unsub-neg34.9%

        \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{a} \]
      3. *-commutative34.9%

        \[\leadsto -0.5 \cdot \frac{b + e^{\left(\log \color{blue}{\left(a \cdot 4\right)} - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}{a} \]
    8. Simplified34.9%

      \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{a} \]
    9. Taylor expanded in b around 0 34.7%

      \[\leadsto -0.5 \cdot \color{blue}{\frac{e^{0.5 \cdot \left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)}}{a}} \]
    10. Step-by-step derivation
      1. expm1-log1p-u34.7%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{0.5 \cdot \left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)}\right)\right)}}{a} \]
      2. expm1-udef18.6%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{e^{\mathsf{log1p}\left(e^{0.5 \cdot \left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)}\right)} - 1}}{a} \]
      3. *-commutative18.6%

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(e^{\color{blue}{\left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}\right)} - 1}{a} \]
      4. diff-log38.9%

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(e^{\color{blue}{\log \left(\frac{4 \cdot a}{\frac{-1}{c}}\right)} \cdot 0.5}\right)} - 1}{a} \]
      5. exp-to-pow38.9%

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{4 \cdot a}{\frac{-1}{c}}\right)}^{0.5}}\right)} - 1}{a} \]
      6. div-inv38.9%

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left({\left(\frac{4 \cdot a}{\color{blue}{-1 \cdot \frac{1}{c}}}\right)}^{0.5}\right)} - 1}{a} \]
      7. times-frac38.9%

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left({\color{blue}{\left(\frac{4}{-1} \cdot \frac{a}{\frac{1}{c}}\right)}}^{0.5}\right)} - 1}{a} \]
      8. metadata-eval38.9%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{\left(-4 \cdot \frac{a}{\frac{1}{c}}\right)}^{0.5}}}{a} \]
      3. unpow1/271.4%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\sqrt{-4 \cdot \frac{a}{\frac{1}{c}}}}}{a} \]
      4. associate-/r/71.4%

        \[\leadsto -0.5 \cdot \frac{\sqrt{-4 \cdot \color{blue}{\left(\frac{a}{1} \cdot c\right)}}}{a} \]
      5. /-rgt-identity71.4%

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

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

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

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

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

    if 1.3499999999999999e-69 < b

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 68.1% accurate, 6.8× speedup?

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

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

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


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

    1. Initial program 34.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
    6. Simplified65.9%

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

    if -4.999999999999985e-310 < b

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{b + \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{a} \]
    5. Step-by-step derivation
      1. associate-/l*67.5%

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

      \[\leadsto -0.5 \cdot \frac{b + \color{blue}{\left(b + -2 \cdot \frac{a}{\frac{b}{c}}\right)}}{a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b + \left(b + -2 \cdot \frac{a}{\frac{b}{c}}\right)}{a}\\ \end{array} \]

Alternative 6: 68.2% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 34.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
    6. Simplified65.9%

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

    if -4.999999999999985e-310 < b

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 68.1% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 32.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
    6. Simplified67.9%

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

    if -1.2e-303 < b

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 35.6% accurate, 29.0× 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(Float64(-c) / b)
end
function tmp = code(a, b, c)
	tmp = -c / b;
end
code[a_, b_, c_] := N[((-c) / b), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{c}{b}} \]
  6. Simplified34.4%

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

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

Alternative 9: 2.5% accurate, 38.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Developer target: 69.5% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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