Quadratic roots, full range

Percentage Accurate: 53.0% → 85.2%
Time: 10.2s
Alternatives: 9
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 53.0% accurate, 1.0× speedup?

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

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

Alternative 1: 85.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 1.42 \cdot 10^{-98}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \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 < -1.00000000000000004e154

    1. Initial program 43.1%

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

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

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

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

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

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

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

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

    if -1.00000000000000004e154 < b < 1.41999999999999999e-98

    1. Initial program 87.2%

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

    if 1.41999999999999999e-98 < b

    1. Initial program 19.2%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac93.5%

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

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

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

Alternative 2: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 74.9%

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

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

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

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

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

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

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

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

    if -1.5500000000000001e-90 < b < 3.4999999999999999e-99

    1. Initial program 74.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      10. add-sqr-sqrt71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{b} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      11. fma-neg71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}}\right) \]
      12. *-commutative71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
      13. distribute-rgt-neg-in71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)}\right) \]
      14. *-commutative71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
      15. distribute-rgt-neg-in71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)}\right) \]
      16. metadata-eval71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
    5. Applied egg-rr71.0%

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

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

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

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

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

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

    if 3.4999999999999999e-99 < b

    1. Initial program 19.2%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac93.5%

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

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

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

Alternative 3: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 74.9%

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

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

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

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

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

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

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

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

    if -1.5000000000000001e-90 < b < 8.0000000000000002e-99

    1. Initial program 74.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      10. add-sqr-sqrt71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{b} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \]
      11. fma-neg71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}}\right) \]
      12. *-commutative71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
      13. distribute-rgt-neg-in71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)}\right) \]
      14. *-commutative71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
      15. distribute-rgt-neg-in71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)}\right) \]
      16. metadata-eval71.0%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
    5. Applied egg-rr71.0%

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

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

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

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

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

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

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

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

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

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

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

    if 8.0000000000000002e-99 < b

    1. Initial program 19.2%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac93.5%

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

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

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

Alternative 4: 80.2% accurate, 1.0× 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 1.05 \cdot 10^{-98}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\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 1.05e-98)
     (/ (- (sqrt (* c (* a -4.0))) 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 <= 1.05e-98) {
		tmp = (sqrt((c * (a * -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 <= (-3d-69)) then
        tmp = (c / b) - (b / a)
    else if (b <= 1.05d-98) then
        tmp = (sqrt((c * (a * (-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 <= -3e-69) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.05e-98) {
		tmp = (Math.sqrt((c * (a * -4.0))) - 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 <= 1.05e-98:
		tmp = (math.sqrt((c * (a * -4.0))) - 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 <= 1.05e-98)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / 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 <= 1.05e-98)
		tmp = (sqrt((c * (a * -4.0))) - 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, 1.05e-98], N[(N[(N[Sqrt[N[(c * N[(a * -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 -3 \cdot 10^{-69}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 1.05 \cdot 10^{-98}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \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.99999999999999989e-69

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

    if -2.99999999999999989e-69 < b < 1.04999999999999996e-98

    1. Initial program 76.6%

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

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

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

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

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

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

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

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

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

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

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

    if 1.04999999999999996e-98 < b

    1. Initial program 19.2%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac93.5%

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

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

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

Alternative 5: 67.7% accurate, 12.8× speedup?

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

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

    if -5.0000000000022e-312 < b

    1. Initial program 28.5%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac77.3%

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

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

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

Alternative 6: 43.4% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 65.2%

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

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

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

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

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

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

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

    if 2.5000000000000001e75 < b

    1. Initial program 19.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}}\right) \]
      12. *-commutative3.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
      13. distribute-rgt-neg-in3.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)}\right) \]
      14. *-commutative3.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
      15. distribute-rgt-neg-in3.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)}\right) \]
      16. metadata-eval3.8%

        \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
    5. Applied egg-rr3.8%

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

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

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

Alternative 7: 67.5% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 75.8%

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

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

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

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

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

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

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

    if -5.0000000000022e-312 < b

    1. Initial program 28.5%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac77.3%

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

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

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

Alternative 8: 2.5% accurate, 38.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
    13. distribute-rgt-neg-in29.3%

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
    15. distribute-rgt-neg-in29.3%

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
  5. Applied egg-rr29.3%

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

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

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

Alternative 9: 10.9% 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 54.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
    13. distribute-rgt-neg-in29.3%

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
    15. distribute-rgt-neg-in29.3%

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
  5. Applied egg-rr29.3%

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

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

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

Reproduce

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