Cubic critical, medium range

Percentage Accurate: 31.4% → 99.0%
Time: 12.1s
Alternatives: 9
Speedup: 2.9×

Specification

?
\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\right)\]
\[\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);
}
real(8) function code(a, b, c)
    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 9 alternatives:

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

Initial Program: 31.4% 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);
}
real(8) function code(a, b, c)
    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: 99.0% accurate, 0.7× speedup?

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

\\
\left(0.3333333333333333 \cdot \frac{\left(c \cdot a\right) \cdot 3}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b}\right) \cdot \frac{-1}{a}
\end{array}
Derivation
  1. Initial program 31.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1}{a} \cdot \left(\left(b - \sqrt{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(3 \cdot a\right), c, b \cdot b\right)}}\right) \cdot \frac{1}{3}\right) \]
    9. distribute-lft-neg-inN/A

      \[\leadsto \frac{-1}{a} \cdot \left(\left(b - \sqrt{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(3\right)\right) \cdot a}, c, b \cdot b\right)}\right) \cdot \frac{1}{3}\right) \]
    10. metadata-evalN/A

      \[\leadsto \frac{-1}{a} \cdot \left(\left(b - \sqrt{\mathsf{fma}\left(\color{blue}{-3} \cdot a, c, b \cdot b\right)}\right) \cdot \frac{1}{3}\right) \]
    11. lower-*.f6431.1

      \[\leadsto \frac{-1}{a} \cdot \left(\left(b - \sqrt{\mathsf{fma}\left(\color{blue}{-3 \cdot a}, c, b \cdot b\right)}\right) \cdot 0.3333333333333333\right) \]
  5. Applied rewrites31.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1}{a} \cdot \left(\left(b - \sqrt{\color{blue}{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}}\right) \cdot \frac{1}{3}\right) \]
    9. flip--N/A

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

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

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

      \[\leadsto \frac{-1}{a} \cdot \left(\frac{b \cdot b - \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} \cdot \color{blue}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}}}{b + \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}} \cdot \frac{1}{3}\right) \]
    13. rem-square-sqrtN/A

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

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

      \[\leadsto \frac{-1}{a} \cdot \left(\frac{b \cdot b - \mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}{\color{blue}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} + b}} \cdot \frac{1}{3}\right) \]
  7. Applied rewrites33.7%

    \[\leadsto \frac{-1}{a} \cdot \left(\color{blue}{\frac{\frac{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b, b \cdot b, \left(-\left(\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b\right)\right) \cdot \mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)\right)}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b}}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b}} \cdot 0.3333333333333333\right) \]
  8. Taylor expanded in c around inf

    \[\leadsto \frac{-1}{a} \cdot \left(\frac{\color{blue}{3 \cdot \left(a \cdot c\right)}}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b} \cdot \frac{1}{3}\right) \]
  9. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{a} \cdot \left(\frac{\color{blue}{3 \cdot \left(a \cdot c\right)}}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b} \cdot \frac{1}{3}\right) \]
    2. lower-*.f6499.0

      \[\leadsto \frac{-1}{a} \cdot \left(\frac{3 \cdot \color{blue}{\left(a \cdot c\right)}}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b} \cdot 0.3333333333333333\right) \]
  10. Applied rewrites99.0%

    \[\leadsto \frac{-1}{a} \cdot \left(\frac{\color{blue}{3 \cdot \left(a \cdot c\right)}}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + b} \cdot 0.3333333333333333\right) \]
  11. Final simplification99.0%

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

