The quadratic formula (r1)

Percentage Accurate: 52.7% → 89.3%
Time: 4.8s
Alternatives: 9
Speedup: N/A×

Specification

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 52.7% accurate, 1.0× speedup?

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

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

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ t_1 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\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}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+205}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
        (t_1 (fma -1.0 (/ c (fabs b)) (/ (fma -0.5 b (* 0.5 (fabs b))) a))))
   (if (<= t_0 (- INFINITY))
     t_1
     (if (<= t_0 -5e-278)
       (+
        (/ (* -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)))
       (if (<= t_0 0.0) t_1 (if (<= t_0 5e+205) t_0 t_1))))))
double code(double a, double b, double c) {
	double t_0 = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	double t_1 = fma(-1.0, (c / fabs(b)), (fma(-0.5, b, (0.5 * fabs(b))) / a));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_0 <= -5e-278) {
		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 if (t_0 <= 0.0) {
		tmp = t_1;
	} else if (t_0 <= 5e+205) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
	t_1 = fma(-1.0, Float64(c / abs(b)), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_0 <= -5e-278)
		tmp = Float64(Float64(Float64(-1.0 * 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)));
	elseif (t_0 <= 0.0)
		tmp = t_1;
	elseif (t_0 <= 5e+205)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 * N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -5e-278], N[(N[(N[(-1.0 * b), $MachinePrecision] / N[(2.0 * a), $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], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+205], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
t_1 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;\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}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+205}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -4.99999999999999985e-278 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 0.0 or 5.0000000000000002e205 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 24.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites23.1%

      \[\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} \]
    6. Taylor expanded in c around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
      6. div-addN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
      10. lift-fabs.f6486.6

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
    8. Applied rewrites86.6%

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

    if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999985e-278

    1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 5.0000000000000002e205

    1. Initial program 92.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \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}\\ t_1 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ t_2 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+205}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0
         (+
          (/ (* -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))))
        (t_1 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
        (t_2 (fma -1.0 (/ c (fabs b)) (/ (fma -0.5 b (* 0.5 (fabs b))) a))))
   (if (<= t_1 (- INFINITY))
     t_2
     (if (<= t_1 -5e-278)
       t_0
       (if (<= t_1 0.0) t_2 (if (<= t_1 5e+205) t_0 t_2))))))
double code(double a, double b, double c) {
	double t_0 = ((-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));
	double t_1 = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	double t_2 = fma(-1.0, (c / fabs(b)), (fma(-0.5, b, (0.5 * fabs(b))) / a));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 <= -5e-278) {
		tmp = t_0;
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 5e+205) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(Float64(-1.0 * 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)))
	t_1 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
	t_2 = fma(-1.0, Float64(c / abs(b)), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_1 <= -5e-278)
		tmp = t_0;
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 5e+205)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(-1.0 * b), $MachinePrecision] / N[(2.0 * a), $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]}, Block[{t$95$1 = N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 * N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, -5e-278], t$95$0, If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 5e+205], t$95$0, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \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}\\
t_1 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
t_2 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+205}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -4.99999999999999985e-278 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 0.0 or 5.0000000000000002e205 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 24.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites23.1%

      \[\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} \]
    6. Taylor expanded in c around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
      6. div-addN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
      10. lift-fabs.f6486.6

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
    8. Applied rewrites86.6%

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

    if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999985e-278 or 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 5.0000000000000002e205

    1. Initial program 93.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1 \cdot b}{2 \cdot a}\\ t_1 := {\left(\left|b\right|\right)}^{1}\\ t_2 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ t_3 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_0 + \frac{\frac{1}{{\left(\mathsf{fma}\left(t\_1, t\_1, \left(-4 \cdot a\right) \cdot c\right)\right)}^{-0.5}}}{2 \cdot a}\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+205}:\\ \;\;\;\;t\_0 + \left(0.5 \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (* -1.0 b) (* 2.0 a)))
        (t_1 (pow (fabs b) 1.0))
        (t_2 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
        (t_3 (fma -1.0 (/ c (fabs b)) (/ (fma -0.5 b (* 0.5 (fabs b))) a))))
   (if (<= t_2 (- INFINITY))
     t_3
     (if (<= t_2 -5e-278)
       (+ t_0 (/ (/ 1.0 (pow (fma t_1 t_1 (* (* -4.0 a) c)) -0.5)) (* 2.0 a)))
       (if (<= t_2 0.0)
         t_3
         (if (<= t_2 5e+205)
           (+
            t_0
            (* (* 0.5 (pow a -1.0)) (pow (fma (* -4.0 a) c (* b b)) 0.5)))
           t_3))))))
