quad2m (problem 3.2.1, negative)

Percentage Accurate: 51.5% → 84.8%
Time: 3.7s
Alternatives: 10
Speedup: 1.7×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
	return (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
	return (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c):
	return (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c)
	return Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a)
end
function tmp = code(a, b_2, c)
	tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 51.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
	return (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
	return (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c):
	return (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c)
	return Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a)
end
function tmp = code(a, b_2, c)
	tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 84.8% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;b\_2 \leq 6.2 \cdot 10^{+65}:\\
\;\;\;\;\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


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

    1. Initial program 15.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{-1 \cdot \frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2}} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2}\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -\frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2} \]
      3. lower-/.f64N/A

        \[\leadsto -\frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2} \]
      4. *-commutativeN/A

        \[\leadsto -\frac{\frac{a \cdot {c}^{2}}{{b\_2}^{2}} \cdot \frac{1}{8} + \frac{1}{2} \cdot c}{b\_2} \]
      5. lower-fma.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{a \cdot {c}^{2}}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      6. lower-/.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{a \cdot {c}^{2}}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      7. *-commutativeN/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{{c}^{2} \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      8. lower-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{{c}^{2} \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      9. unpow2N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      10. lower-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      11. pow2N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      12. lift-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      13. lower-*.f6470.0

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, 0.125, 0.5 \cdot c\right)}{b\_2} \]
    4. Applied rewrites70.0%

      \[\leadsto \color{blue}{-\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, 0.125, 0.5 \cdot c\right)}{b\_2}} \]
    5. Taylor expanded in c around 0

      \[\leadsto -\frac{c \cdot \left(\frac{1}{2} + \frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}}\right)}{b\_2} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto -\frac{\left(\frac{1}{2} + \frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}}\right) \cdot c}{b\_2} \]
      2. lower-*.f64N/A

        \[\leadsto -\frac{\left(\frac{1}{2} + \frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}}\right) \cdot c}{b\_2} \]
      3. +-commutativeN/A

        \[\leadsto -\frac{\left(\frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}} + \frac{1}{2}\right) \cdot c}{b\_2} \]
      4. *-commutativeN/A

        \[\leadsto -\frac{\left(\frac{a \cdot c}{{b\_2}^{2}} \cdot \frac{1}{8} + \frac{1}{2}\right) \cdot c}{b\_2} \]
      5. lower-fma.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{a \cdot c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      6. associate-/l*N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      7. lower-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      8. lower-/.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      9. pow2N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      10. lift-*.f6487.4

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, 0.125, 0.5\right) \cdot c}{b\_2} \]
    7. Applied rewrites87.4%

      \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, 0.125, 0.5\right) \cdot c}{b\_2} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      2. lift-/.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      3. associate-/r*N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{\frac{c}{b\_2}}{b\_2}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      4. lower-/.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{\frac{c}{b\_2}}{b\_2}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      5. lower-/.f6487.3

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{\frac{c}{b\_2}}{b\_2}, 0.125, 0.5\right) \cdot c}{b\_2} \]
    9. Applied rewrites87.3%

      \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{\frac{c}{b\_2}}{b\_2}, 0.125, 0.5\right) \cdot c}{b\_2} \]

    if -3.49999999999999991e-48 < b_2 < 6.19999999999999981e65

    1. Initial program 76.8%

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

    if 6.19999999999999981e65 < b_2

    1. Initial program 58.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6494.7

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites94.7%

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

