Cubic critical

Percentage Accurate: 51.7% → 90.2%
Time: 5.6s
Alternatives: 7
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 7 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.7% 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: 90.2% accurate, N/A× speedup?

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

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

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-222}:\\
\;\;\;\;t\_1\\

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

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

\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 5.0000000000000001e296 < (/.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 17.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 rewrites17.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-/.f64N/A

        \[\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)}^{\frac{1}{2}}\right)}{3}}{a}} \]
      2. lift-/.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, {\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, b \cdot -1\right)}{3 \cdot 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. lower-fma.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \left(\frac{\left|b\right|}{a} + \frac{-1 \cdot b}{a}\right)\right) \]
      10. lower-*.f6466.7

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \frac{\left(\mathsf{neg}\left(b\right)\right) + \left|b\right|}{a}\right) \]
      4. mul-1-negN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\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)) < -2.0000000000000001e-222 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)) < 5.0000000000000001e296

    1. Initial program 90.0%

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

    if -2.0000000000000001e-222 < (/.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 13.8%

      \[\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-/.f64100.0

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

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

    \[\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(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -2 \cdot 10^{-222}:\\ \;\;\;\;\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 5 \cdot 10^{+296}:\\ \;\;\;\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

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

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\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(-0.3333333333333333, \frac{b}{a}, 0.3333333333333333 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{0.5}\right)\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-222}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;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 5.0000000000000001e296 < (/.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 17.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 rewrites17.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-/.f64N/A

        \[\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)}^{\frac{1}{2}}\right)}{3}}{a}} \]
      2. lift-/.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, {\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, b \cdot -1\right)}{3 \cdot 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. lower-fma.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \left(\frac{\left|b\right|}{a} + \frac{-1 \cdot b}{a}\right)\right) \]
      10. lower-*.f6466.7

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \frac{\left(\mathsf{neg}\left(b\right)\right) + \left|b\right|}{a}\right) \]
      4. mul-1-negN/A

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

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

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

      \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\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)) < -2.0000000000000001e-222 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)) < 5.0000000000000001e296

    1. Initial program 90.0%

      \[\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.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-/.f64N/A

        \[\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)}^{\frac{1}{2}}\right)}{3}}{a}} \]
      2. lift-/.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, {\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, b \cdot -1\right)}{3 \cdot 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. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{3}, \color{blue}{\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)\right) \]
      2. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{3}, \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)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{3}, \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)\right) \]
      5. inv-powN/A

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{3}, \frac{b}{a}, \frac{1}{3} \cdot \left({a}^{-1} \cdot \sqrt{-3 \cdot \left(a \cdot c\right) + {\left(\left|b\right|\right)}^{2}}\right)\right) \]
      7. pow1/2N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{3}, \frac{b}{a}, \frac{1}{3} \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{\frac{1}{2}}\right)\right) \]
      15. lift-*.f6489.7

        \[\leadsto \mathsf{fma}\left(-0.3333333333333333, \frac{b}{a}, 0.3333333333333333 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{0.5}\right)\right) \]
    9. Applied rewrites89.7%

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

    if -2.0000000000000001e-222 < (/.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 13.8%

      \[\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-/.f64100.0

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

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

    \[\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(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\right)\\ \mathbf{elif}\;\frac{-1 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \leq -2 \cdot 10^{-222}:\\ \;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{b}{a}, 0.3333333333333333 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{0.5}\right)\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 5 \cdot 10^{+296}:\\ \;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{b}{a}, 0.3333333333333333 \cdot \left({a}^{-1} \cdot {\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{0.5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

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

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

\\
\mathsf{fma}\left(-0.5, \frac{c}{\left|b\right|}, 0.3333333333333333 \cdot \frac{\mathsf{fma}\left(-1, b, \left|b\right|\right)}{a}\right)
\end{array}
Derivation
  1. Initial program 46.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 rewrites46.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-/.f64N/A

      \[\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)}^{\frac{1}{2}}\right)}{3}}{a}} \]
    2. lift-/.f64N/A

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, {\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, b \cdot -1\right)}{3 \cdot 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. lower-fma.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \left(\frac{\left|b\right|}{a} + \frac{-1 \cdot b}{a}\right)\right) \]
    10. lower-*.f6460.1

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \frac{\left(\mathsf{neg}\left(b\right)\right) + \left|b\right|}{a}\right) \]
    4. mul-1-negN/A

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

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

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

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

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

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.9 \cdot 10^{-307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a \cdot \frac{c}{\left|b\right|}, -0.5, \mathsf{fma}\left(-1, b, \left|b\right|\right) \cdot 0.3333333333333333\right)}{a}\\

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


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

    1. Initial program 67.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 rewrites67.3%

      \[\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-/.f64N/A

        \[\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)}^{\frac{1}{2}}\right)}{3}}{a}} \]
      2. lift-/.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, {\left(\mathsf{fma}\left(\left|b\right|, \left|b\right|, \left(a \cdot -3\right) \cdot c\right)\right)}^{0.25}, b \cdot -1\right)}{3 \cdot 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. lower-fma.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2}, \frac{c}{\left|b\right|}, \frac{1}{3} \cdot \left(\frac{\left|b\right|}{a} + \frac{-1 \cdot b}{a}\right)\right) \]
      10. lower-*.f6467.6

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

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

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

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

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

    if 4.9000000000000002e-307 < b

    1. Initial program 29.2%

      \[\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-/.f6469.7

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

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

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

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{-311}:\\ \;\;\;\;\left(\frac{0.6666666666666666}{a} \cdot \left(-1 \cdot b\right)\right) \cdot \left(-1 \cdot -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4e-311)
   (* (* (/ 0.6666666666666666 a) (* -1.0 b)) (* -1.0 -1.0))
   (* (/ c b) -0.5)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4e-311) {
		tmp = ((0.6666666666666666 / a) * (-1.0 * b)) * (-1.0 * -1.0);
	} 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 <= (-4d-311)) then
        tmp = ((0.6666666666666666d0 / a) * ((-1.0d0) * b)) * ((-1.0d0) * (-1.0d0))
    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 <= -4e-311) {
		tmp = ((0.6666666666666666 / a) * (-1.0 * b)) * (-1.0 * -1.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -4e-311:
		tmp = ((0.6666666666666666 / a) * (-1.0 * b)) * (-1.0 * -1.0)
	else:
		tmp = (c / b) * -0.5
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -4e-311)
		tmp = Float64(Float64(Float64(0.6666666666666666 / a) * Float64(-1.0 * b)) * Float64(-1.0 * -1.0));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -4e-311)
		tmp = ((0.6666666666666666 / a) * (-1.0 * b)) * (-1.0 * -1.0);
	else
		tmp = (c / b) * -0.5;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -4e-311], N[(N[(N[(0.6666666666666666 / a), $MachinePrecision] * N[(-1.0 * b), $MachinePrecision]), $MachinePrecision] * N[(-1.0 * -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{0.6666666666666666}{a} \cdot \left(-1 \cdot b\right)\right) \cdot \left(-1 \cdot -1\right)\\

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


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

    1. Initial program 66.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 rewrites67.1%

      \[\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. Taylor expanded in b around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right)} \]
    6. Step-by-step derivation
      1. associate-/l/N/A

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

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

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

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

        \[\leadsto -1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
      6. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto -1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
      10. associate-*l*N/A

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

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

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

      \[\leadsto \left(\frac{\frac{2}{3}}{a} \cdot b\right) \cdot -1 \]
    9. Step-by-step derivation
      1. lower-/.f6467.9

        \[\leadsto \left(\frac{0.6666666666666666}{a} \cdot b\right) \cdot -1 \]
    10. Applied rewrites67.9%

      \[\leadsto \left(\frac{0.6666666666666666}{a} \cdot b\right) \cdot -1 \]

    if -3.99999999999979e-311 < b

    1. Initial program 29.8%

      \[\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-/.f6469.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{-311}:\\ \;\;\;\;\left(\frac{0.6666666666666666}{a} \cdot \left(-1 \cdot b\right)\right) \cdot \left(-1 \cdot -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

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

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

\\
\left(\frac{0.6666666666666666}{a} \cdot \left(-1 \cdot b\right)\right) \cdot \left(-1 \cdot -1\right)
\end{array}
Derivation
  1. Initial program 46.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 rewrites46.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. Taylor expanded in b around -inf

    \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right)} \]
  6. Step-by-step derivation
    1. associate-/l/N/A

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

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

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

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

      \[\leadsto -1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
    6. fp-cancel-sign-sub-invN/A

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

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

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

      \[\leadsto -1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
    10. associate-*l*N/A

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

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

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

    \[\leadsto \left(\frac{\frac{2}{3}}{a} \cdot b\right) \cdot -1 \]
  9. Step-by-step derivation
    1. lower-/.f6432.7

      \[\leadsto \left(\frac{0.6666666666666666}{a} \cdot b\right) \cdot -1 \]
  10. Applied rewrites32.7%

    \[\leadsto \left(\frac{0.6666666666666666}{a} \cdot b\right) \cdot -1 \]
  11. Final simplification32.7%

    \[\leadsto \left(\frac{0.6666666666666666}{a} \cdot \left(-1 \cdot b\right)\right) \cdot \left(-1 \cdot -1\right) \]
  12. Add Preprocessing

Alternative 7: 35.3% 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 46.9%

    \[\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-/.f6432.7

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

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

Reproduce

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