double code(double a, double b, double c) {
	double t_0 = (-1.0 * b) / (2.0 * a);
	double t_1 = pow(fabs(b), 1.0);
	double t_2 = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	double t_3 = fma(-1.0, (c / fabs(b)), (fma(-0.5, b, (0.5 * fabs(b))) / a));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_3;
	} else if (t_2 <= -5e-278) {
		tmp = t_0 + ((1.0 / pow(fma(t_1, t_1, ((-4.0 * a) * c)), -0.5)) / (2.0 * a));
	} else if (t_2 <= 0.0) {
		tmp = t_3;
	} else if (t_2 <= 5e+205) {
		tmp = t_0 + ((0.5 * pow(a, -1.0)) * pow(fma((-4.0 * a), c, (b * b)), 0.5));
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(-1.0 * b) / Float64(2.0 * a))
	t_1 = abs(b) ^ 1.0
	t_2 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
	t_3 = fma(-1.0, Float64(c / abs(b)), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_3;
	elseif (t_2 <= -5e-278)
		tmp = Float64(t_0 + Float64(Float64(1.0 / (fma(t_1, t_1, Float64(Float64(-4.0 * a) * c)) ^ -0.5)) / Float64(2.0 * a)));
	elseif (t_2 <= 0.0)
		tmp = t_3;
	elseif (t_2 <= 5e+205)
		tmp = Float64(t_0 + Float64(Float64(0.5 * (a ^ -1.0)) * (fma(Float64(-4.0 * a), c, Float64(b * b)) ^ 0.5)));
	else
		tmp = t_3;
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(-1.0 * b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Abs[b], $MachinePrecision], 1.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-1.0 * N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -5e-278], N[(t$95$0 + N[(N[(1.0 / N[Power[N[(t$95$1 * t$95$1 + N[(N[(-4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], t$95$3, If[LessEqual[t$95$2, 5e+205], N[(t$95$0 + N[(N[(0.5 * N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(-4.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1 \cdot b}{2 \cdot a}\\
t_1 := {\left(\left|b\right|\right)}^{1}\\
t_2 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
t_3 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_0 + \frac{\frac{1}{{\left(\mathsf{fma}\left(t\_1, t\_1, \left(-4 \cdot a\right) \cdot c\right)\right)}^{-0.5}}}{2 \cdot a}\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+205}:\\
\;\;\;\;t\_0 + \left(0.5 \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}\\

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -4.99999999999999985e-278 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 0.0 or 5.0000000000000002e205 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 24.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites23.1%

      \[\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} \]
    6. Taylor expanded in c around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
      6. div-addN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
      10. lift-fabs.f6486.6

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
    8. Applied rewrites86.6%

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

    if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999985e-278

    1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites93.5%

      \[\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} \]

    if 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 5.0000000000000002e205

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites92.6%

      \[\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} \]
    6. 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)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \left(\frac{1}{2} \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{\frac{1}{2}} \]
      15. lift-*.f6492.6

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

      \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \color{blue}{\left(0.5 \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1 \cdot b}{2 \cdot a} + \left(0.5 \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}\\ t_1 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ t_2 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+205}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0
         (+
          (/ (* -1.0 b) (* 2.0 a))
          (* (* 0.5 (pow a -1.0)) (pow (fma (* -4.0 a) c (* b b)) 0.5))))
        (t_1 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
        (t_2 (fma -1.0 (/ c (fabs b)) (/ (fma -0.5 b (* 0.5 (fabs b))) a))))
   (if (<= t_1 (- INFINITY))
     t_2
     (if (<= t_1 -5e-278)
       t_0
       (if (<= t_1 0.0) t_2 (if (<= t_1 5e+205) t_0 t_2))))))
double code(double a, double b, double c) {
	double t_0 = ((-1.0 * b) / (2.0 * a)) + ((0.5 * pow(a, -1.0)) * pow(fma((-4.0 * a), c, (b * b)), 0.5));
	double t_1 = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	double t_2 = fma(-1.0, (c / fabs(b)), (fma(-0.5, b, (0.5 * fabs(b))) / a));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 <= -5e-278) {
		tmp = t_0;
	} else if (t_1 <= 0.0) {
		tmp = t_2;
	} else if (t_1 <= 5e+205) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(Float64(-1.0 * b) / Float64(2.0 * a)) + Float64(Float64(0.5 * (a ^ -1.0)) * (fma(Float64(-4.0 * a), c, Float64(b * b)) ^ 0.5)))
	t_1 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
	t_2 = fma(-1.0, Float64(c / abs(b)), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_1 <= -5e-278)
		tmp = t_0;
	elseif (t_1 <= 0.0)
		tmp = t_2;
	elseif (t_1 <= 5e+205)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(-1.0 * b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(-4.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 * N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, -5e-278], t$95$0, If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 5e+205], t$95$0, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1 \cdot b}{2 \cdot a} + \left(0.5 \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}\\
t_1 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
t_2 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+205}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -4.99999999999999985e-278 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 0.0 or 5.0000000000000002e205 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 24.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites23.1%

      \[\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} \]
    6. Taylor expanded in c around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
      6. div-addN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
      10. lift-fabs.f6486.6

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
    8. Applied rewrites86.6%

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

    if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999985e-278 or 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 5.0000000000000002e205

    1. Initial program 93.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites93.1%

      \[\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} \]
    6. 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)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \left(\frac{1}{2} \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{\frac{1}{2}} \]
      15. lift-*.f6493.0

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

      \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \color{blue}{\left(0.5 \cdot {a}^{-1}\right) \cdot {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ t_1 := 0.5 \cdot {a}^{-1}\\ t_2 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\ t_3 := {\left(a \cdot b\right)}^{-1}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+229}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;b \cdot \left(0.5 \cdot \left(t\_3 \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right) - t\_1\right)\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 10^{+194}:\\ \;\;\;\;\left(-1 \cdot b\right) \cdot \mathsf{fma}\left(-0.5 \cdot t\_3, {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}, t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
        (t_1 (* 0.5 (pow a -1.0)))
        (t_2 (fma -1.0 (/ c (fabs b)) (/ (fma -0.5 b (* 0.5 (fabs b))) a)))
        (t_3 (pow (* a b) -1.0)))
   (if (<= t_0 -4e+229)
     t_2
     (if (<= t_0 -5e-278)
       (* b (- (* 0.5 (* t_3 (pow (fma -4.0 (* a c) (* b b)) 0.5))) t_1))
       (if (<= t_0 0.0)
         t_2
         (if (<= t_0 1e+194)
           (*
            (* -1.0 b)
            (fma (* -0.5 t_3) (pow (fma (* -4.0 a) c (* b b)) 0.5) t_1))
           t_2))))))
double code(double a, double b, double c) {
	double t_0 = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	double t_1 = 0.5 * pow(a, -1.0);
	double t_2 = fma(-1.0, (c / fabs(b)), (fma(-0.5, b, (0.5 * fabs(b))) / a));
	double t_3 = pow((a * b), -1.0);
	double tmp;
	if (t_0 <= -4e+229) {
		tmp = t_2;
	} else if (t_0 <= -5e-278) {
		tmp = b * ((0.5 * (t_3 * pow(fma(-4.0, (a * c), (b * b)), 0.5))) - t_1);
	} else if (t_0 <= 0.0) {
		tmp = t_2;
	} else if (t_0 <= 1e+194) {
		tmp = (-1.0 * b) * fma((-0.5 * t_3), pow(fma((-4.0 * a), c, (b * b)), 0.5), t_1);
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
	t_1 = Float64(0.5 * (a ^ -1.0))
	t_2 = fma(-1.0, Float64(c / abs(b)), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
	t_3 = Float64(a * b) ^ -1.0
	tmp = 0.0
	if (t_0 <= -4e+229)
		tmp = t_2;
	elseif (t_0 <= -5e-278)
		tmp = Float64(b * Float64(Float64(0.5 * Float64(t_3 * (fma(-4.0, Float64(a * c), Float64(b * b)) ^ 0.5))) - t_1));
	elseif (t_0 <= 0.0)
		tmp = t_2;
	elseif (t_0 <= 1e+194)
		tmp = Float64(Float64(-1.0 * b) * fma(Float64(-0.5 * t_3), (fma(Float64(-4.0 * a), c, Float64(b * b)) ^ 0.5), t_1));
	else
		tmp = t_2;
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 * N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(a * b), $MachinePrecision], -1.0], $MachinePrecision]}, If[LessEqual[t$95$0, -4e+229], t$95$2, If[LessEqual[t$95$0, -5e-278], N[(b * N[(N[(0.5 * N[(t$95$3 * N[Power[N[(-4.0 * N[(a * c), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 1e+194], N[(N[(-1.0 * b), $MachinePrecision] * N[(N[(-0.5 * t$95$3), $MachinePrecision] * N[Power[N[(N[(-4.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
t_1 := 0.5 \cdot {a}^{-1}\\
t_2 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\
t_3 := {\left(a \cdot b\right)}^{-1}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+229}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;b \cdot \left(0.5 \cdot \left(t\_3 \cdot {\left(\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)\right)}^{0.5}\right) - t\_1\right)\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_0 \leq 10^{+194}:\\
\;\;\;\;\left(-1 \cdot b\right) \cdot \mathsf{fma}\left(-0.5 \cdot t\_3, {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}, t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4e229 or -4.99999999999999985e-278 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 0.0 or 9.99999999999999945e193 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
    3. Applied rewrites26.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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites26.0%

      \[\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} \]
    6. Taylor expanded in c around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
      6. div-addN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
      10. lift-fabs.f6485.9

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
    8. Applied rewrites85.9%

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

    if -4e229 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999985e-278

    1. Initial program 93.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. Applied rewrites47.6%

      \[\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}}} \]
    5. 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)} \]
    6. 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) \]
    7. Applied rewrites74.0%

      \[\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 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 9.99999999999999945e193

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. Applied rewrites60.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b \cdot -1, a \cdot 2, \left(a \cdot 2\right) \cdot {\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}\right)}{{\left(a \cdot 2\right)}^{2}}} \]
    5. Taylor expanded in b around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(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)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot b\right) \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. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(\color{blue}{\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) \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \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)} \]
      4. mul-1-negN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(\color{blue}{\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) \]
      5. lift-*.f64N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(\color{blue}{\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) \]
      6. associate-*r*N/A

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot b\right) \cdot \mathsf{fma}\left(-0.5 \cdot {\left(a \cdot b\right)}^{-1}, {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}, 0.5 \cdot {a}^{-1}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-1 \cdot b\right) \cdot \mathsf{fma}\left(-0.5 \cdot {\left(a \cdot b\right)}^{-1}, {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}, 0.5 \cdot {a}^{-1}\right)\\ t_1 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\ t_2 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{+229}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+194}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0
         (*
          (* -1.0 b)
          (fma
           (* -0.5 (pow (* a b) -1.0))
           (pow (fma (* -4.0 a) c (* b b)) 0.5)
           (* 0.5 (pow a -1.0)))))
        (t_1 (fma -1.0 (/ c (fabs b)) (/ (fma -0.5 b (* 0.5 (fabs b))) a)))
        (t_2 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))
   (if (<= t_2 -4e+229)
     t_1
     (if (<= t_2 -5e-278)
       t_0
       (if (<= t_2 0.0) t_1 (if (<= t_2 1e+194) t_0 t_1))))))
double code(double a, double b, double c) {
	double t_0 = (-1.0 * b) * fma((-0.5 * pow((a * b), -1.0)), pow(fma((-4.0 * a), c, (b * b)), 0.5), (0.5 * pow(a, -1.0)));
	double t_1 = fma(-1.0, (c / fabs(b)), (fma(-0.5, b, (0.5 * fabs(b))) / a));
	double t_2 = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	double tmp;
	if (t_2 <= -4e+229) {
		tmp = t_1;
	} else if (t_2 <= -5e-278) {
		tmp = t_0;
	} else if (t_2 <= 0.0) {
		tmp = t_1;
	} else if (t_2 <= 1e+194) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(-1.0 * b) * fma(Float64(-0.5 * (Float64(a * b) ^ -1.0)), (fma(Float64(-4.0 * a), c, Float64(b * b)) ^ 0.5), Float64(0.5 * (a ^ -1.0))))
	t_1 = fma(-1.0, Float64(c / abs(b)), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
	t_2 = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
	tmp = 0.0
	if (t_2 <= -4e+229)
		tmp = t_1;
	elseif (t_2 <= -5e-278)
		tmp = t_0;
	elseif (t_2 <= 0.0)
		tmp = t_1;
	elseif (t_2 <= 1e+194)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(-1.0 * b), $MachinePrecision] * N[(N[(-0.5 * N[Power[N[(a * b), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(-4.0 * a), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 * N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+229], t$95$1, If[LessEqual[t$95$2, -5e-278], t$95$0, If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 1e+194], t$95$0, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(-1 \cdot b\right) \cdot \mathsf{fma}\left(-0.5 \cdot {\left(a \cdot b\right)}^{-1}, {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}, 0.5 \cdot {a}^{-1}\right)\\
t_1 := \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)\\
t_2 := \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+229}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+194}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4e229 or -4.99999999999999985e-278 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 0.0 or 9.99999999999999945e193 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot b}{2 \cdot a} + \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
    3. Applied rewrites26.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}} \]
    4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
    5. Applied rewrites26.0%

      \[\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} \]
    6. Taylor expanded in c around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
      6. div-addN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
      10. lift-fabs.f6485.9

        \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
    8. Applied rewrites85.9%

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

    if -4e229 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999985e-278 or 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 9.99999999999999945e193

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    4. Applied rewrites60.3%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b \cdot -1, a \cdot 2, \left(a \cdot 2\right) \cdot {\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}\right)}{{\left(a \cdot 2\right)}^{2}}} \]
    5. Taylor expanded in b around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(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)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot b\right) \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. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(\color{blue}{\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) \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \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)} \]
      4. mul-1-negN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(\color{blue}{\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) \]
      5. lift-*.f64N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(\color{blue}{\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) \]
      6. associate-*r*N/A

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot b\right) \cdot \mathsf{fma}\left(-0.5 \cdot {\left(a \cdot b\right)}^{-1}, {\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}^{0.5}, 0.5 \cdot {a}^{-1}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 66.4% accurate, N/A× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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}} \]
  4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
  5. Applied rewrites51.9%

    \[\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} \]
  6. Taylor expanded in c around 0

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
    6. div-addN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
    10. lift-fabs.f6466.4

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
  8. Applied rewrites66.4%

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

