Cubic critical, medium range

Percentage Accurate: 31.5% → 99.4%
Time: 14.0s
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.5% 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.4% accurate, 0.6× speedup?

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

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

    \[\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 \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{\color{blue}{{b}^{2} \cdot \left(1 + -3 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}}{3 \cdot a} \]
  4. Step-by-step derivation
    1. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.7× speedup?

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

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

    \[\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 \frac{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{\color{blue}{{b}^{2} \cdot \left(1 + -3 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}}{3 \cdot a} \]
  4. Step-by-step derivation
    1. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{\left(3 \cdot a\right) \cdot c}{\left(\mathsf{neg}\left(b\right)\right) - \sqrt{-3 \cdot \left(a \cdot c\right) + \color{blue}{{b}^{2}}}}}{3 \cdot a} \]
  12. Step-by-step derivation
    1. Applied rewrites99.4%

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

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

    Reproduce

    ?
    herbie shell --seed 2024223 
    (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)))