Cubic critical, wide range

Percentage Accurate: 17.9% → 99.4%
Time: 8.1s
Alternatives: 3
Speedup: 23.2×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\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 3 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: 17.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
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.5× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Step-by-step derivation
    1. neg-sub016.6%

      \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. sqr-neg16.6%

      \[\leadsto \frac{\left(0 - b\right) + \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    3. associate-+l-16.6%

      \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
    4. sub0-neg16.6%

      \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
  3. Simplified16.6%

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{3 \cdot a}} \]
  4. Step-by-step derivation
    1. add-cbrt-cube16.7%

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

      \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right)}^{3}}} - b}{3 \cdot a} \]
    3. pow1/318.6%

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

      \[\leadsto \frac{{\color{blue}{\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b}{3 \cdot a} \]
    5. metadata-eval18.6%

      \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b}{3 \cdot a} \]
  5. Applied egg-rr18.6%

    \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b}{3 \cdot a} \]
  6. Step-by-step derivation
    1. unpow1/316.6%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{1.5}}} - b}{3 \cdot a} \]
    2. fma-udef16.6%

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b \cdot b + c \cdot \left(a \cdot -3\right)\right)}}^{1.5}} - b}{3 \cdot a} \]
    3. associate-*r*16.6%

      \[\leadsto \frac{\sqrt[3]{{\left(b \cdot b + \color{blue}{\left(c \cdot a\right) \cdot -3}\right)}^{1.5}} - b}{3 \cdot a} \]
    4. *-commutative16.6%

      \[\leadsto \frac{\sqrt[3]{{\left(b \cdot b + \color{blue}{-3 \cdot \left(c \cdot a\right)}\right)}^{1.5}} - b}{3 \cdot a} \]
    5. +-commutative16.6%

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(-3 \cdot \left(c \cdot a\right) + b \cdot b\right)}}^{1.5}} - b}{3 \cdot a} \]
    6. *-commutative16.6%

      \[\leadsto \frac{\sqrt[3]{{\left(\color{blue}{\left(c \cdot a\right) \cdot -3} + b \cdot b\right)}^{1.5}} - b}{3 \cdot a} \]
    7. associate-*r*16.6%

      \[\leadsto \frac{\sqrt[3]{{\left(\color{blue}{c \cdot \left(a \cdot -3\right)} + b \cdot b\right)}^{1.5}} - b}{3 \cdot a} \]
    8. fma-def16.6%

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}}^{1.5}} - b}{3 \cdot a} \]
  7. Simplified16.6%

    \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}}} - b}{3 \cdot a} \]
  8. Step-by-step derivation
    1. flip--16.6%

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

    \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}} - b \cdot b}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}} + b}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. Simplified17.0%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot -3}}{b + \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}}}{3 \cdot a} \]
      2. associate-*r*99.3%

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

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

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

    Alternative 2: 99.4% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \frac{\frac{t_0}{b + \sqrt{t_0 + b \cdot b}}}{a \cdot 3} \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (let* ((t_0 (* c (* a -3.0))))
       (/ (/ t_0 (+ b (sqrt (+ t_0 (* b b))))) (* a 3.0))))
    double code(double a, double b, double c) {
    	double t_0 = c * (a * -3.0);
    	return (t_0 / (b + sqrt((t_0 + (b * b))))) / (a * 3.0);
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        real(8) :: t_0
        t_0 = c * (a * (-3.0d0))
        code = (t_0 / (b + sqrt((t_0 + (b * b))))) / (a * 3.0d0)
    end function
    
    public static double code(double a, double b, double c) {
    	double t_0 = c * (a * -3.0);
    	return (t_0 / (b + Math.sqrt((t_0 + (b * b))))) / (a * 3.0);
    }
    
    def code(a, b, c):
    	t_0 = c * (a * -3.0)
    	return (t_0 / (b + math.sqrt((t_0 + (b * b))))) / (a * 3.0)
    
    function code(a, b, c)
    	t_0 = Float64(c * Float64(a * -3.0))
    	return Float64(Float64(t_0 / Float64(b + sqrt(Float64(t_0 + Float64(b * b))))) / Float64(a * 3.0))
    end
    
    function tmp = code(a, b, c)
    	t_0 = c * (a * -3.0);
    	tmp = (t_0 / (b + sqrt((t_0 + (b * b))))) / (a * 3.0);
    end
    
    code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 / N[(b + N[Sqrt[N[(t$95$0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := c \cdot \left(a \cdot -3\right)\\
    \frac{\frac{t_0}{b + \sqrt{t_0 + b \cdot b}}}{a \cdot 3}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 16.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub016.6%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. sqr-neg16.6%

        \[\leadsto \frac{\left(0 - b\right) + \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      3. associate-+l-16.6%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      4. sub0-neg16.6%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
    3. Simplified16.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{3 \cdot a}} \]
    4. Step-by-step derivation
      1. add-cbrt-cube16.7%

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right)}^{3}}} - b}{3 \cdot a} \]
      3. pow1/318.6%

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

        \[\leadsto \frac{{\color{blue}{\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b}{3 \cdot a} \]
      5. metadata-eval18.6%

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b}{3 \cdot a} \]
    5. Applied egg-rr18.6%

      \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b}{3 \cdot a} \]
    6. Step-by-step derivation
      1. unpow1/316.6%

        \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}^{1.5}}} - b}{3 \cdot a} \]
      2. fma-udef16.6%

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b \cdot b + c \cdot \left(a \cdot -3\right)\right)}}^{1.5}} - b}{3 \cdot a} \]
      3. associate-*r*16.6%

        \[\leadsto \frac{\sqrt[3]{{\left(b \cdot b + \color{blue}{\left(c \cdot a\right) \cdot -3}\right)}^{1.5}} - b}{3 \cdot a} \]
      4. *-commutative16.6%

        \[\leadsto \frac{\sqrt[3]{{\left(b \cdot b + \color{blue}{-3 \cdot \left(c \cdot a\right)}\right)}^{1.5}} - b}{3 \cdot a} \]
      5. +-commutative16.6%

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(-3 \cdot \left(c \cdot a\right) + b \cdot b\right)}}^{1.5}} - b}{3 \cdot a} \]
      6. *-commutative16.6%

        \[\leadsto \frac{\sqrt[3]{{\left(\color{blue}{\left(c \cdot a\right) \cdot -3} + b \cdot b\right)}^{1.5}} - b}{3 \cdot a} \]
      7. associate-*r*16.6%

        \[\leadsto \frac{\sqrt[3]{{\left(\color{blue}{c \cdot \left(a \cdot -3\right)} + b \cdot b\right)}^{1.5}} - b}{3 \cdot a} \]
      8. fma-def16.6%

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}}^{1.5}} - b}{3 \cdot a} \]
    7. Simplified16.6%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}}} - b}{3 \cdot a} \]
    8. Step-by-step derivation
      1. flip--16.6%

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}} - b \cdot b}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{1.5}} + b}}}{3 \cdot a} \]
    10. Step-by-step derivation
      1. Simplified17.0%

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

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

          \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot -3}}{b + \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}}}{3 \cdot a} \]
        2. associate-*r*99.3%

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

        \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(a \cdot -3\right)}}{b + \sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)}}}{3 \cdot a} \]
      5. Step-by-step derivation
        1. fma-udef99.3%

          \[\leadsto \frac{\frac{c \cdot \left(a \cdot -3\right)}{b + \sqrt{\color{blue}{\left(c \cdot a\right) \cdot -3 + b \cdot b}}}}{3 \cdot a} \]
        2. associate-*r*99.3%

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

        \[\leadsto \frac{\frac{c \cdot \left(a \cdot -3\right)}{b + \sqrt{\color{blue}{c \cdot \left(a \cdot -3\right) + b \cdot b}}}}{3 \cdot a} \]
      7. Final simplification99.3%

        \[\leadsto \frac{\frac{c \cdot \left(a \cdot -3\right)}{b + \sqrt{c \cdot \left(a \cdot -3\right) + b \cdot b}}}{a \cdot 3} \]

      Alternative 3: 90.3% accurate, 23.2× 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 16.6%

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

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

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

      Reproduce

      ?
      herbie shell --seed 2023272 
      (FPCore (a b c)
        :name "Cubic critical, wide range"
        :precision binary64
        :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
        (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))