Alternative 8: 64.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-1, \frac{c}{e^{\log \left(\left|b\right|\right) \cdot 1}}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -1.0
  (/ c (exp (* (log (fabs b)) 1.0)))
  (/ (fma -0.5 b (* 0.5 (fabs b))) a)))
double code(double a, double b, double c) {
	return fma(-1.0, (c / exp((log(fabs(b)) * 1.0))), (fma(-0.5, b, (0.5 * fabs(b))) / a));
}
function code(a, b, c)
	return fma(-1.0, Float64(c / exp(Float64(log(abs(b)) * 1.0))), Float64(fma(-0.5, b, Float64(0.5 * abs(b))) / a))
end
code[a_, b_, c_] := N[(-1.0 * N[(c / N[Exp[N[(N[Log[N[Abs[b], $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * b + N[(0.5 * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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}} \]
  4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
  5. Applied rewrites51.9%

    \[\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} \]
  6. Taylor expanded in c around 0

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
    6. div-addN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
    10. lift-fabs.f6466.4

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
  8. Applied rewrites66.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right)} \]
  9. Step-by-step derivation
    1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{e^{\log \left(\left|b\right|\right) \cdot 1}}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
    7. lift-fabs.f6464.4

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{e^{\log \left(\left|b\right|\right) \cdot 1}}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
  10. Applied rewrites64.4%

    \[\leadsto \mathsf{fma}\left(-1, \frac{c}{e^{\log \left(\left|b\right|\right) \cdot 1}}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
  11. Add Preprocessing

Alternative 9: 38.4% accurate, N/A× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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}} \]
  4. 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} + \color{blue}{-4 \cdot \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} + -4 \cdot \color{blue}{\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} \]
  5. Applied rewrites51.9%

    \[\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} \]
  6. Taylor expanded in c around 0

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\frac{-1}{2} \cdot b}{a} + \frac{\frac{1}{2} \cdot \left|b\right|}{a}\right) \]
    6. div-addN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(\frac{-1}{2}, b, \frac{1}{2} \cdot \left|b\right|\right)}{a}\right) \]
    10. lift-fabs.f6466.4

      \[\leadsto \mathsf{fma}\left(-1, \frac{c}{\left|b\right|}, \frac{\mathsf{fma}\left(-0.5, b, 0.5 \cdot \left|b\right|\right)}{a}\right) \]
  8. Applied rewrites66.4%

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

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

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

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

      \[\leadsto -1 \cdot \left(b \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{c}{\left|b\right|} + \frac{1}{2} \cdot \frac{\left|b\right|}{a}}{\color{blue}{b}}, \frac{1}{2} \cdot \frac{1}{a}\right)\right) \]
  11. Applied rewrites38.4%

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

Reproduce

?
herbie shell --seed 2025093 
(FPCore (a b c)
  :name "The quadratic formula (r1)"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))