quadp (p42, positive)

Percentage Accurate: 52.2% → 85.7%
Time: 14.4s
Alternatives: 8
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 52.2% accurate, 1.0× speedup?

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

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

Alternative 1: 85.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{+71}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}{2 \cdot a}\\

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

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


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

    1. Initial program 50.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 2} \]
      2. associate-/l*97.8%

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

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

    if -1.09999999999999997e71 < b < 2.89999999999999988e-39

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

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

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

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

    if 2.89999999999999988e-39 < b

    1. Initial program 13.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.1 \cdot 10^{+71}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}{2 \cdot a}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-39}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 85.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.8 \cdot 10^{+70}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}{2 \cdot a}\\

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

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


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

    1. Initial program 50.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 2} \]
      2. associate-/l*97.8%

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

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

    if -7.79999999999999949e70 < b < 5.6000000000000003e-39

    1. Initial program 80.5%

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

    if 5.6000000000000003e-39 < b

    1. Initial program 13.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7.8 \cdot 10^{+70}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}{2 \cdot a}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{-39}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 81.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 65.0%

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

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

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

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

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

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

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

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

    if -2.4e-48 < b < 1.9999999999999999e-38

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e-38 < b

    1. Initial program 13.5%

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

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

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

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

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

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

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

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

Alternative 4: 81.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{-48}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}{2 \cdot a}\\

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

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


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

    1. Initial program 65.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 2} \]
      2. associate-/l*88.8%

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

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

    if -1.90000000000000001e-48 < b < 3.00000000000000028e-39

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.00000000000000028e-39 < b

    1. Initial program 13.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.9 \cdot 10^{-48}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}{2 \cdot a}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-39}:\\ \;\;\;\;\frac{b - \sqrt{c \cdot \left(a \cdot -4\right)}}{a} \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 5: 68.2% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 70.9%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 26.9%

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

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

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

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

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

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

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

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

Alternative 6: 43.6% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.9 \cdot 10^{+44}:\\
\;\;\;\;\frac{-b}{a}\\

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


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

    1. Initial program 64.9%

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

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

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

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

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

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

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

    if 1.9000000000000001e44 < b

    1. Initial program 8.3%

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

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

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

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

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

        \[\leadsto \frac{-2 \cdot \color{blue}{\frac{c}{\frac{b}{a}}}}{a \cdot 2} \]
    6. Simplified73.7%

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{c}{\frac{b}{a}}}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. clear-num71.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{-2 \cdot \frac{c}{\frac{b}{a}}}}} \]
      2. inv-pow71.5%

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

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

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

        \[\leadsto {\left(\color{blue}{-1} \cdot \frac{a}{\frac{c}{\frac{b}{a}}}\right)}^{-1} \]
      6. associate-/r/82.1%

        \[\leadsto {\left(-1 \cdot \frac{a}{\color{blue}{\frac{c}{b} \cdot a}}\right)}^{-1} \]
    8. Applied egg-rr82.1%

      \[\leadsto \color{blue}{{\left(-1 \cdot \frac{a}{\frac{c}{b} \cdot a}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-182.1%

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

        \[\leadsto \frac{1}{\color{blue}{-\frac{a}{\frac{c}{b} \cdot a}}} \]
      3. *-commutative82.1%

        \[\leadsto \frac{1}{-\frac{a}{\color{blue}{a \cdot \frac{c}{b}}}} \]
    10. Simplified82.1%

      \[\leadsto \color{blue}{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt52.3%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}} \cdot \sqrt{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}}} \]
      2. sqrt-unprod46.5%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}} \cdot \frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}}} \]
      3. frac-times46.5%

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

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\frac{a}{a \cdot \frac{c}{b}} \cdot \frac{a}{a \cdot \frac{c}{b}}}}} \]
      5. associate-/r*46.6%

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\frac{\frac{a}{a}}{\frac{c}{b}}} \cdot \frac{a}{a \cdot \frac{c}{b}}}} \]
      6. *-inverses46.6%

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{\color{blue}{1}}{\frac{c}{b}} \cdot \frac{a}{a \cdot \frac{c}{b}}}} \]
      7. clear-num46.6%

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\frac{b}{c}} \cdot \frac{a}{a \cdot \frac{c}{b}}}} \]
      8. associate-/r*49.3%

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{b}{c} \cdot \color{blue}{\frac{\frac{a}{a}}{\frac{c}{b}}}}} \]
      9. *-inverses49.3%

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{b}{c} \cdot \frac{\color{blue}{1}}{\frac{c}{b}}}} \]
      10. clear-num49.2%

        \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{b}{c} \cdot \color{blue}{\frac{b}{c}}}} \]
      11. frac-times49.2%

        \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{b}{c}} \cdot \frac{1}{\frac{b}{c}}}} \]
      12. clear-num49.2%

        \[\leadsto \sqrt{\color{blue}{\frac{c}{b}} \cdot \frac{1}{\frac{b}{c}}} \]
      13. clear-num49.3%

        \[\leadsto \sqrt{\frac{c}{b} \cdot \color{blue}{\frac{c}{b}}} \]
      14. sqrt-unprod27.7%

        \[\leadsto \color{blue}{\sqrt{\frac{c}{b}} \cdot \sqrt{\frac{c}{b}}} \]
      15. add-sqr-sqrt28.7%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
      16. expm1-log1p-u28.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \]
      17. expm1-udef29.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c}{b}\right)} - 1} \]
    12. Applied egg-rr29.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c}{b}\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def28.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \]
      2. expm1-log1p28.7%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
    14. Simplified28.7%

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

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

