Cubic critical

Percentage Accurate: 51.9% → 88.6%
Time: 4.6s
Alternatives: 6
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 51.9% accurate, 1.0× speedup?

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

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

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

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

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

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-196}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+266}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, t\_1\right)\\


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

    1. Initial program 25.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
      10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\left|b\right| + -1 \cdot b}{a} + c \cdot \left(c \cdot \left(\frac{-9}{16} \cdot \frac{{a}^{2} \cdot c}{{\left(\left|b\right|\right)}^{5}} + \frac{-3}{8} \cdot \frac{a}{{\left(\left|b\right|\right)}^{3}}\right) - \frac{1}{2} \cdot \frac{1}{\left|b\right|}\right)} \]
    8. Applied rewrites46.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{a}{{\left(\left|b\right|\right)}^{3}}, -0.375, \frac{-0.5625 \cdot \left(\left(a \cdot a\right) \cdot c\right)}{{\left(\left|b\right|\right)}^{5}}\right), c, -0.5 \cdot {\left(\left|b\right|\right)}^{-1}\right), c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)} \]
    9. Taylor expanded in a around 0

      \[\leadsto \mathsf{fma}\left(\frac{\frac{-1}{2}}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot \frac{1}{3}\right) \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right) \]
    11. Applied rewrites72.7%

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

    if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -1e-196 or 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 4.0000000000000001e266

    1. Initial program 90.7%

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

    if -1e-196 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 0.0

    1. Initial program 18.6%

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

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

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

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

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

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

    if 4.0000000000000001e266 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 35.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
      10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{\left|b\right|} + \frac{1}{3} \cdot \frac{\left|b\right| + -1 \cdot b}{a}} \]
    8. Step-by-step derivation
      1. Applied rewrites78.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)} \]
    9. Recombined 4 regimes into one program.
    10. Final simplification85.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -1 \cdot 10^{-196}:\\ \;\;\;\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq 0:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq 4 \cdot 10^{+266}:\\ \;\;\;\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ \end{array} \]
    11. Add Preprocessing

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

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ t_1 := \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\\ t_2 := \mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, t\_1\right)\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-196}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+266}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, t\_1\right)\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (let* ((t_0 (/ (+ (* -1.0 b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
            (t_1 (* (/ (fma -1.0 b (fabs b)) a) 0.3333333333333333))
            (t_2
             (fma
              (* (pow a -1.0) 0.3333333333333333)
              (pow (fma (pow b 1.0) (pow b 1.0) (* (* c a) -3.0)) 0.5)
              (* -0.3333333333333333 (/ b a)))))
       (if (<= t_0 (- INFINITY))
         (fma (/ -0.5 (fabs b)) c t_1)
         (if (<= t_0 -1e-196)
           t_2
           (if (<= t_0 0.0)
             (* (/ c b) -0.5)
             (if (<= t_0 4e+266) t_2 (fma (/ c (fabs b)) -0.5 t_1)))))))
    double code(double a, double b, double c) {
    	double t_0 = ((-1.0 * b) + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
    	double t_1 = (fma(-1.0, b, fabs(b)) / a) * 0.3333333333333333;
    	double t_2 = fma((pow(a, -1.0) * 0.3333333333333333), pow(fma(pow(b, 1.0), pow(b, 1.0), ((c * a) * -3.0)), 0.5), (-0.3333333333333333 * (b / a)));
    	double tmp;
    	if (t_0 <= -((double) INFINITY)) {
    		tmp = fma((-0.5 / fabs(b)), c, t_1);
    	} else if (t_0 <= -1e-196) {
    		tmp = t_2;
    	} else if (t_0 <= 0.0) {
    		tmp = (c / b) * -0.5;
    	} else if (t_0 <= 4e+266) {
    		tmp = t_2;
    	} else {
    		tmp = fma((c / fabs(b)), -0.5, t_1);
    	}
    	return tmp;
    }
    
    function code(a, b, c)
    	t_0 = Float64(Float64(Float64(-1.0 * b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
    	t_1 = Float64(Float64(fma(-1.0, b, abs(b)) / a) * 0.3333333333333333)
    	t_2 = fma(Float64((a ^ -1.0) * 0.3333333333333333), (fma((b ^ 1.0), (b ^ 1.0), Float64(Float64(c * a) * -3.0)) ^ 0.5), Float64(-0.3333333333333333 * Float64(b / a)))
    	tmp = 0.0
    	if (t_0 <= Float64(-Inf))
    		tmp = fma(Float64(-0.5 / abs(b)), c, t_1);
    	elseif (t_0 <= -1e-196)
    		tmp = t_2;
    	elseif (t_0 <= 0.0)
    		tmp = Float64(Float64(c / b) * -0.5);
    	elseif (t_0 <= 4e+266)
    		tmp = t_2;
    	else
    		tmp = fma(Float64(c / abs(b)), -0.5, t_1);
    	end
    	return tmp
    end
    
    code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[(-1.0 * b), $MachinePrecision] + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-1.0 * b + N[Abs[b], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[a, -1.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * N[Power[N[(N[Power[b, 1.0], $MachinePrecision] * N[Power[b, 1.0], $MachinePrecision] + N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] + N[(-0.3333333333333333 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(-0.5 / N[Abs[b], $MachinePrecision]), $MachinePrecision] * c + t$95$1), $MachinePrecision], If[LessEqual[t$95$0, -1e-196], t$95$2, If[LessEqual[t$95$0, 0.0], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[t$95$0, 4e+266], t$95$2, N[(N[(c / N[Abs[b], $MachinePrecision]), $MachinePrecision] * -0.5 + t$95$1), $MachinePrecision]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\
    t_1 := \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\\
    t_2 := \mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\
    \mathbf{if}\;t\_0 \leq -\infty:\\
    \;\;\;\;\mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, t\_1\right)\\
    
    \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-196}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t\_0 \leq 0:\\
    \;\;\;\;\frac{c}{b} \cdot -0.5\\
    
    \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+266}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, t\_1\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -inf.0

      1. Initial program 25.4%

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
        10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\left|b\right| + -1 \cdot b}{a} + c \cdot \left(c \cdot \left(\frac{-9}{16} \cdot \frac{{a}^{2} \cdot c}{{\left(\left|b\right|\right)}^{5}} + \frac{-3}{8} \cdot \frac{a}{{\left(\left|b\right|\right)}^{3}}\right) - \frac{1}{2} \cdot \frac{1}{\left|b\right|}\right)} \]
      8. Applied rewrites46.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{a}{{\left(\left|b\right|\right)}^{3}}, -0.375, \frac{-0.5625 \cdot \left(\left(a \cdot a\right) \cdot c\right)}{{\left(\left|b\right|\right)}^{5}}\right), c, -0.5 \cdot {\left(\left|b\right|\right)}^{-1}\right), c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)} \]
      9. Taylor expanded in a around 0

        \[\leadsto \mathsf{fma}\left(\frac{\frac{-1}{2}}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot \frac{1}{3}\right) \]
      10. Step-by-step derivation
        1. lower-/.f64N/A

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

          \[\leadsto \mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right) \]
      11. Applied rewrites72.7%

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

      if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -1e-196 or 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 4.0000000000000001e266

      1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
        10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1e-196 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 0.0

      1. Initial program 18.6%

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

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

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

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

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

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

      if 4.0000000000000001e266 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

      1. Initial program 35.8%

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
        10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{\left|b\right|} + \frac{1}{3} \cdot \frac{\left|b\right| + -1 \cdot b}{a}} \]
      8. Step-by-step derivation
        1. Applied rewrites78.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)} \]
      9. Recombined 4 regimes into one program.
      10. Final simplification85.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -1 \cdot 10^{-196}:\\ \;\;\;\;\mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq 0:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq 4 \cdot 10^{+266}:\\ \;\;\;\;\mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\left|b\right|}, -0.5, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ \end{array} \]
      11. Add Preprocessing

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

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ t_1 := \frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ t_2 := \mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-196}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+266}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (a b c)
       :precision binary64
       (let* ((t_0
               (fma
                (/ -0.5 (fabs b))
                c
                (* (/ (fma -1.0 b (fabs b)) a) 0.3333333333333333)))
              (t_1 (/ (+ (* -1.0 b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
              (t_2
               (fma
                (* (pow a -1.0) 0.3333333333333333)
                (pow (fma (pow b 1.0) (pow b 1.0) (* (* c a) -3.0)) 0.5)
                (* -0.3333333333333333 (/ b a)))))
         (if (<= t_1 (- INFINITY))
           t_0
           (if (<= t_1 -1e-196)
             t_2
             (if (<= t_1 0.0) (* (/ c b) -0.5) (if (<= t_1 4e+266) t_2 t_0))))))
      double code(double a, double b, double c) {
      	double t_0 = fma((-0.5 / fabs(b)), c, ((fma(-1.0, b, fabs(b)) / a) * 0.3333333333333333));
      	double t_1 = ((-1.0 * b) + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
      	double t_2 = fma((pow(a, -1.0) * 0.3333333333333333), pow(fma(pow(b, 1.0), pow(b, 1.0), ((c * a) * -3.0)), 0.5), (-0.3333333333333333 * (b / a)));
      	double tmp;
      	if (t_1 <= -((double) INFINITY)) {
      		tmp = t_0;
      	} else if (t_1 <= -1e-196) {
      		tmp = t_2;
      	} else if (t_1 <= 0.0) {
      		tmp = (c / b) * -0.5;
      	} else if (t_1 <= 4e+266) {
      		tmp = t_2;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(a, b, c)
      	t_0 = fma(Float64(-0.5 / abs(b)), c, Float64(Float64(fma(-1.0, b, abs(b)) / a) * 0.3333333333333333))
      	t_1 = Float64(Float64(Float64(-1.0 * b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
      	t_2 = fma(Float64((a ^ -1.0) * 0.3333333333333333), (fma((b ^ 1.0), (b ^ 1.0), Float64(Float64(c * a) * -3.0)) ^ 0.5), Float64(-0.3333333333333333 * Float64(b / a)))
      	tmp = 0.0
      	if (t_1 <= Float64(-Inf))
      		tmp = t_0;
      	elseif (t_1 <= -1e-196)
      		tmp = t_2;
      	elseif (t_1 <= 0.0)
      		tmp = Float64(Float64(c / b) * -0.5);
      	elseif (t_1 <= 4e+266)
      		tmp = t_2;
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[a_, b_, c_] := Block[{t$95$0 = N[(N[(-0.5 / N[Abs[b], $MachinePrecision]), $MachinePrecision] * c + N[(N[(N[(-1.0 * b + N[Abs[b], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-1.0 * b), $MachinePrecision] + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[a, -1.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * N[Power[N[(N[Power[b, 1.0], $MachinePrecision] * N[Power[b, 1.0], $MachinePrecision] + N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] + N[(-0.3333333333333333 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, -1e-196], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[t$95$1, 4e+266], t$95$2, t$95$0]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\
      t_1 := \frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\
      t_2 := \mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\
      \mathbf{if}\;t\_1 \leq -\infty:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-196}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq 0:\\
      \;\;\;\;\frac{c}{b} \cdot -0.5\\
      
      \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+266}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \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 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -inf.0 or 4.0000000000000001e266 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

        1. Initial program 31.9%

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
          10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\left|b\right| + -1 \cdot b}{a} + c \cdot \left(c \cdot \left(\frac{-9}{16} \cdot \frac{{a}^{2} \cdot c}{{\left(\left|b\right|\right)}^{5}} + \frac{-3}{8} \cdot \frac{a}{{\left(\left|b\right|\right)}^{3}}\right) - \frac{1}{2} \cdot \frac{1}{\left|b\right|}\right)} \]
        8. Applied rewrites58.7%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{a}{{\left(\left|b\right|\right)}^{3}}, -0.375, \frac{-0.5625 \cdot \left(\left(a \cdot a\right) \cdot c\right)}{{\left(\left|b\right|\right)}^{5}}\right), c, -0.5 \cdot {\left(\left|b\right|\right)}^{-1}\right), c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)} \]
        9. Taylor expanded in a around 0

          \[\leadsto \mathsf{fma}\left(\frac{\frac{-1}{2}}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot \frac{1}{3}\right) \]
        10. Step-by-step derivation
          1. lower-/.f64N/A

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

            \[\leadsto \mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right) \]
        11. Applied rewrites76.0%

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

        if -inf.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -1e-196 or 0.0 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 4.0000000000000001e266

        1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
          10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1e-196 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 0.0

        1. Initial program 18.6%

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -1 \cdot 10^{-196}:\\ \;\;\;\;\mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq 0:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq 4 \cdot 10^{+266}:\\ \;\;\;\;\mathsf{fma}\left({a}^{-1} \cdot 0.3333333333333333, {\left(\mathsf{fma}\left({b}^{1}, {b}^{1}, \left(c \cdot a\right) \cdot -3\right)\right)}^{0.5}, -0.3333333333333333 \cdot \frac{b}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)\\ \end{array} \]
      5. Add Preprocessing

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

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
      (FPCore (a b c)
       :precision binary64
       (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
      double code(double a, double b, double c) {
      	double tmp;
      	if (b <= -5e-310) {
      		tmp = -0.6666666666666666 * (b / a);
      	} else {
      		tmp = (c / b) * -0.5;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(a, b, c)
      use fmin_fmax_functions
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8), intent (in) :: c
          real(8) :: tmp
          if (b <= (-5d-310)) then
              tmp = (-0.6666666666666666d0) * (b / a)
          else
              tmp = (c / b) * (-0.5d0)
          end if
          code = tmp
      end function
      
      public static double code(double a, double b, double c) {
      	double tmp;
      	if (b <= -5e-310) {
      		tmp = -0.6666666666666666 * (b / a);
      	} else {
      		tmp = (c / b) * -0.5;
      	}
      	return tmp;
      }
      
      def code(a, b, c):
      	tmp = 0
      	if b <= -5e-310:
      		tmp = -0.6666666666666666 * (b / a)
      	else:
      		tmp = (c / b) * -0.5
      	return tmp
      
      function code(a, b, c)
      	tmp = 0.0
      	if (b <= -5e-310)
      		tmp = Float64(-0.6666666666666666 * Float64(b / a));
      	else
      		tmp = Float64(Float64(c / b) * -0.5);
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b, c)
      	tmp = 0.0;
      	if (b <= -5e-310)
      		tmp = -0.6666666666666666 * (b / a);
      	else
      		tmp = (c / b) * -0.5;
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
      \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{c}{b} \cdot -0.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if b < -4.999999999999985e-310

        1. Initial program 74.4%

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

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

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

            \[\leadsto -0.6666666666666666 \cdot \frac{b}{\color{blue}{a}} \]
        5. Applied rewrites67.3%

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

        if -4.999999999999985e-310 < b

        1. Initial program 39.1%

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

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

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

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

            \[\leadsto \frac{c}{b} \cdot -0.5 \]
        5. Applied rewrites56.0%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right)} \cdot c}}{3 \cdot a} \]
        10. associate-/r*N/A

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

          \[\leadsto \color{blue}{\frac{\frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}} \]
      4. Applied rewrites58.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\left|b\right| + -1 \cdot b}{a} + c \cdot \left(c \cdot \left(\frac{-9}{16} \cdot \frac{{a}^{2} \cdot c}{{\left(\left|b\right|\right)}^{5}} + \frac{-3}{8} \cdot \frac{a}{{\left(\left|b\right|\right)}^{3}}\right) - \frac{1}{2} \cdot \frac{1}{\left|b\right|}\right)} \]
      8. Applied rewrites46.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{a}{{\left(\left|b\right|\right)}^{3}}, -0.375, \frac{-0.5625 \cdot \left(\left(a \cdot a\right) \cdot c\right)}{{\left(\left|b\right|\right)}^{5}}\right), c, -0.5 \cdot {\left(\left|b\right|\right)}^{-1}\right), c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right)} \]
      9. Taylor expanded in a around 0

        \[\leadsto \mathsf{fma}\left(\frac{\frac{-1}{2}}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot \frac{1}{3}\right) \]
      10. Step-by-step derivation
        1. lower-/.f64N/A

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

          \[\leadsto \mathsf{fma}\left(\frac{-0.5}{\left|b\right|}, c, \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a} \cdot 0.3333333333333333\right) \]
      11. Applied rewrites62.0%

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

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

      \[\begin{array}{l} \\ -0.6666666666666666 \cdot \frac{b}{a} \end{array} \]
      (FPCore (a b c) :precision binary64 (* -0.6666666666666666 (/ b a)))
      double code(double a, double b, double c) {
      	return -0.6666666666666666 * (b / 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 = (-0.6666666666666666d0) * (b / a)
      end function
      
      public static double code(double a, double b, double c) {
      	return -0.6666666666666666 * (b / a);
      }
      
      def code(a, b, c):
      	return -0.6666666666666666 * (b / a)
      
      function code(a, b, c)
      	return Float64(-0.6666666666666666 * Float64(b / a))
      end
      
      function tmp = code(a, b, c)
      	tmp = -0.6666666666666666 * (b / a);
      end
      
      code[a_, b_, c_] := N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      -0.6666666666666666 \cdot \frac{b}{a}
      \end{array}
      
      Derivation
      1. Initial program 58.1%

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

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

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

          \[\leadsto -0.6666666666666666 \cdot \frac{b}{\color{blue}{a}} \]
      5. Applied rewrites37.4%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      6. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025065 
      (FPCore (a b c)
        :name "Cubic critical"
        :precision binary64
        (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))