Alternative 2: 84.6% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;b\_2 \leq 6.2 \cdot 10^{+65}:\\
\;\;\;\;\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


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

    1. Initial program 15.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{-1 \cdot \frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2}} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2}\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -\frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2} \]
      3. lower-/.f64N/A

        \[\leadsto -\frac{\frac{1}{8} \cdot \frac{a \cdot {c}^{2}}{{b\_2}^{2}} + \frac{1}{2} \cdot c}{b\_2} \]
      4. *-commutativeN/A

        \[\leadsto -\frac{\frac{a \cdot {c}^{2}}{{b\_2}^{2}} \cdot \frac{1}{8} + \frac{1}{2} \cdot c}{b\_2} \]
      5. lower-fma.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{a \cdot {c}^{2}}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      6. lower-/.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{a \cdot {c}^{2}}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      7. *-commutativeN/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{{c}^{2} \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      8. lower-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{{c}^{2} \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      9. unpow2N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      10. lower-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      11. pow2N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      12. lift-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2} \cdot c\right)}{b\_2} \]
      13. lower-*.f6470.0

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, 0.125, 0.5 \cdot c\right)}{b\_2} \]
    4. Applied rewrites70.0%

      \[\leadsto \color{blue}{-\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot a}{b\_2 \cdot b\_2}, 0.125, 0.5 \cdot c\right)}{b\_2}} \]
    5. Taylor expanded in c around 0

      \[\leadsto -\frac{c \cdot \left(\frac{1}{2} + \frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}}\right)}{b\_2} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto -\frac{\left(\frac{1}{2} + \frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}}\right) \cdot c}{b\_2} \]
      2. lower-*.f64N/A

        \[\leadsto -\frac{\left(\frac{1}{2} + \frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}}\right) \cdot c}{b\_2} \]
      3. +-commutativeN/A

        \[\leadsto -\frac{\left(\frac{1}{8} \cdot \frac{a \cdot c}{{b\_2}^{2}} + \frac{1}{2}\right) \cdot c}{b\_2} \]
      4. *-commutativeN/A

        \[\leadsto -\frac{\left(\frac{a \cdot c}{{b\_2}^{2}} \cdot \frac{1}{8} + \frac{1}{2}\right) \cdot c}{b\_2} \]
      5. lower-fma.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(\frac{a \cdot c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      6. associate-/l*N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      7. lower-*.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      8. lower-/.f64N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{{b\_2}^{2}}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      9. pow2N/A

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, \frac{1}{8}, \frac{1}{2}\right) \cdot c}{b\_2} \]
      10. lift-*.f6487.4

        \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, 0.125, 0.5\right) \cdot c}{b\_2} \]
    7. Applied rewrites87.4%

      \[\leadsto -\frac{\mathsf{fma}\left(a \cdot \frac{c}{b\_2 \cdot b\_2}, 0.125, 0.5\right) \cdot c}{b\_2} \]

    if -3.49999999999999991e-48 < b_2 < 6.19999999999999981e65

    1. Initial program 76.8%

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

    if 6.19999999999999981e65 < b_2

    1. Initial program 58.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6494.7

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites94.7%

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

Alternative 3: 84.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b\_2 \leq -4.6 \cdot 10^{-63}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{elif}\;b\_2 \leq 6.2 \cdot 10^{+65}:\\ \;\;\;\;\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_2}{a} \cdot -2\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -4.6e-63)
   (* -0.5 (/ c b_2))
   (if (<= b_2 6.2e+65)
     (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a)
     (* (/ b_2 a) -2.0))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -4.6e-63) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 6.2e+65) {
		tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-4.6d-63)) then
        tmp = (-0.5d0) * (c / b_2)
    else if (b_2 <= 6.2d+65) then
        tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a
    else
        tmp = (b_2 / a) * (-2.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -4.6e-63) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 6.2e+65) {
		tmp = (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -4.6e-63:
		tmp = -0.5 * (c / b_2)
	elif b_2 <= 6.2e+65:
		tmp = (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
	else:
		tmp = (b_2 / a) * -2.0
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -4.6e-63)
		tmp = Float64(-0.5 * Float64(c / b_2));
	elseif (b_2 <= 6.2e+65)
		tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a);
	else
		tmp = Float64(Float64(b_2 / a) * -2.0);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -4.6e-63)
		tmp = -0.5 * (c / b_2);
	elseif (b_2 <= 6.2e+65)
		tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
	else
		tmp = (b_2 / a) * -2.0;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4.6e-63], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 6.2e+65], N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(b$95$2 / a), $MachinePrecision] * -2.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -4.6 \cdot 10^{-63}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{elif}\;b\_2 \leq 6.2 \cdot 10^{+65}:\\
