Quadratic roots, full range

Percentage Accurate: 52.0% → 86.2%
Time: 12.8s
Alternatives: 10
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 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: 52.0% 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: 86.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+94}:\\
\;\;\;\;0 - \frac{b}{a}\\

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

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


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

    1. Initial program 47.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{b}{a}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\color{blue}{\mathsf{neg}\left(a\right)}} \]
      3. mul-1-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(b, \color{blue}{\left(-1 \cdot a\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(b, \left(\mathsf{neg}\left(a\right)\right)\right) \]
      6. neg-lowering-neg.f6496.5%

        \[\leadsto \mathsf{/.f64}\left(b, \mathsf{neg.f64}\left(a\right)\right) \]
    5. Simplified96.5%

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

    if -1e94 < b < 2.8000000000000002e-41

    1. Initial program 79.9%

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

    if 2.8000000000000002e-41 < b

    1. Initial program 14.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6489.0%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified89.0%

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

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

Alternative 2: 86.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+97}:\\
\;\;\;\;0 - \frac{b}{a}\\

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

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


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

    1. Initial program 47.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{b}{a}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\color{blue}{\mathsf{neg}\left(a\right)}} \]
      3. mul-1-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(b, \color{blue}{\left(-1 \cdot a\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(b, \left(\mathsf{neg}\left(a\right)\right)\right) \]
      6. neg-lowering-neg.f6496.5%

        \[\leadsto \mathsf{/.f64}\left(b, \mathsf{neg.f64}\left(a\right)\right) \]
    5. Simplified96.5%

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

    if -4.0000000000000003e97 < b < 1.94999999999999995e-41

    1. Initial program 79.9%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified79.1%

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

    if 1.94999999999999995e-41 < b

    1. Initial program 14.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6489.0%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified89.0%

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

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

Alternative 3: 86.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{+89}:\\
\;\;\;\;0 - \frac{b}{a}\\

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

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


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

    1. Initial program 49.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{b}{a}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\color{blue}{\mathsf{neg}\left(a\right)}} \]
      3. mul-1-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(b, \color{blue}{\left(-1 \cdot a\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(b, \left(\mathsf{neg}\left(a\right)\right)\right) \]
      6. neg-lowering-neg.f6496.7%

        \[\leadsto \mathsf{/.f64}\left(b, \mathsf{neg.f64}\left(a\right)\right) \]
    5. Simplified96.7%

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

    if -1.3e89 < b < 1.8e-41

    1. Initial program 79.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{1}{2}}{a}\right), \left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      7. metadata-evalN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), \color{blue}{b}\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right)\right) \]
      13. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\left(b \cdot b\right), \left(\left(4 \cdot a\right) \cdot c\right)\right)\right), b\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\left(4 \cdot a\right) \cdot c\right)\right)\right), b\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\left(a \cdot 4\right) \cdot c\right)\right)\right), b\right)\right) \]
      16. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(4 \cdot c\right)\right)\right)\right), b\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(4 \cdot c\right)\right)\right)\right), b\right)\right) \]
      18. *-lowering-*.f6478.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(4, c\right)\right)\right)\right), b\right)\right) \]
    4. Applied egg-rr78.7%

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

    if 1.8e-41 < b

    1. Initial program 14.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6489.0%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified89.0%

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

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

Alternative 4: 81.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.9%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified66.9%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right) \cdot b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      3. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(-2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{-2 \cdot \left(a \cdot c\right)}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(-2 \cdot \left(a \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(a \cdot c\right) \cdot -2\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left(b \cdot b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      16. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(0 - b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      17. --lowering--.f6484.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{\_.f64}\left(0, b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. Simplified84.0%

      \[\leadsto \frac{\color{blue}{\left(2 + \frac{a \cdot \left(c \cdot -2\right)}{b \cdot b}\right) \cdot \left(0 - b\right)}}{a \cdot 2} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \frac{c}{b} + \left(\mathsf{neg}\left(\frac{b}{a}\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{c}{b}\right), \color{blue}{\left(\frac{b}{a}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \left(\frac{\color{blue}{b}}{a}\right)\right) \]
      6. /-lowering-/.f6486.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \mathsf{/.f64}\left(b, \color{blue}{a}\right)\right) \]
    10. Simplified86.2%

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

    if -1.25e-55 < b < 7.29999999999999967e-87

    1. Initial program 78.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. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified76.7%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\color{blue}{\left(-4 \cdot \left(a \cdot c\right)\right)}\right), b\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(-4 \cdot a\right) \cdot c\right)\right), b\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(c \cdot \left(-4 \cdot a\right)\right)\right), b\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(-4 \cdot a\right)\right)\right), b\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(a \cdot -4\right)\right)\right), b\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      5. *-lowering-*.f6472.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{*.f64}\left(a, -4\right)\right)\right), b\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. Simplified72.5%

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

    if 7.29999999999999967e-87 < b

    1. Initial program 18.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6483.3%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified83.3%

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

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

