quadp (p42, positive)

Percentage Accurate: 52.7% → 85.5%
Time: 5.0s
Alternatives: 6
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 52.7% accurate, 1.0× speedup?

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

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

Alternative 1: 85.5% accurate, N/A× speedup?

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

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

\mathbf{elif}\;b \leq 2.65 \cdot 10^{-118}:\\
\;\;\;\;-1 \cdot \frac{b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{0.5}}{2 \cdot a}\\

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


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

    1. Initial program 51.9%

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{-1 \cdot b}}{2 \cdot a} \]
    4. Step-by-step derivation
      1. lower-*.f6497.1

        \[\leadsto \frac{\left(-b\right) + -1 \cdot \color{blue}{b}}{2 \cdot a} \]
    5. Applied rewrites97.1%

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

    if -9.79999999999999992e119 < b < 2.65000000000000019e-118

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.65000000000000019e-118 < b

    1. Initial program 14.1%

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

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

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

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

        \[\leadsto \frac{c}{b} \cdot -1 \]
    5. Applied rewrites88.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -9.8 \cdot 10^{+119}:\\ \;\;\;\;\frac{-1 \cdot b + -1 \cdot b}{2 \cdot a}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-118}:\\ \;\;\;\;-1 \cdot \frac{b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{0.5}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 85.4% accurate, N/A× speedup?

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

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

\mathbf{elif}\;b \leq 2.65 \cdot 10^{-118}:\\
\;\;\;\;-1 \cdot \frac{b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{0.5}}{2 \cdot a}\\

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


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

    1. Initial program 51.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, \frac{1}{a}\right) \cdot b\right) \cdot -1 \]
      10. inv-powN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
      11. lower-pow.f6496.9

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
    5. Applied rewrites96.9%

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

    if -1.2e120 < b < 2.65000000000000019e-118

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.65000000000000019e-118 < b

    1. Initial program 14.1%

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

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

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

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

        \[\leadsto \frac{c}{b} \cdot -1 \]
    5. Applied rewrites88.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.2 \cdot 10^{+120}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-118}:\\ \;\;\;\;-1 \cdot \frac{b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{0.5}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 85.4% accurate, N/A× speedup?

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

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

\mathbf{elif}\;b \leq 2.65 \cdot 10^{-118}:\\
\;\;\;\;-1 \cdot \frac{b}{2 \cdot a} + 0.5 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right)\\

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


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

    1. Initial program 51.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, \frac{1}{a}\right) \cdot b\right) \cdot -1 \]
      10. inv-powN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
      11. lower-pow.f6496.9

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
    5. Applied rewrites96.9%

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

    if -1.2e120 < b < 2.65000000000000019e-118

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{0.5}}{2 \cdot a}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{\color{blue}{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{\frac{1}{2}}}}{2 \cdot a} \]
      2. lift-pow.f64N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left(\color{blue}{{b}^{1}}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{\frac{1}{2}}}{2 \cdot a} \]
      3. lift-pow.f64N/A

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{{\color{blue}{\left({b}^{1} \cdot {b}^{1} + -4 \cdot \left(c \cdot a\right)\right)}}^{\frac{1}{2}}}{2 \cdot a} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{{\left({b}^{1} \cdot {b}^{1} + -4 \cdot \color{blue}{\left(c \cdot a\right)}\right)}^{\frac{1}{2}}}{2 \cdot a} \]
      6. lift-*.f64N/A

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{{\left({b}^{1} \cdot {b}^{1} + -4 \cdot \left(c \cdot a\right)\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right)}}}{2 \cdot a} \]
      8. pow-negN/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{\color{blue}{\frac{1}{{\left({b}^{1} \cdot {b}^{1} + -4 \cdot \left(c \cdot a\right)\right)}^{\frac{-1}{2}}}}}{2 \cdot a} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{\color{blue}{\frac{1}{{\left({b}^{1} \cdot {b}^{1} + -4 \cdot \left(c \cdot a\right)\right)}^{\frac{-1}{2}}}}}{2 \cdot a} \]
      10. lower-pow.f64N/A

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

      \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{\color{blue}{\frac{1}{{\left(\mathsf{fma}\left({\left(\left|b\right|\right)}^{1}, {\left(\left|b\right|\right)}^{1}, \left(-4 \cdot a\right) \cdot c\right)\right)}^{-0.5}}}}{2 \cdot a} \]
    7. Taylor expanded in b around 0

      \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \color{blue}{\frac{1}{2} \cdot \left(\frac{1}{a} \cdot \sqrt{-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}\right)} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left(\frac{1}{a} \cdot \color{blue}{\sqrt{-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}}\right) \]
      3. inv-powN/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left({a}^{-1} \cdot \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}}\right) \]
      4. lift-pow.f64N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left({a}^{-1} \cdot \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}}\right) \]
      5. pow1/2N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left({a}^{-1} \cdot {\left(-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
      6. lower-pow.f64N/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left({a}^{-1} \cdot {\left(-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}\right)}^{\color{blue}{\frac{1}{2}}}\right) \]
      7. lower-fma.f64N/A

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

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, \left|b\right| \cdot \left|b\right|\right)\right)}^{\frac{1}{2}}\right) \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \frac{1}{2} \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{\frac{1}{2}}\right) \]
      11. lower-*.f6477.3

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + 0.5 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right) \]
    9. Applied rewrites77.3%

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

    if 2.65000000000000019e-118 < b

    1. Initial program 14.1%

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

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

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

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

        \[\leadsto \frac{c}{b} \cdot -1 \]
    5. Applied rewrites88.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.2 \cdot 10^{+120}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-118}:\\ \;\;\;\;-1 \cdot \frac{b}{2 \cdot a} + 0.5 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 74.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{+117}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1\\ \mathbf{elif}\;b \leq -6.8 \cdot 10^{-304}:\\ \;\;\;\;b \cdot \left(0.5 \cdot \left({\left(a \cdot b\right)}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right) - 0.5 \cdot {a}^{-1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5.8e+117)
   (* (* (fma (/ c (* b b)) -1.0 (pow a -1.0)) b) -1.0)
   (if (<= b -6.8e-304)
     (*
      b
      (-
       (* 0.5 (* (pow (* a b) -1.0) (pow (fma -4.0 (* a c) (* b b)) 0.5)))
       (* 0.5 (pow a -1.0))))
     (* (/ c b) -1.0))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.8e+117) {
		tmp = (fma((c / (b * b)), -1.0, pow(a, -1.0)) * b) * -1.0;
	} else if (b <= -6.8e-304) {
		tmp = b * ((0.5 * (pow((a * b), -1.0) * pow(fma(-4.0, (a * c), (b * b)), 0.5))) - (0.5 * pow(a, -1.0)));
	} else {
		tmp = (c / b) * -1.0;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -5.8e+117)
		tmp = Float64(Float64(fma(Float64(c / Float64(b * b)), -1.0, (a ^ -1.0)) * b) * -1.0);
	elseif (b <= -6.8e-304)
		tmp = Float64(b * Float64(Float64(0.5 * Float64((Float64(a * b) ^ -1.0) * (fma(-4.0, Float64(a * c), Float64(b * b)) ^ 0.5))) - Float64(0.5 * (a ^ -1.0))));
	else
		tmp = Float64(Float64(c / b) * -1.0);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -5.8e+117], N[(N[(N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] * -1.0 + N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * -1.0), $MachinePrecision], If[LessEqual[b, -6.8e-304], N[(b * N[(N[(0.5 * N[(N[Power[N[(a * b), $MachinePrecision], -1.0], $MachinePrecision] * N[Power[N[(-4.0 * N[(a * c), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq -6.8 \cdot 10^{-304}:\\
\;\;\;\;b \cdot \left(0.5 \cdot \left({\left(a \cdot b\right)}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right) - 0.5 \cdot {a}^{-1}\right)\\

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


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

    1. Initial program 51.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, \frac{1}{a}\right) \cdot b\right) \cdot -1 \]
      10. inv-powN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
      11. lower-pow.f6496.9

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
    5. Applied rewrites96.9%

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

    if -5.80000000000000055e117 < b < -6.7999999999999997e-304

    1. Initial program 84.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot b}{2 \cdot a} + \frac{{\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, -4 \cdot \left(c \cdot a\right)\right)\right)}^{0.5}}{2 \cdot a}} \]
    5. Applied rewrites24.9%

      \[\leadsto \color{blue}{\frac{{\left(\frac{b}{a} \cdot -0.5\right)}^{2} - \frac{{\left(\mathsf{fma}\left({\left(\left|b\right|\right)}^{1}, {\left(\left|b\right|\right)}^{1}, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.5}}{a \cdot 2} \cdot \frac{{\left(\mathsf{fma}\left({\left(\left|b\right|\right)}^{1}, {\left(\left|b\right|\right)}^{1}, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.5}}{a \cdot 2}}{\frac{b}{a} \cdot -0.5 - \frac{{\left(\mathsf{fma}\left({\left(\left|b\right|\right)}^{1}, {\left(\left|b\right|\right)}^{1}, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.5}}{a \cdot 2}}} \]
    6. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(\frac{1}{2} \cdot \left(\frac{1}{a \cdot b} \cdot \sqrt{-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}\right) - \frac{1}{2} \cdot \frac{1}{a}\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto b \cdot \left(\frac{1}{2} \cdot \left(\frac{1}{a \cdot b} \cdot \sqrt{-4 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}\right) - \color{blue}{\frac{1}{2} \cdot \frac{1}{a}}\right) \]
    8. Applied rewrites62.8%

      \[\leadsto \color{blue}{b \cdot \left(0.5 \cdot \left({\left(a \cdot b\right)}^{-1} \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right) - 0.5 \cdot {a}^{-1}\right)} \]

    if -6.7999999999999997e-304 < b

    1. Initial program 21.8%

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

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

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

        \[\leadsto \frac{c}{b} \cdot \color{blue}{-1} \]
      3. lower-/.f6475.9

        \[\leadsto \frac{c}{b} \cdot -1 \]
    5. Applied rewrites75.9%

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

Alternative 5: 67.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4e-310)
   (* (* (fma (/ c (* b b)) -1.0 (pow a -1.0)) b) -1.0)
   (* (/ c b) -1.0)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4e-310) {
		tmp = (fma((c / (b * b)), -1.0, pow(a, -1.0)) * b) * -1.0;
	} else {
		tmp = (c / b) * -1.0;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -4e-310)
		tmp = Float64(Float64(fma(Float64(c / Float64(b * b)), -1.0, (a ^ -1.0)) * b) * -1.0);
	else
		tmp = Float64(Float64(c / b) * -1.0);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -4e-310], N[(N[(N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] * -1.0 + N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * -1.0), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -1.0), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, \frac{1}{a}\right) \cdot b\right) \cdot -1 \]
      10. inv-powN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
      11. lower-pow.f6471.9

        \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
    5. Applied rewrites71.9%

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

    if -3.999999999999988e-310 < b

    1. Initial program 21.9%

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

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

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

        \[\leadsto \frac{c}{b} \cdot \color{blue}{-1} \]
      3. lower-/.f6476.5

        \[\leadsto \frac{c}{b} \cdot -1 \]
    5. Applied rewrites76.5%

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

Alternative 6: 34.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \end{array} \]
(FPCore (a b c)
 :precision binary64
 (* (* (fma (/ c (* b b)) -1.0 (pow a -1.0)) b) -1.0))
double code(double a, double b, double c) {
	return (fma((c / (b * b)), -1.0, pow(a, -1.0)) * b) * -1.0;
}
function code(a, b, c)
	return Float64(Float64(fma(Float64(c / Float64(b * b)), -1.0, (a ^ -1.0)) * b) * -1.0)
end
code[a_, b_, c_] := N[(N[(N[(N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision] * -1.0 + N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * -1.0), $MachinePrecision]
\begin{array}{l}

\\
\left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1
\end{array}
Derivation
  1. Initial program 47.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, \frac{1}{a}\right) \cdot b\right) \cdot -1 \]
    10. inv-powN/A

      \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
    11. lower-pow.f6440.1

      \[\leadsto \left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1 \]
  5. Applied rewrites40.1%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\frac{c}{b \cdot b}, -1, {a}^{-1}\right) \cdot b\right) \cdot -1} \]
  6. Add Preprocessing

Reproduce

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

  :alt
  (! :herbie-platform c (let ((sqtD (let ((x (* (sqrt (fabs a)) (sqrt (fabs c))))) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2)) x)) (sqrt (+ (fabs (/ b 2)) x))) (hypot (/ b 2) x))))) (if (< b 0) (/ (- sqtD (/ b 2)) a) (/ (- c) (+ (/ b 2) sqtD)))))

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