\;\;\;\;\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -4.6e-63

    1. Initial program 16.9%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6486.3

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites86.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -4.6e-63 < b_2 < 6.19999999999999981e65

    1. Initial program 77.7%

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

    if 6.19999999999999981e65 < b_2

    1. Initial program 58.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6494.7

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites94.7%

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

Alternative 4: 80.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b\_2 \leq -4.6 \cdot 10^{-63}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{elif}\;b\_2 \leq 7 \cdot 10^{+22}:\\ \;\;\;\;\frac{\left(-b\_2\right) - \sqrt{\left(-a\right) \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_2}{a} \cdot -2\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -4.6e-63)
   (* -0.5 (/ c b_2))
   (if (<= b_2 7e+22)
     (/ (- (- b_2) (sqrt (* (- a) c))) a)
     (* (/ b_2 a) -2.0))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -4.6e-63) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 7e+22) {
		tmp = (-b_2 - sqrt((-a * c))) / a;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-4.6d-63)) then
        tmp = (-0.5d0) * (c / b_2)
    else if (b_2 <= 7d+22) then
        tmp = (-b_2 - sqrt((-a * c))) / a
    else
        tmp = (b_2 / a) * (-2.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -4.6e-63) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 7e+22) {
		tmp = (-b_2 - Math.sqrt((-a * c))) / a;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -4.6e-63:
		tmp = -0.5 * (c / b_2)
	elif b_2 <= 7e+22:
		tmp = (-b_2 - math.sqrt((-a * c))) / a
	else:
		tmp = (b_2 / a) * -2.0
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -4.6e-63)
		tmp = Float64(-0.5 * Float64(c / b_2));
	elseif (b_2 <= 7e+22)
		tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(-a) * c))) / a);
	else
		tmp = Float64(Float64(b_2 / a) * -2.0);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -4.6e-63)
		tmp = -0.5 * (c / b_2);
	elseif (b_2 <= 7e+22)
		tmp = (-b_2 - sqrt((-a * c))) / a;
	else
		tmp = (b_2 / a) * -2.0;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4.6e-63], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 7e+22], N[(N[((-b$95$2) - N[Sqrt[N[((-a) * c), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(b$95$2 / a), $MachinePrecision] * -2.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -4.6 \cdot 10^{-63}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{elif}\;b\_2 \leq 7 \cdot 10^{+22}:\\
\;\;\;\;\frac{\left(-b\_2\right) - \sqrt{\left(-a\right) \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -4.6e-63

    1. Initial program 16.9%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6486.3

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites86.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -4.6e-63 < b_2 < 7e22

    1. Initial program 76.3%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around inf

      \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\color{blue}{-1 \cdot \left(a \cdot c\right)}}}{a} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\left(\mathsf{neg}\left(a\right)\right) \cdot c}}{a} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{c}}}{a} \]
      4. lower-neg.f6462.1

        \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\left(-a\right) \cdot c}}{a} \]
    4. Applied rewrites62.1%

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

    if 7e22 < b_2

    1. Initial program 62.7%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6492.3

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites92.3%

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

