quadp (p42, positive)

Percentage Accurate: 51.7% → 85.4%
Time: 14.4s
Alternatives: 7
Speedup: 12.9×

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 7 alternatives:

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

Initial Program: 51.7% 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.4% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 65.8%

      \[\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.8%

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

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

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

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

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

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

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

    if -2.99999999999999983e69 < b < 5.8000000000000004e-85

    1. Initial program 88.6%

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

    if 5.8000000000000004e-85 < b

    1. Initial program 15.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. *-commutative15.5%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified85.2%

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

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

Alternative 2: 80.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 76.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. *-commutative76.9%

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

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

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

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

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

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

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

    if -2.35000000000000002e-94 < b < 2.29999999999999991e-81

    1. Initial program 82.7%

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

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

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

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

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

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

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

    if 2.29999999999999991e-81 < b

    1. Initial program 15.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. *-commutative15.5%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified85.2%

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

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

Alternative 3: 67.7% accurate, 9.7× 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(c / Float64(-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 77.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. *-commutative77.4%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

Alternative 4: 43.1% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 74.1%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified52.8%

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

    if 1.55e15 < b

    1. Initial program 11.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. *-commutative11.5%

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(-4 \cdot c, a, {b}^{2}\right)}}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-13.7%

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

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

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

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

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

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

        \[\leadsto \frac{1}{a \cdot \frac{2}{b + \sqrt{\color{blue}{\mathsf{fma}\left(a \cdot c, -4, {b}^{2}\right)}}}} \]
    8. Simplified3.7%

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

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

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

Alternative 5: 67.6% accurate, 12.9× 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(c / Float64(-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 77.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. *-commutative77.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified73.9%

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

    if -4.999999999999985e-310 < b

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

Alternative 6: 5.3% accurate, 38.7× speedup?

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

\\
\frac{a}{b}
\end{array}
Derivation
  1. Initial program 57.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. *-commutative57.3%

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(-4 \cdot c, a, {b}^{2}\right)}}\right)}^{-1}} \]
  7. Step-by-step derivation
    1. unpow-133.7%

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{a \cdot \frac{2}{\color{blue}{2 \cdot b}}} \]
  10. Step-by-step derivation
    1. *-commutative2.3%

      \[\leadsto \frac{1}{a \cdot \frac{2}{\color{blue}{b \cdot 2}}} \]
  11. Simplified2.3%

    \[\leadsto \frac{1}{a \cdot \frac{2}{\color{blue}{b \cdot 2}}} \]
  12. Step-by-step derivation
    1. add-exp-log1.4%

      \[\leadsto \color{blue}{e^{\log \left(\frac{1}{a \cdot \frac{2}{b \cdot 2}}\right)}} \]
    2. log-rec6.5%

      \[\leadsto e^{\color{blue}{-\log \left(a \cdot \frac{2}{b \cdot 2}\right)}} \]
    3. associate-*r/6.5%

      \[\leadsto e^{-\log \color{blue}{\left(\frac{a \cdot 2}{b \cdot 2}\right)}} \]
    4. *-commutative6.5%

      \[\leadsto e^{-\log \left(\frac{\color{blue}{2 \cdot a}}{b \cdot 2}\right)} \]
    5. *-commutative6.5%

      \[\leadsto e^{-\log \left(\frac{2 \cdot a}{\color{blue}{2 \cdot b}}\right)} \]
    6. times-frac6.5%

      \[\leadsto e^{-\log \color{blue}{\left(\frac{2}{2} \cdot \frac{a}{b}\right)}} \]
    7. metadata-eval6.5%

      \[\leadsto e^{-\log \left(\color{blue}{1} \cdot \frac{a}{b}\right)} \]
  13. Applied egg-rr6.5%

    \[\leadsto \color{blue}{e^{-\log \left(1 \cdot \frac{a}{b}\right)}} \]
  14. Step-by-step derivation
    1. add-sqr-sqrt5.7%

      \[\leadsto e^{\color{blue}{\sqrt{-\log \left(1 \cdot \frac{a}{b}\right)} \cdot \sqrt{-\log \left(1 \cdot \frac{a}{b}\right)}}} \]
    2. sqrt-unprod6.3%

      \[\leadsto e^{\color{blue}{\sqrt{\left(-\log \left(1 \cdot \frac{a}{b}\right)\right) \cdot \left(-\log \left(1 \cdot \frac{a}{b}\right)\right)}}} \]
    3. sqr-neg6.3%

      \[\leadsto e^{\sqrt{\color{blue}{\log \left(1 \cdot \frac{a}{b}\right) \cdot \log \left(1 \cdot \frac{a}{b}\right)}}} \]
    4. sqrt-unprod0.6%

      \[\leadsto e^{\color{blue}{\sqrt{\log \left(1 \cdot \frac{a}{b}\right)} \cdot \sqrt{\log \left(1 \cdot \frac{a}{b}\right)}}} \]
    5. add-sqr-sqrt4.6%

      \[\leadsto e^{\color{blue}{\log \left(1 \cdot \frac{a}{b}\right)}} \]
    6. add-exp-log5.7%

      \[\leadsto \color{blue}{1 \cdot \frac{a}{b}} \]
    7. div-inv5.7%

      \[\leadsto 1 \cdot \color{blue}{\left(a \cdot \frac{1}{b}\right)} \]
    8. *-un-lft-identity5.7%

      \[\leadsto \color{blue}{a \cdot \frac{1}{b}} \]
  15. Applied egg-rr5.7%

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

      \[\leadsto \color{blue}{\frac{a \cdot 1}{b}} \]
    2. *-rgt-identity5.7%

      \[\leadsto \frac{\color{blue}{a}}{b} \]
  17. Simplified5.7%

    \[\leadsto \color{blue}{\frac{a}{b}} \]
  18. Final simplification5.7%

    \[\leadsto \frac{a}{b} \]
  19. Add Preprocessing

Alternative 7: 10.6% 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 57.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. *-commutative57.3%

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{b + \sqrt{\mathsf{fma}\left(-4 \cdot c, a, {b}^{2}\right)}}\right)}^{-1}} \]
  7. Step-by-step derivation
    1. unpow-133.7%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  10. Final simplification10.1%

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

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 2024044 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64
  :herbie-expected 10

  :alt
  (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)))