Quadratic roots, full range

Percentage Accurate: 51.4% → 85.1%
Time: 10.3s
Alternatives: 9
Speedup: 19.1×

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 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 85.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 26.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. neg-sub026.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(b - \left(\left(\frac{c}{b} \cdot a\right) \cdot 2 - b\right)\right) \cdot -0.5}{a}} \]
      2. associate--r-97.7%

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

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

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

        \[\leadsto \frac{\left(\left(b - 2 \cdot \color{blue}{\frac{c}{\frac{b}{a}}}\right) + b\right) \cdot -0.5}{a} \]
    8. Applied egg-rr97.7%

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

    if -5.00000000000000018e153 < b < 2.8e-65

    1. Initial program 83.0%

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

    if 2.8e-65 < b

    1. Initial program 13.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. neg-sub013.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/77.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-177.5%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*80.7%

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

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
      8. associate-/l*93.4%

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

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

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

Alternative 2: 84.8% accurate, 1.0× speedup?

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

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

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

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


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

    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. neg-sub045.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(b - \left(\left(\frac{c}{b} \cdot a\right) \cdot 2 - b\right)\right) \cdot -0.5}{a}} \]
      2. associate--r-98.3%

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

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

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

        \[\leadsto \frac{\left(\left(b - 2 \cdot \color{blue}{\frac{c}{\frac{b}{a}}}\right) + b\right) \cdot -0.5}{a} \]
    8. Applied egg-rr98.3%

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

    if -4.5999999999999999e83 < b < 6.6000000000000003e-67

    1. Initial program 80.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. /-rgt-identity80.8%

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      8. associate-*l*80.6%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{4 \cdot \left(a \cdot c\right)}\right)} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      9. *-commutative80.6%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(a \cdot c\right) \cdot 4}\right)} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      10. distribute-rgt-neg-in80.6%

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

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

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

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)} - b\right) \cdot \frac{\frac{\color{blue}{1}}{2}}{a} \]
      14. metadata-eval80.6%

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

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

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

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

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

    if 6.6000000000000003e-67 < b

    1. Initial program 13.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. neg-sub013.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/77.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-177.5%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*80.7%

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

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
      8. associate-/l*93.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.6 \cdot 10^{+83}:\\ \;\;\;\;\frac{\left(b + \left(b - 2 \cdot \frac{c}{\frac{b}{a}}\right)\right) \cdot -0.5}{a}\\ \mathbf{elif}\;b \leq 6.6 \cdot 10^{-67}:\\ \;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \]

Alternative 3: 80.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.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. neg-sub064.2%

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity64.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(b - \left(\left(\frac{c}{b} \cdot a\right) \cdot 2 - b\right)\right) \cdot -0.5}{a}} \]
      2. associate--r-92.0%

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

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

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

        \[\leadsto \frac{\left(\left(b - 2 \cdot \color{blue}{\frac{c}{\frac{b}{a}}}\right) + b\right) \cdot -0.5}{a} \]
    8. Applied egg-rr92.0%

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

    if -1.3500000000000001e-57 < b < 1.32e-68

    1. Initial program 74.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. neg-sub074.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.32e-68 < b

    1. Initial program 13.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. neg-sub013.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/77.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-177.5%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*80.7%

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

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
      8. associate-/l*93.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{-57}:\\ \;\;\;\;\frac{\left(b + \left(b - 2 \cdot \frac{c}{\frac{b}{a}}\right)\right) \cdot -0.5}{a}\\ \mathbf{elif}\;b \leq 1.32 \cdot 10^{-68}:\\ \;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -4\right)}\right) \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \]

Alternative 4: 80.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.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. neg-sub064.2%

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity64.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(b - \left(\left(\frac{c}{b} \cdot a\right) \cdot 2 - b\right)\right) \cdot -0.5}{a}} \]
      2. associate--r-92.0%

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

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

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

        \[\leadsto \frac{\left(\left(b - 2 \cdot \color{blue}{\frac{c}{\frac{b}{a}}}\right) + b\right) \cdot -0.5}{a} \]
    8. Applied egg-rr92.0%

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

    if -2.99999999999999989e-56 < b < 1.5499999999999999e-94

    1. Initial program 75.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. neg-sub075.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5499999999999999e-94 < b

    1. Initial program 15.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. neg-sub015.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 68.0% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 68.1%

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

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity67.9%

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 30.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. neg-sub030.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    6. Simplified73.1%

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

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

Alternative 6: 43.5% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2400000:\\
\;\;\;\;\frac{-b}{a}\\

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


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

    1. Initial program 65.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. neg-sub065.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified47.2%

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

    if 2.4e6 < b

    1. Initial program 13.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2400000:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]

Alternative 7: 67.8% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 67.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. neg-sub067.8%

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity67.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified63.9%

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

    if 1.42e-288 < b

    1. Initial program 30.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. neg-sub030.0%

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity29.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    6. Simplified74.1%

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

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

Alternative 8: 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 48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 11.2% accurate, 38.7× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
    8. /-rgt-identity48.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  8. Final simplification12.3%

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

Reproduce

?
herbie shell --seed 2023229 
(FPCore (a b c)
  :name "Quadratic roots, full range"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))