Alternative 5: 79.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b\_2 \leq -4.6 \cdot 10^{-63}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{elif}\;b\_2 \leq 2.1 \cdot 10^{-57}:\\ \;\;\;\;\frac{-\sqrt{\left(-a\right) \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_2}{a} \cdot -2\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -4.6e-63)
   (* -0.5 (/ c b_2))
   (if (<= b_2 2.1e-57) (/ (- (sqrt (* (- a) c))) a) (* (/ b_2 a) -2.0))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -4.6e-63) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 2.1e-57) {
		tmp = -sqrt((-a * c)) / a;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-4.6d-63)) then
        tmp = (-0.5d0) * (c / b_2)
    else if (b_2 <= 2.1d-57) then
        tmp = -sqrt((-a * c)) / a
    else
        tmp = (b_2 / a) * (-2.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -4.6e-63) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 2.1e-57) {
		tmp = -Math.sqrt((-a * c)) / a;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -4.6e-63:
		tmp = -0.5 * (c / b_2)
	elif b_2 <= 2.1e-57:
		tmp = -math.sqrt((-a * c)) / a
	else:
		tmp = (b_2 / a) * -2.0
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -4.6e-63)
		tmp = Float64(-0.5 * Float64(c / b_2));
	elseif (b_2 <= 2.1e-57)
		tmp = Float64(Float64(-sqrt(Float64(Float64(-a) * c))) / a);
	else
		tmp = Float64(Float64(b_2 / a) * -2.0);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -4.6e-63)
		tmp = -0.5 * (c / b_2);
	elseif (b_2 <= 2.1e-57)
		tmp = -sqrt((-a * c)) / a;
	else
		tmp = (b_2 / a) * -2.0;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4.6e-63], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 2.1e-57], N[((-N[Sqrt[N[((-a) * c), $MachinePrecision]], $MachinePrecision]) / a), $MachinePrecision], N[(N[(b$95$2 / a), $MachinePrecision] * -2.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -4.6 \cdot 10^{-63}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{elif}\;b\_2 \leq 2.1 \cdot 10^{-57}:\\
\;\;\;\;\frac{-\sqrt{\left(-a\right) \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -4.6e-63

    1. Initial program 16.9%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6486.3

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites86.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -4.6e-63 < b_2 < 2.0999999999999999e-57

    1. Initial program 73.3%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around inf

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\sqrt{a \cdot c} \cdot \sqrt{-1}\right)}}{a} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\sqrt{a \cdot c} \cdot \sqrt{-1}\right)}{a} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{-\sqrt{a \cdot c} \cdot \sqrt{-1}}{a} \]
      3. sqrt-unprodN/A

        \[\leadsto \frac{-\sqrt{\left(a \cdot c\right) \cdot -1}}{a} \]
      4. *-commutativeN/A

        \[\leadsto \frac{-\sqrt{-1 \cdot \left(a \cdot c\right)}}{a} \]
      5. lower-sqrt.f64N/A

        \[\leadsto \frac{-\sqrt{-1 \cdot \left(a \cdot c\right)}}{a} \]
      6. associate-*r*N/A

        \[\leadsto \frac{-\sqrt{\left(-1 \cdot a\right) \cdot c}}{a} \]
      7. mul-1-negN/A

        \[\leadsto \frac{-\sqrt{\left(\mathsf{neg}\left(a\right)\right) \cdot c}}{a} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{-\sqrt{\left(\mathsf{neg}\left(a\right)\right) \cdot c}}{a} \]
      9. lower-neg.f6465.3

        \[\leadsto \frac{-\sqrt{\left(-a\right) \cdot c}}{a} \]
    4. Applied rewrites65.3%

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

    if 2.0999999999999999e-57 < b_2

    1. Initial program 67.9%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6487.0

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites87.0%

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

Alternative 6: 69.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{-c}{a}}\\ \mathbf{if}\;b\_2 \leq -1.5 \cdot 10^{-64}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{elif}\;b\_2 \leq -4.5 \cdot 10^{-177}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b\_2 \leq 1.15 \cdot 10^{-285}:\\ \;\;\;\;-t\_0\\ \mathbf{elif}\;b\_2 \leq 3.5 \cdot 10^{-55}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_2}{a} \cdot -2\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (let* ((t_0 (sqrt (/ (- c) a))))
   (if (<= b_2 -1.5e-64)
     (* -0.5 (/ c b_2))
     (if (<= b_2 -4.5e-177)
       t_0
       (if (<= b_2 1.15e-285)
         (- t_0)
         (if (<= b_2 3.5e-55) t_0 (* (/ b_2 a) -2.0)))))))