Alternative 2: 89.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\mathsf{fma}\left(b, 0.3333333333333333, \left(-0.3333333333333333\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}\right) \cdot \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375 \cdot a, \frac{\frac{c \cdot c}{b \cdot b}}{b}, -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 0.084)
   (*
    (fma
     b
     0.3333333333333333
     (* (- 0.3333333333333333) (sqrt (fma (* c a) -3.0 (* b b)))))
    (/ -1.0 a))
   (fma (* -0.375 a) (/ (/ (* c c) (* b b)) b) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.084) {
		tmp = fma(b, 0.3333333333333333, (-0.3333333333333333 * sqrt(fma((c * a), -3.0, (b * b))))) * (-1.0 / a);
	} else {
		tmp = fma((-0.375 * a), (((c * c) / (b * b)) / b), (-0.5 * (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 0.084)
		tmp = Float64(fma(b, 0.3333333333333333, Float64(Float64(-0.3333333333333333) * sqrt(fma(Float64(c * a), -3.0, Float64(b * b))))) * Float64(-1.0 / a));
	else
		tmp = fma(Float64(-0.375 * a), Float64(Float64(Float64(c * c) / Float64(b * b)) / b), Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 0.084], N[(N[(b * 0.3333333333333333 + N[((-0.3333333333333333) * N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.375 * a), $MachinePrecision] * N[(N[(N[(c * c), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.084:\\
\;\;\;\;\mathsf{fma}\left(b, 0.3333333333333333, \left(-0.3333333333333333\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}\right) \cdot \frac{-1}{a}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375 \cdot a, \frac{\frac{c \cdot c}{b \cdot b}}{b}, -0.5 \cdot \frac{c}{b}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 0.0840000000000000052

    1. Initial program 75.3%

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

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

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

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

        \[\leadsto \frac{-1}{a} \cdot \left(\frac{1}{3} \cdot \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right)}\right) \]
      4. sub-negN/A

        \[\leadsto \frac{-1}{a} \cdot \left(\frac{1}{3} \cdot \color{blue}{\left(b + \left(\mathsf{neg}\left(\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right)\right)\right)}\right) \]
      5. distribute-rgt-inN/A

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

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

        \[\leadsto \frac{-1}{a} \cdot \mathsf{fma}\left(b, \frac{1}{3}, \color{blue}{\left(\mathsf{neg}\left(\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right)\right) \cdot \frac{1}{3}}\right) \]
    5. Applied rewrites76.0%

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

    if 0.0840000000000000052 < b

    1. Initial program 24.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} + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \frac{-1}{2} \cdot \frac{c}{b}} \]
      2. associate-/l*N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-3}{8} \cdot a, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}}\right) \]
      13. lower-/.f6493.5

        \[\leadsto \mathsf{fma}\left(-0.375 \cdot a, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b}} \cdot -0.5\right) \]
    5. Applied rewrites93.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot a, c \cdot \frac{c}{{b}^{3}}, \frac{c}{b} \cdot -0.5\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites93.5%

        \[\leadsto \mathsf{fma}\left(-0.375 \cdot a, \frac{\frac{c \cdot c}{b \cdot b}}{\color{blue}{b}}, \frac{c}{b} \cdot -0.5\right) \]
    7. Recombined 2 regimes into one program.
    8. Final simplification91.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\mathsf{fma}\left(b, 0.3333333333333333, \left(-0.3333333333333333\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}\right) \cdot \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375 \cdot a, \frac{\frac{c \cdot c}{b \cdot b}}{b}, -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 89.3% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\mathsf{fma}\left(b, 0.3333333333333333, \left(-0.3333333333333333\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}\right) \cdot \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b 0.084)
       (*
        (fma
         b
         0.3333333333333333
         (* (- 0.3333333333333333) (sqrt (fma (* c a) -3.0 (* b b)))))
        (/ -1.0 a))
       (/ (fma (* (* c c) -0.375) (/ a (* b b)) (* -0.5 c)) b)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= 0.084) {
    		tmp = fma(b, 0.3333333333333333, (-0.3333333333333333 * sqrt(fma((c * a), -3.0, (b * b))))) * (-1.0 / a);
    	} else {
    		tmp = fma(((c * c) * -0.375), (a / (b * b)), (-0.5 * c)) / b;
    	}
    	return tmp;
    }
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= 0.084)
    		tmp = Float64(fma(b, 0.3333333333333333, Float64(Float64(-0.3333333333333333) * sqrt(fma(Float64(c * a), -3.0, Float64(b * b))))) * Float64(-1.0 / a));
    	else
    		tmp = Float64(fma(Float64(Float64(c * c) * -0.375), Float64(a / Float64(b * b)), Float64(-0.5 * c)) / b);
    	end
    	return tmp
    end
    
    code[a_, b_, c_] := If[LessEqual[b, 0.084], N[(N[(b * 0.3333333333333333 + N[((-0.3333333333333333) * N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] * N[(a / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * c), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 0.084:\\
    \;\;\;\;\mathsf{fma}\left(b, 0.3333333333333333, \left(-0.3333333333333333\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}\right) \cdot \frac{-1}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 0.0840000000000000052

      1. Initial program 75.3%

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

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

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

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

          \[\leadsto \frac{-1}{a} \cdot \left(\frac{1}{3} \cdot \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right)}\right) \]
        4. sub-negN/A

          \[\leadsto \frac{-1}{a} \cdot \left(\frac{1}{3} \cdot \color{blue}{\left(b + \left(\mathsf{neg}\left(\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right)\right)\right)}\right) \]
        5. distribute-rgt-inN/A

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

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

          \[\leadsto \frac{-1}{a} \cdot \mathsf{fma}\left(b, \frac{1}{3}, \color{blue}{\left(\mathsf{neg}\left(\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right)\right) \cdot \frac{1}{3}}\right) \]
      5. Applied rewrites76.0%

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

      if 0.0840000000000000052 < b

      1. Initial program 24.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{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
        2. +-commutativeN/A

          \[\leadsto \frac{\color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{2} \cdot c}}{b} \]
        3. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot \frac{-3}{8}}{b}, \color{blue}{\frac{a}{b}}, \frac{-1}{2} \cdot c\right)}{b} \]
        15. lower-*.f6493.5

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, \color{blue}{-0.5 \cdot c}\right)}{b} \]
      5. Applied rewrites93.5%

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, -0.5 \cdot c\right)}{b}} \]
      6. Step-by-step derivation
        1. Applied rewrites93.5%

          \[\leadsto \frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification91.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\mathsf{fma}\left(b, 0.3333333333333333, \left(-0.3333333333333333\right) \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}\right) \cdot \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 89.3% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b}\\ \end{array} \end{array} \]
      (FPCore (a b c)
       :precision binary64
       (if (<= b 0.084)
         (/ (- (sqrt (fma b b (* (* -3.0 a) c))) b) (* 3.0 a))
         (/ (fma (* (* c c) -0.375) (/ a (* b b)) (* -0.5 c)) b)))
      double code(double a, double b, double c) {
      	double tmp;
      	if (b <= 0.084) {
      		tmp = (sqrt(fma(b, b, ((-3.0 * a) * c))) - b) / (3.0 * a);
      	} else {
      		tmp = fma(((c * c) * -0.375), (a / (b * b)), (-0.5 * c)) / b;
      	}
      	return tmp;
      }
      
      function code(a, b, c)
      	tmp = 0.0
      	if (b <= 0.084)
      		tmp = Float64(Float64(sqrt(fma(b, b, Float64(Float64(-3.0 * a) * c))) - b) / Float64(3.0 * a));
      	else
      		tmp = Float64(fma(Float64(Float64(c * c) * -0.375), Float64(a / Float64(b * b)), Float64(-0.5 * c)) / b);
      	end
      	return tmp
      end
      
      code[a_, b_, c_] := If[LessEqual[b, 0.084], N[(N[(N[Sqrt[N[(b * b + N[(N[(-3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] * N[(a / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * c), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;b \leq 0.084:\\
      \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if b < 0.0840000000000000052

        1. Initial program 75.3%

          \[\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{\color{blue}{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
          2. sub-negN/A

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

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

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

            \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \mathsf{neg}\left(\color{blue}{\left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
          6. distribute-lft-neg-inN/A

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

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

            \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \left(\mathsf{neg}\left(\color{blue}{3 \cdot a}\right)\right) \cdot c\right)}}{3 \cdot a} \]
          9. distribute-lft-neg-inN/A

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

            \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(\mathsf{neg}\left(3\right)\right) \cdot a\right)} \cdot c\right)}}{3 \cdot a} \]
          11. metadata-eval75.4

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

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

        if 0.0840000000000000052 < b

        1. Initial program 24.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{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
          2. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{2} \cdot c}}{b} \]
          3. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot \frac{-3}{8}}{b}, \color{blue}{\frac{a}{b}}, \frac{-1}{2} \cdot c\right)}{b} \]
          15. lower-*.f6493.5

            \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, \color{blue}{-0.5 \cdot c}\right)}{b} \]
        5. Applied rewrites93.5%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, -0.5 \cdot c\right)}{b}} \]
        6. Step-by-step derivation
          1. Applied rewrites93.5%

            \[\leadsto \frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b} \]
        7. Recombined 2 regimes into one program.
        8. Final simplification91.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(c \cdot c\right) \cdot -0.375, \frac{a}{b \cdot b}, -0.5 \cdot c\right)}{b}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 89.3% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}\\ \end{array} \end{array} \]
        (FPCore (a b c)
         :precision binary64
         (if (<= b 0.084)
           (/ (- (sqrt (fma b b (* (* -3.0 a) c))) b) (* 3.0 a))
           (/ (* (fma -0.375 (/ (* c a) (* b b)) -0.5) c) b)))
        double code(double a, double b, double c) {
        	double tmp;
        	if (b <= 0.084) {
        		tmp = (sqrt(fma(b, b, ((-3.0 * a) * c))) - b) / (3.0 * a);
        	} else {
        		tmp = (fma(-0.375, ((c * a) / (b * b)), -0.5) * c) / b;
        	}
        	return tmp;
        }
        
        function code(a, b, c)
        	tmp = 0.0
        	if (b <= 0.084)
        		tmp = Float64(Float64(sqrt(fma(b, b, Float64(Float64(-3.0 * a) * c))) - b) / Float64(3.0 * a));
        	else
        		tmp = Float64(Float64(fma(-0.375, Float64(Float64(c * a) / Float64(b * b)), -0.5) * c) / b);
        	end
        	return tmp
        end
        
        code[a_, b_, c_] := If[LessEqual[b, 0.084], N[(N[(N[Sqrt[N[(b * b + N[(N[(-3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.375 * N[(N[(c * a), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision] * c), $MachinePrecision] / b), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;b \leq 0.084:\\
        \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if b < 0.0840000000000000052

          1. Initial program 75.3%

            \[\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{\color{blue}{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
            2. sub-negN/A

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

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

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

              \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \mathsf{neg}\left(\color{blue}{\left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
            6. distribute-lft-neg-inN/A

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

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

              \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \left(\mathsf{neg}\left(\color{blue}{3 \cdot a}\right)\right) \cdot c\right)}}{3 \cdot a} \]
            9. distribute-lft-neg-inN/A

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

              \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(\left(\mathsf{neg}\left(3\right)\right) \cdot a\right)} \cdot c\right)}}{3 \cdot a} \]
            11. metadata-eval75.4

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

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

          if 0.0840000000000000052 < b

          1. Initial program 24.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{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
            2. +-commutativeN/A

              \[\leadsto \frac{\color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{2} \cdot c}}{b} \]
            3. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot \frac{-3}{8}}{b}, \color{blue}{\frac{a}{b}}, \frac{-1}{2} \cdot c\right)}{b} \]
            15. lower-*.f6493.5

              \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, \color{blue}{-0.5 \cdot c}\right)}{b} \]
          5. Applied rewrites93.5%

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

            \[\leadsto \frac{c \cdot \left(\frac{-3}{8} \cdot \frac{a \cdot c}{{b}^{2}} - \frac{1}{2}\right)}{b} \]
          7. Step-by-step derivation
            1. Applied rewrites93.4%

              \[\leadsto \frac{c \cdot \mathsf{fma}\left(-0.375, \frac{a \cdot c}{b \cdot b}, -0.5\right)}{b} \]
          8. Recombined 2 regimes into one program.
          9. Final simplification90.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}\\ \end{array} \]
          10. Add Preprocessing

          Alternative 6: 89.2% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}\\ \end{array} \end{array} \]
          (FPCore (a b c)
           :precision binary64
           (if (<= b 0.084)
             (* (- (sqrt (fma (* c -3.0) a (* b b))) b) (/ 0.3333333333333333 a))
             (/ (* (fma -0.375 (/ (* c a) (* b b)) -0.5) c) b)))
          double code(double a, double b, double c) {
          	double tmp;
          	if (b <= 0.084) {
          		tmp = (sqrt(fma((c * -3.0), a, (b * b))) - b) * (0.3333333333333333 / a);
          	} else {
          		tmp = (fma(-0.375, ((c * a) / (b * b)), -0.5) * c) / b;
          	}
          	return tmp;
          }
          
          function code(a, b, c)
          	tmp = 0.0
          	if (b <= 0.084)
          		tmp = Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) * Float64(0.3333333333333333 / a));
          	else
          		tmp = Float64(Float64(fma(-0.375, Float64(Float64(c * a) / Float64(b * b)), -0.5) * c) / b);
          	end
          	return tmp
          end
          
          code[a_, b_, c_] := If[LessEqual[b, 0.084], N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.375 * N[(N[(c * a), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision] * c), $MachinePrecision] / b), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;b \leq 0.084:\\
          \;\;\;\;\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if b < 0.0840000000000000052

            1. Initial program 75.3%

              \[\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 \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
              2. clear-numN/A

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{\frac{1}{3}}{a}} \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \]
              8. metadata-eval75.3

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

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

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

                \[\leadsto \frac{\frac{1}{3}}{a} \cdot \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right) \]
              12. unsub-negN/A

                \[\leadsto \frac{\frac{1}{3}}{a} \cdot \color{blue}{\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b\right)} \]
              13. lower--.f6475.3

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

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

            if 0.0840000000000000052 < b

            1. Initial program 24.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{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{\color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{2} \cdot c}}{b} \]
              3. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot \frac{-3}{8}}{b}, \color{blue}{\frac{a}{b}}, \frac{-1}{2} \cdot c\right)}{b} \]
              15. lower-*.f6493.5

                \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, \color{blue}{-0.5 \cdot c}\right)}{b} \]
            5. Applied rewrites93.5%

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

              \[\leadsto \frac{c \cdot \left(\frac{-3}{8} \cdot \frac{a \cdot c}{{b}^{2}} - \frac{1}{2}\right)}{b} \]
            7. Step-by-step derivation
              1. Applied rewrites93.4%

                \[\leadsto \frac{c \cdot \mathsf{fma}\left(-0.375, \frac{a \cdot c}{b \cdot b}, -0.5\right)}{b} \]
            8. Recombined 2 regimes into one program.
            9. Final simplification90.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.084:\\ \;\;\;\;\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}\\ \end{array} \]
            10. Add Preprocessing

            Alternative 7: 90.8% accurate, 1.1× speedup?

            \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b} \end{array} \]
            (FPCore (a b c)
             :precision binary64
             (/ (* (fma -0.375 (/ (* c a) (* b b)) -0.5) c) b))
            double code(double a, double b, double c) {
            	return (fma(-0.375, ((c * a) / (b * b)), -0.5) * c) / b;
            }
            
            function code(a, b, c)
            	return Float64(Float64(fma(-0.375, Float64(Float64(c * a) / Float64(b * b)), -0.5) * c) / b)
            end
            
            code[a_, b_, c_] := N[(N[(N[(-0.375 * N[(N[(c * a), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision] * c), $MachinePrecision] / b), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b}
            \end{array}
            
            Derivation
            1. Initial program 31.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{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{\color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{2} \cdot c}}{b} \]
              3. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot \frac{-3}{8}}{b}, \color{blue}{\frac{a}{b}}, \frac{-1}{2} \cdot c\right)}{b} \]
              15. lower-*.f6489.3

                \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(c \cdot c\right) \cdot -0.375}{b}, \frac{a}{b}, \color{blue}{-0.5 \cdot c}\right)}{b} \]
            5. Applied rewrites89.3%

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

              \[\leadsto \frac{c \cdot \left(\frac{-3}{8} \cdot \frac{a \cdot c}{{b}^{2}} - \frac{1}{2}\right)}{b} \]
            7. Step-by-step derivation
              1. Applied rewrites89.2%

                \[\leadsto \frac{c \cdot \mathsf{fma}\left(-0.375, \frac{a \cdot c}{b \cdot b}, -0.5\right)}{b} \]
              2. Final simplification89.2%

                \[\leadsto \frac{\mathsf{fma}\left(-0.375, \frac{c \cdot a}{b \cdot b}, -0.5\right) \cdot c}{b} \]
              3. Add Preprocessing

              Alternative 8: 81.3% accurate, 2.9× speedup?

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
              6. Final simplification80.9%

                \[\leadsto -0.5 \cdot \frac{c}{b} \]
              7. Add Preprocessing

              Alternative 9: 81.1% accurate, 2.9× speedup?

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
              6. Step-by-step derivation
                1. Applied rewrites80.7%

                  \[\leadsto c \cdot \color{blue}{\frac{-0.5}{b}} \]
                2. Final simplification80.7%

                  \[\leadsto \frac{-0.5}{b} \cdot c \]
                3. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024247 
                (FPCore (a b c)
                  :name "Cubic critical, medium range"
                  :precision binary64
                  :pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
                  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))