Alternative 5: 81.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.9%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified66.9%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right) \cdot b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      3. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(-2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{-2 \cdot \left(a \cdot c\right)}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(-2 \cdot \left(a \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(a \cdot c\right) \cdot -2\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left(b \cdot b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      16. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(0 - b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      17. --lowering--.f6484.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{\_.f64}\left(0, b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. Simplified84.0%

      \[\leadsto \frac{\color{blue}{\left(2 + \frac{a \cdot \left(c \cdot -2\right)}{b \cdot b}\right) \cdot \left(0 - b\right)}}{a \cdot 2} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \frac{c}{b} + \left(\mathsf{neg}\left(\frac{b}{a}\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{c}{b}\right), \color{blue}{\left(\frac{b}{a}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \left(\frac{\color{blue}{b}}{a}\right)\right) \]
      6. /-lowering-/.f6486.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \mathsf{/.f64}\left(b, \color{blue}{a}\right)\right) \]
    10. Simplified86.2%

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

    if -4.69999999999999994e-58 < b < 7.00000000000000023e-87

    1. Initial program 78.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{1}{2}}{a}\right), \left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      7. metadata-evalN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), \color{blue}{b}\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right)\right) \]
      13. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\left(b \cdot b\right), \left(\left(4 \cdot a\right) \cdot c\right)\right)\right), b\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\left(4 \cdot a\right) \cdot c\right)\right)\right), b\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\left(a \cdot 4\right) \cdot c\right)\right)\right), b\right)\right) \]
      16. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(4 \cdot c\right)\right)\right)\right), b\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(4 \cdot c\right)\right)\right)\right), b\right)\right) \]
      18. *-lowering-*.f6476.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(4, c\right)\right)\right)\right), b\right)\right) \]
    4. Applied egg-rr76.6%

      \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \left(\sqrt{b \cdot b - a \cdot \left(4 \cdot c\right)} - b\right)} \]
    5. Taylor expanded in b around 0

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(a \cdot c\right) \cdot -4\right)\right), b\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(a \cdot \left(c \cdot -4\right)\right)\right), b\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(a \cdot \left(-4 \cdot c\right)\right)\right), b\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(a, \left(-4 \cdot c\right)\right)\right), b\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -4\right)\right)\right), b\right)\right) \]
      6. *-lowering-*.f6471.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right), b\right)\right) \]
    7. Simplified71.2%

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

    if 7.00000000000000023e-87 < b

    1. Initial program 18.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6483.3%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified83.3%

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

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

Alternative 6: 68.4% accurate, 8.3× speedup?

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

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

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


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

    1. Initial program 71.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. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified70.3%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right) \cdot b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      3. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(-2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{-2 \cdot \left(a \cdot c\right)}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(-2 \cdot \left(a \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(a \cdot c\right) \cdot -2\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left(b \cdot b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      16. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(0 - b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      17. --lowering--.f6466.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{\_.f64}\left(0, b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. Simplified66.1%

      \[\leadsto \frac{\color{blue}{\left(2 + \frac{a \cdot \left(c \cdot -2\right)}{b \cdot b}\right) \cdot \left(0 - b\right)}}{a \cdot 2} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \frac{c}{b} + \left(\mathsf{neg}\left(\frac{b}{a}\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{c}{b}\right), \color{blue}{\left(\frac{b}{a}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \left(\frac{\color{blue}{b}}{a}\right)\right) \]
      6. /-lowering-/.f6468.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \mathsf{/.f64}\left(b, \color{blue}{a}\right)\right) \]
    10. Simplified68.9%

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

    if -5.9999999999999996e-289 < b

    1. Initial program 35.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right)\right)\right) \]
      7. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \color{blue}{b}\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), \color{blue}{b}\right)\right)\right) \]
      9. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\left(b \cdot b\right), \left(\left(4 \cdot a\right) \cdot c\right)\right)\right), b\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\left(4 \cdot a\right) \cdot c\right)\right)\right), b\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\left(a \cdot 4\right) \cdot c\right)\right)\right), b\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(4 \cdot c\right)\right)\right)\right), b\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(4 \cdot c\right)\right)\right)\right), b\right)\right)\right) \]
      15. *-lowering-*.f6435.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, 2\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(4, c\right)\right)\right)\right), b\right)\right)\right) \]
    4. Applied egg-rr35.5%

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{b}{c} + \frac{a}{b}\right)}\right) \]
    6. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{a}{b} + \left(\mathsf{neg}\left(\frac{b}{c}\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{a}{b} - \color{blue}{\frac{b}{c}}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(\frac{a}{b}\right), \color{blue}{\left(\frac{b}{c}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(a, b\right), \left(\frac{\color{blue}{b}}{c}\right)\right)\right) \]
      6. /-lowering-/.f6463.4%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(a, b\right), \mathsf{/.f64}\left(b, \color{blue}{c}\right)\right)\right) \]
    7. Simplified63.4%

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