double code(double a, double b_2, double c) {
	double t_0 = sqrt((-c / a));
	double tmp;
	if (b_2 <= -1.5e-64) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= -4.5e-177) {
		tmp = t_0;
	} else if (b_2 <= 1.15e-285) {
		tmp = -t_0;
	} else if (b_2 <= 3.5e-55) {
		tmp = t_0;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((-c / a))
    if (b_2 <= (-1.5d-64)) then
        tmp = (-0.5d0) * (c / b_2)
    else if (b_2 <= (-4.5d-177)) then
        tmp = t_0
    else if (b_2 <= 1.15d-285) then
        tmp = -t_0
    else if (b_2 <= 3.5d-55) then
        tmp = t_0
    else
        tmp = (b_2 / a) * (-2.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double t_0 = Math.sqrt((-c / a));
	double tmp;
	if (b_2 <= -1.5e-64) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= -4.5e-177) {
		tmp = t_0;
	} else if (b_2 <= 1.15e-285) {
		tmp = -t_0;
	} else if (b_2 <= 3.5e-55) {
		tmp = t_0;
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
def code(a, b_2, c):
	t_0 = math.sqrt((-c / a))
	tmp = 0
	if b_2 <= -1.5e-64:
		tmp = -0.5 * (c / b_2)
	elif b_2 <= -4.5e-177:
		tmp = t_0
	elif b_2 <= 1.15e-285:
		tmp = -t_0
	elif b_2 <= 3.5e-55:
		tmp = t_0
	else:
		tmp = (b_2 / a) * -2.0
	return tmp
function code(a, b_2, c)
	t_0 = sqrt(Float64(Float64(-c) / a))
	tmp = 0.0
	if (b_2 <= -1.5e-64)
		tmp = Float64(-0.5 * Float64(c / b_2));
	elseif (b_2 <= -4.5e-177)
		tmp = t_0;
	elseif (b_2 <= 1.15e-285)
		tmp = Float64(-t_0);
	elseif (b_2 <= 3.5e-55)
		tmp = t_0;
	else
		tmp = Float64(Float64(b_2 / a) * -2.0);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	t_0 = sqrt((-c / a));
	tmp = 0.0;
	if (b_2 <= -1.5e-64)
		tmp = -0.5 * (c / b_2);
	elseif (b_2 <= -4.5e-177)
		tmp = t_0;
	elseif (b_2 <= 1.15e-285)
		tmp = -t_0;
	elseif (b_2 <= 3.5e-55)
		tmp = t_0;
	else
		tmp = (b_2 / a) * -2.0;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[Sqrt[N[((-c) / a), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$2, -1.5e-64], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, -4.5e-177], t$95$0, If[LessEqual[b$95$2, 1.15e-285], (-t$95$0), If[LessEqual[b$95$2, 3.5e-55], t$95$0, N[(N[(b$95$2 / a), $MachinePrecision] * -2.0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{-c}{a}}\\
\mathbf{if}\;b\_2 \leq -1.5 \cdot 10^{-64}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{elif}\;b\_2 \leq -4.5 \cdot 10^{-177}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b\_2 \leq 1.15 \cdot 10^{-285}:\\
\;\;\;\;-t\_0\\

\mathbf{elif}\;b\_2 \leq 3.5 \cdot 10^{-55}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b_2 < -1.5e-64

    1. Initial program 17.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6486.3

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites86.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -1.5e-64 < b_2 < -4.5000000000000003e-177 or 1.14999999999999998e-285 < b_2 < 3.50000000000000025e-55

    1. Initial program 73.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around -inf

      \[\leadsto \color{blue}{\sqrt{\frac{c}{a}} \cdot \sqrt{-1}} \]
    3. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      3. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      4. lower-/.f6428.5

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
    4. Applied rewrites28.5%

      \[\leadsto \color{blue}{\sqrt{\frac{c}{a} \cdot -1}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      2. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{-1 \cdot \frac{c}{a}} \]
      4. associate-*r/N/A

        \[\leadsto \sqrt{\frac{-1 \cdot c}{a}} \]
      5. mul-1-negN/A

        \[\leadsto \sqrt{\frac{\mathsf{neg}\left(c\right)}{a}} \]
      6. lower-/.f64N/A

        \[\leadsto \sqrt{\frac{\mathsf{neg}\left(c\right)}{a}} \]
      7. lower-neg.f6428.5

        \[\leadsto \sqrt{\frac{-c}{a}} \]
    6. Applied rewrites28.5%

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

    if -4.5000000000000003e-177 < b_2 < 1.14999999999999998e-285

    1. Initial program 72.5%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around inf

      \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\color{blue}{-1 \cdot \left(a \cdot c\right)}}}{a} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\left(\mathsf{neg}\left(a\right)\right) \cdot c}}{a} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{c}}}{a} \]
      4. lower-neg.f6472.5

        \[\leadsto \frac{\left(-b\_2\right) - \sqrt{\left(-a\right) \cdot c}}{a} \]
    4. Applied rewrites72.5%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{c}{a}} \cdot \sqrt{-1}\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\sqrt{\frac{c}{a}} \cdot \sqrt{-1}\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -\sqrt{\frac{c}{a}} \cdot \sqrt{-1} \]
      3. sqrt-prodN/A

        \[\leadsto -\sqrt{\frac{c}{a} \cdot -1} \]
      4. lower-sqrt.f64N/A

        \[\leadsto -\sqrt{\frac{c}{a} \cdot -1} \]
      5. *-commutativeN/A

        \[\leadsto -\sqrt{-1 \cdot \frac{c}{a}} \]
      6. associate-*r/N/A

        \[\leadsto -\sqrt{\frac{-1 \cdot c}{a}} \]
      7. mul-1-negN/A

        \[\leadsto -\sqrt{\frac{\mathsf{neg}\left(c\right)}{a}} \]
      8. lower-/.f64N/A

        \[\leadsto -\sqrt{\frac{\mathsf{neg}\left(c\right)}{a}} \]
      9. lower-neg.f6440.5

        \[\leadsto -\sqrt{\frac{-c}{a}} \]
    7. Applied rewrites40.5%

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

    if 3.50000000000000025e-55 < b_2

    1. Initial program 67.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6487.2

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites87.2%

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