Alternative 7: 68.1% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 70.9%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 26.9%

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

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

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

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

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

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

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

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

Alternative 8: 10.8% accurate, 38.7× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{-2 \cdot \frac{c}{\frac{b}{a}}}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. clear-num28.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{-2 \cdot \frac{c}{\frac{b}{a}}}}} \]
    2. inv-pow28.6%

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

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

      \[\leadsto {\color{blue}{\left(\frac{2}{-2} \cdot \frac{a}{\frac{c}{\frac{b}{a}}}\right)}}^{-1} \]
    5. metadata-eval28.6%

      \[\leadsto {\left(\color{blue}{-1} \cdot \frac{a}{\frac{c}{\frac{b}{a}}}\right)}^{-1} \]
    6. associate-/r/31.7%

      \[\leadsto {\left(-1 \cdot \frac{a}{\color{blue}{\frac{c}{b} \cdot a}}\right)}^{-1} \]
  8. Applied egg-rr31.7%

    \[\leadsto \color{blue}{{\left(-1 \cdot \frac{a}{\frac{c}{b} \cdot a}\right)}^{-1}} \]
  9. Step-by-step derivation
    1. unpow-131.7%

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

      \[\leadsto \frac{1}{\color{blue}{-\frac{a}{\frac{c}{b} \cdot a}}} \]
    3. *-commutative31.7%

      \[\leadsto \frac{1}{-\frac{a}{\color{blue}{a \cdot \frac{c}{b}}}} \]
  10. Simplified31.7%

    \[\leadsto \color{blue}{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}} \]
  11. Step-by-step derivation
    1. add-sqr-sqrt19.8%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}} \cdot \sqrt{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}}} \]
    2. sqrt-unprod19.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{-\frac{a}{a \cdot \frac{c}{b}}} \cdot \frac{1}{-\frac{a}{a \cdot \frac{c}{b}}}}} \]
    3. frac-times19.2%

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

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\frac{a}{a \cdot \frac{c}{b}} \cdot \frac{a}{a \cdot \frac{c}{b}}}}} \]
    5. associate-/r*19.2%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\frac{\frac{a}{a}}{\frac{c}{b}}} \cdot \frac{a}{a \cdot \frac{c}{b}}}} \]
    6. *-inverses19.2%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{\color{blue}{1}}{\frac{c}{b}} \cdot \frac{a}{a \cdot \frac{c}{b}}}} \]
    7. clear-num19.2%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\frac{b}{c}} \cdot \frac{a}{a \cdot \frac{c}{b}}}} \]
    8. associate-/r*20.4%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{b}{c} \cdot \color{blue}{\frac{\frac{a}{a}}{\frac{c}{b}}}}} \]
    9. *-inverses20.4%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{b}{c} \cdot \frac{\color{blue}{1}}{\frac{c}{b}}}} \]
    10. clear-num20.4%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\frac{b}{c} \cdot \color{blue}{\frac{b}{c}}}} \]
    11. frac-times20.3%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{b}{c}} \cdot \frac{1}{\frac{b}{c}}}} \]
    12. clear-num20.4%

      \[\leadsto \sqrt{\color{blue}{\frac{c}{b}} \cdot \frac{1}{\frac{b}{c}}} \]
    13. clear-num20.4%

      \[\leadsto \sqrt{\frac{c}{b} \cdot \color{blue}{\frac{c}{b}}} \]
    14. sqrt-unprod9.3%

      \[\leadsto \color{blue}{\sqrt{\frac{c}{b}} \cdot \sqrt{\frac{c}{b}}} \]
    15. add-sqr-sqrt10.5%

      \[\leadsto \color{blue}{\frac{c}{b}} \]
    16. expm1-log1p-u10.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \]
    17. expm1-udef10.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c}{b}\right)} - 1} \]
  12. Applied egg-rr10.3%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c}{b}\right)} - 1} \]
  13. Step-by-step derivation
    1. expm1-def10.1%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \]
    2. expm1-log1p10.5%

      \[\leadsto \color{blue}{\frac{c}{b}} \]
  14. Simplified10.5%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  15. Final simplification10.5%

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

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{b}{2}\right|\\ t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\ t_2 := \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\ \;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\ \end{array}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{t_2 - \frac{b}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{\frac{b}{2} + t_2}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fabs (/ b 2.0)))
        (t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
        (t_2
         (if (== (copysign a c) a)
           (* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
           (hypot (/ b 2.0) t_1))))
   (if (< b 0.0) (/ (- t_2 (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) t_2)))))