Alternative 7: 68.7% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 70.9%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified70.2%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right) \cdot b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      3. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(-2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{-2 \cdot \left(a \cdot c\right)}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(-2 \cdot \left(a \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(a \cdot c\right) \cdot -2\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left(b \cdot b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      16. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(0 - b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      17. --lowering--.f6464.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{\_.f64}\left(0, b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. Simplified64.7%

      \[\leadsto \frac{\color{blue}{\left(2 + \frac{a \cdot \left(c \cdot -2\right)}{b \cdot b}\right) \cdot \left(0 - b\right)}}{a \cdot 2} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \frac{c}{b} + \left(\mathsf{neg}\left(\frac{b}{a}\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \frac{c}{b} - \color{blue}{\frac{b}{a}} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{c}{b}\right), \color{blue}{\left(\frac{b}{a}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \left(\frac{\color{blue}{b}}{a}\right)\right) \]
      6. /-lowering-/.f6467.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(c, b\right), \mathsf{/.f64}\left(b, \color{blue}{a}\right)\right) \]
    10. Simplified67.4%

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

    if -9.999999999999969e-311 < b

    1. Initial program 34.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6464.2%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified64.2%

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

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

Alternative 8: 68.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{b}{a}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\color{blue}{\mathsf{neg}\left(a\right)}} \]
      3. mul-1-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(b, \color{blue}{\left(-1 \cdot a\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(b, \left(\mathsf{neg}\left(a\right)\right)\right) \]
      6. neg-lowering-neg.f6467.0%

        \[\leadsto \mathsf{/.f64}\left(b, \mathsf{neg.f64}\left(a\right)\right) \]
    5. Simplified67.0%

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

    if -9.999999999999969e-311 < b

    1. Initial program 34.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
      4. /-lowering-/.f6464.2%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
    5. Simplified64.2%

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

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

Alternative 9: 43.7% accurate, 11.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.3 \cdot 10^{-12}:\\
\;\;\;\;0 - \frac{b}{a}\\

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


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

    1. Initial program 69.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{b}{a}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\color{blue}{\mathsf{neg}\left(a\right)}} \]
      3. mul-1-negN/A

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

        \[\leadsto \mathsf{/.f64}\left(b, \color{blue}{\left(-1 \cdot a\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(b, \left(\mathsf{neg}\left(a\right)\right)\right) \]
      6. neg-lowering-neg.f6448.9%

        \[\leadsto \mathsf{/.f64}\left(b, \mathsf{neg.f64}\left(a\right)\right) \]
    5. Simplified48.9%

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

    if 3.3000000000000001e-12 < b

    1. Initial program 12.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. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
    3. Simplified12.4%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right) \cdot b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      3. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(-2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{-2 \cdot \left(a \cdot c\right)}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(-2 \cdot \left(a \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(a \cdot c\right) \cdot -2\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left(b \cdot b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      16. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(0 - b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
      17. --lowering--.f642.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{\_.f64}\left(0, b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{\color{blue}{\left(2 + \frac{a \cdot \left(c \cdot -2\right)}{b \cdot b}\right) \cdot \left(0 - b\right)}}{a \cdot 2} \]
    8. Taylor expanded in a around inf

      \[\leadsto \color{blue}{\frac{c}{b}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f6424.1%

        \[\leadsto \mathsf{/.f64}\left(c, \color{blue}{b}\right) \]
    10. Simplified24.1%

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

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

Alternative 10: 11.1% 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 53.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. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{2} \cdot a\right)\right) \]
    3. unsub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{2} \cdot a\right)\right) \]
    5. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    6. sub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(4 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 4\right) \cdot c\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    11. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(4 \cdot c\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 4\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    14. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    15. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(4\right)\right)\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(2 \cdot a\right)\right) \]
    17. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -4\right)\right)\right)\right), b\right), \left(a \cdot \color{blue}{2}\right)\right) \]
  3. Simplified52.9%

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right) \cdot b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    3. distribute-rgt-neg-inN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(-2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{-2 \cdot \left(a \cdot c\right)}{{b}^{2}}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(-2 \cdot \left(a \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(a \cdot c\right) \cdot -2\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    9. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(a \cdot \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(-2 \cdot c\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left({b}^{2}\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \left(b \cdot b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    15. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    16. neg-sub0N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(0 - b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
    17. --lowering--.f6434.0%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -2\right)\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{\_.f64}\left(0, b\right)\right), \mathsf{*.f64}\left(a, 2\right)\right) \]
  7. Simplified34.0%

    \[\leadsto \frac{\color{blue}{\left(2 + \frac{a \cdot \left(c \cdot -2\right)}{b \cdot b}\right) \cdot \left(0 - b\right)}}{a \cdot 2} \]
  8. Taylor expanded in a around inf

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  9. Step-by-step derivation
    1. /-lowering-/.f649.0%

      \[\leadsto \mathsf{/.f64}\left(c, \color{blue}{b}\right) \]
  10. Simplified9.0%

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

Reproduce

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