Alternative 7: 68.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b\_2 \leq -1.5 \cdot 10^{-64}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{elif}\;b\_2 \leq 3.5 \cdot 10^{-55}:\\ \;\;\;\;\sqrt{\frac{-c}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_2}{a} \cdot -2\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -1.5e-64)
   (* -0.5 (/ c b_2))
   (if (<= b_2 3.5e-55) (sqrt (/ (- c) a)) (* (/ b_2 a) -2.0))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.5e-64) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 3.5e-55) {
		tmp = sqrt((-c / a));
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-1.5d-64)) then
        tmp = (-0.5d0) * (c / b_2)
    else if (b_2 <= 3.5d-55) then
        tmp = sqrt((-c / a))
    else
        tmp = (b_2 / a) * (-2.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.5e-64) {
		tmp = -0.5 * (c / b_2);
	} else if (b_2 <= 3.5e-55) {
		tmp = Math.sqrt((-c / a));
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -1.5e-64:
		tmp = -0.5 * (c / b_2)
	elif b_2 <= 3.5e-55:
		tmp = math.sqrt((-c / a))
	else:
		tmp = (b_2 / a) * -2.0
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -1.5e-64)
		tmp = Float64(-0.5 * Float64(c / b_2));
	elseif (b_2 <= 3.5e-55)
		tmp = sqrt(Float64(Float64(-c) / a));
	else
		tmp = Float64(Float64(b_2 / a) * -2.0);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -1.5e-64)
		tmp = -0.5 * (c / b_2);
	elseif (b_2 <= 3.5e-55)
		tmp = sqrt((-c / a));
	else
		tmp = (b_2 / a) * -2.0;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.5e-64], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 3.5e-55], N[Sqrt[N[((-c) / a), $MachinePrecision]], $MachinePrecision], N[(N[(b$95$2 / a), $MachinePrecision] * -2.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -1.5 \cdot 10^{-64}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{elif}\;b\_2 \leq 3.5 \cdot 10^{-55}:\\
\;\;\;\;\sqrt{\frac{-c}{a}}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -1.5e-64

    1. Initial program 17.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6486.3

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites86.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -1.5e-64 < b_2 < 3.50000000000000025e-55

    1. Initial program 73.4%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around -inf

      \[\leadsto \color{blue}{\sqrt{\frac{c}{a}} \cdot \sqrt{-1}} \]
    3. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      3. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      4. lower-/.f6430.1

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{\sqrt{\frac{c}{a} \cdot -1}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      2. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{c}{a} \cdot -1} \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{-1 \cdot \frac{c}{a}} \]
      4. associate-*r/N/A

        \[\leadsto \sqrt{\frac{-1 \cdot c}{a}} \]
      5. mul-1-negN/A

        \[\leadsto \sqrt{\frac{\mathsf{neg}\left(c\right)}{a}} \]
      6. lower-/.f64N/A

        \[\leadsto \sqrt{\frac{\mathsf{neg}\left(c\right)}{a}} \]
      7. lower-neg.f6430.1

        \[\leadsto \sqrt{\frac{-c}{a}} \]
    6. Applied rewrites30.1%

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

    if 3.50000000000000025e-55 < b_2

    1. Initial program 67.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6487.2

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites87.2%

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

Alternative 8: 66.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b\_2 \leq -2 \cdot 10^{-311}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_2}{a} \cdot -2\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2e-311) (* -0.5 (/ c b_2)) (* (/ b_2 a) -2.0)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2e-311) {
		tmp = -0.5 * (c / b_2);
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-2d-311)) then
        tmp = (-0.5d0) * (c / b_2)
    else
        tmp = (b_2 / a) * (-2.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2e-311) {
		tmp = -0.5 * (c / b_2);
	} else {
		tmp = (b_2 / a) * -2.0;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2e-311:
		tmp = -0.5 * (c / b_2)
	else:
		tmp = (b_2 / a) * -2.0
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2e-311)
		tmp = Float64(-0.5 * Float64(c / b_2));
	else
		tmp = Float64(Float64(b_2 / a) * -2.0);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2e-311)
		tmp = -0.5 * (c / b_2);
	else
		tmp = (b_2 / a) * -2.0;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e-311], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$2 / a), $MachinePrecision] * -2.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -2 \cdot 10^{-311}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{b\_2}{a} \cdot -2\\


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

    1. Initial program 31.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6466.9

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites66.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -1.9999999999999e-311 < b_2

    1. Initial program 72.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in a around 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b\_2}{a}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{b\_2}{a} \cdot \color{blue}{-2} \]
      3. lower-/.f6465.9

        \[\leadsto \frac{b\_2}{a} \cdot -2 \]
    4. Applied rewrites65.9%

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