double code(double a, double b, double c) {
	double t_0 = fabs((b / 2.0));
	double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
	double tmp;
	if (copysign(a, c) == a) {
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	} else {
		tmp = hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.abs((b / 2.0));
	double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
	double tmp;
	if (Math.copySign(a, c) == a) {
		tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
	} else {
		tmp = Math.hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.fabs((b / 2.0))
	t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c))
	tmp = 0
	if math.copysign(a, c) == a:
		tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1))
	else:
		tmp = math.hypot((b / 2.0), t_1)
	t_2 = tmp
	tmp_1 = 0
	if b < 0.0:
		tmp_1 = (t_2 - (b / 2.0)) / a
	else:
		tmp_1 = -c / ((b / 2.0) + t_2)
	return tmp_1
function code(a, b, c)
	t_0 = abs(Float64(b / 2.0))
	t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c)))
	tmp = 0.0
	if (copysign(a, c) == a)
		tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1)));
	else
		tmp = hypot(Float64(b / 2.0), t_1);
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b < 0.0)
		tmp_1 = Float64(Float64(t_2 - Float64(b / 2.0)) / a);
	else
		tmp_1 = Float64(Float64(-c) / Float64(Float64(b / 2.0) + t_2));
	end
	return tmp_1
end
function tmp_3 = code(a, b, c)
	t_0 = abs((b / 2.0));
	t_1 = sqrt(abs(a)) * sqrt(abs(c));
	tmp = 0.0;
	if ((sign(c) * abs(a)) == a)
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	else
		tmp = hypot((b / 2.0), t_1);
	end
	t_2 = tmp;
	tmp_2 = 0.0;
	if (b < 0.0)
		tmp_2 = (t_2 - (b / 2.0)) / a;
	else
		tmp_2 = -c / ((b / 2.0) + t_2);
	end
	tmp_3 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-c) / N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\


\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{t_2 - \frac{b}{2}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{\frac{b}{2} + t_2}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023322 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64
  :herbie-expected 10

  :herbie-target
  (if (< b 0.0) (/ (- (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))) (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))))))

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