Alternative 9: 47.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b\_2 \leq -2 \cdot 10^{-311}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b\_2}{a}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2e-311) (* -0.5 (/ c b_2)) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2e-311) {
		tmp = -0.5 * (c / b_2);
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-2d-311)) then
        tmp = (-0.5d0) * (c / b_2)
    else
        tmp = -b_2 / a
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2e-311) {
		tmp = -0.5 * (c / b_2);
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2e-311:
		tmp = -0.5 * (c / b_2)
	else:
		tmp = -b_2 / a
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2e-311)
		tmp = Float64(-0.5 * Float64(c / b_2));
	else
		tmp = Float64(Float64(-b_2) / a);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2e-311)
		tmp = -0.5 * (c / b_2);
	else
		tmp = -b_2 / a;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e-311], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -2 \cdot 10^{-311}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b\_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{-b\_2}{a}\\


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

    1. Initial program 31.8%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b\_2}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{c}{b\_2}} \]
      2. lower-/.f6466.9

        \[\leadsto -0.5 \cdot \frac{c}{\color{blue}{b\_2}} \]
    4. Applied rewrites66.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b\_2}} \]

    if -1.9999999999999e-311 < b_2

    1. Initial program 72.0%

      \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
    2. Taylor expanded in c around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(c \cdot \left(-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right) + \frac{b\_2}{a \cdot c}\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

        \[\leadsto \left(-c\right) \cdot \left(\color{blue}{-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)} + \frac{b\_2}{a \cdot c}\right) \]
      5. +-commutativeN/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{a \cdot c} + \color{blue}{-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)}\right) \]
      6. lower-+.f64N/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{a \cdot c} + \color{blue}{-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)}\right) \]
      7. lower-/.f64N/A

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

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + -1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + -1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(\mathsf{neg}\left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right)\right) \]
      11. lower-neg.f64N/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right) \]
      12. sqrt-unprodN/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
      13. lower-sqrt.f64N/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
      15. lower-/.f64N/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{c \cdot a} \cdot -1}\right)\right) \]
      17. lower-*.f6437.5

        \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{c \cdot a} \cdot -1}\right)\right) \]
    4. Applied rewrites37.5%

      \[\leadsto \color{blue}{\left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{c \cdot a} \cdot -1}\right)\right)} \]
    5. Taylor expanded in b_2 around inf

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

        \[\leadsto \frac{-1 \cdot b\_2}{a} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(b\_2\right)}{a} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(b\_2\right)}{a} \]
      4. lift-neg.f6426.8

        \[\leadsto \frac{-b\_2}{a} \]
    7. Applied rewrites26.8%

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

Alternative 10: 14.6% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \frac{-b\_2}{a} \end{array} \]
(FPCore (a b_2 c) :precision binary64 (/ (- b_2) a))
double code(double a, double b_2, double c) {
	return -b_2 / a;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b_2, c)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = -b_2 / a
end function
public static double code(double a, double b_2, double c) {
	return -b_2 / a;
}
def code(a, b_2, c):
	return -b_2 / a
function code(a, b_2, c)
	return Float64(Float64(-b_2) / a)
end
function tmp = code(a, b_2, c)
	tmp = -b_2 / a;
end
code[a_, b$95$2_, c_] := N[((-b$95$2) / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{-b\_2}{a}
\end{array}
Derivation
  1. Initial program 51.5%

    \[\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a} \]
  2. Taylor expanded in c around -inf

    \[\leadsto \color{blue}{-1 \cdot \left(c \cdot \left(-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right) + \frac{b\_2}{a \cdot c}\right)\right)} \]
  3. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

      \[\leadsto \left(-c\right) \cdot \left(\color{blue}{-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)} + \frac{b\_2}{a \cdot c}\right) \]
    5. +-commutativeN/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{a \cdot c} + \color{blue}{-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)}\right) \]
    6. lower-+.f64N/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{a \cdot c} + \color{blue}{-1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)}\right) \]
    7. lower-/.f64N/A

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

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + -1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right) \]
    9. lower-*.f64N/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + -1 \cdot \left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right) \]
    10. mul-1-negN/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(\mathsf{neg}\left(\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right)\right) \]
    11. lower-neg.f64N/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c}} \cdot \sqrt{-1}\right)\right) \]
    12. sqrt-unprodN/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
    13. lower-sqrt.f64N/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
    14. lower-*.f64N/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
    15. lower-/.f64N/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{a \cdot c} \cdot -1}\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{c \cdot a} \cdot -1}\right)\right) \]
    17. lower-*.f6431.5

      \[\leadsto \left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{c \cdot a} \cdot -1}\right)\right) \]
  4. Applied rewrites31.5%

    \[\leadsto \color{blue}{\left(-c\right) \cdot \left(\frac{b\_2}{c \cdot a} + \left(-\sqrt{\frac{1}{c \cdot a} \cdot -1}\right)\right)} \]
  5. Taylor expanded in b_2 around inf

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

      \[\leadsto \frac{-1 \cdot b\_2}{a} \]
    2. mul-1-negN/A

      \[\leadsto \frac{\mathsf{neg}\left(b\_2\right)}{a} \]
    3. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(b\_2\right)}{a} \]
    4. lift-neg.f6414.6

      \[\leadsto \frac{-b\_2}{a} \]
  7. Applied rewrites14.6%

    \[\leadsto \frac{-b\_2}{\color{blue}{a}} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2025101 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  :herbie-expected 10
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))