Cubic critical, medium range

Percentage Accurate: 31.5% → 95.5%
Time: 16.7s
Alternatives: 8
Speedup: 23.2×

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 8 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: 95.5% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(c \cdot a\right)}^{4}\\ t_1 := {\left(c \cdot a\right)}^{2}\\ t_2 := t_1 \cdot -3.375\\ t_3 := a \cdot \left(c \cdot 3\right)\\ t_4 := {t_3}^{2}\\ t_5 := \mathsf{fma}\left(-0.5, a \cdot \left(c \cdot \left(t_4 \cdot -1.125\right)\right), {\left(c \cdot a\right)}^{3} \cdot 3.375\right)\\ -0.5 \cdot \frac{c}{b} + 0.3333333333333333 \cdot \left(\left(\frac{{c}^{2} \cdot \left(a \cdot -4.5\right) - \frac{t_2}{a}}{{b}^{3}} + \frac{\left({a}^{2} \cdot {c}^{3}\right) \cdot 6.75 - \frac{t_5}{a}}{{b}^{5}}\right) + \frac{\mathsf{fma}\left(-10.125, {a}^{3} \cdot {c}^{4}, a \cdot \left(\left({c}^{2} \cdot t_2\right) \cdot 4.5\right) - \frac{\mathsf{fma}\left(-0.5, t_3 \cdot t_5, \mathsf{fma}\left(-0.5, t_0 \cdot 5.0625 + {\left(a \cdot \left(c \cdot -3\right)\right)}^{4} \cdot 0.015625, \mathsf{fma}\left(0.125, t_1 \cdot \left(-3.375 \cdot t_4\right), t_0 \cdot -2.53125\right)\right)\right)}{a}\right)}{{b}^{7}}\right) \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (pow (* c a) 4.0))
        (t_1 (pow (* c a) 2.0))
        (t_2 (* t_1 -3.375))
        (t_3 (* a (* c 3.0)))
        (t_4 (pow t_3 2.0))
        (t_5
         (fma -0.5 (* a (* c (* t_4 -1.125))) (* (pow (* c a) 3.0) 3.375))))
   (+
    (* -0.5 (/ c b))
    (*
     0.3333333333333333
     (+
      (+
       (/ (- (* (pow c 2.0) (* a -4.5)) (/ t_2 a)) (pow b 3.0))
       (/ (- (* (* (pow a 2.0) (pow c 3.0)) 6.75) (/ t_5 a)) (pow b 5.0)))
      (/
       (fma
        -10.125
        (* (pow a 3.0) (pow c 4.0))
        (-
         (* a (* (* (pow c 2.0) t_2) 4.5))
         (/
          (fma
           -0.5
           (* t_3 t_5)
           (fma
            -0.5
            (+ (* t_0 5.0625) (* (pow (* a (* c -3.0)) 4.0) 0.015625))
            (fma 0.125 (* t_1 (* -3.375 t_4)) (* t_0 -2.53125))))
          a)))
       (pow b 7.0)))))))
double code(double a, double b, double c) {
	double t_0 = pow((c * a), 4.0);
	double t_1 = pow((c * a), 2.0);
	double t_2 = t_1 * -3.375;
	double t_3 = a * (c * 3.0);
	double t_4 = pow(t_3, 2.0);
	double t_5 = fma(-0.5, (a * (c * (t_4 * -1.125))), (pow((c * a), 3.0) * 3.375));
	return (-0.5 * (c / b)) + (0.3333333333333333 * (((((pow(c, 2.0) * (a * -4.5)) - (t_2 / a)) / pow(b, 3.0)) + ((((pow(a, 2.0) * pow(c, 3.0)) * 6.75) - (t_5 / a)) / pow(b, 5.0))) + (fma(-10.125, (pow(a, 3.0) * pow(c, 4.0)), ((a * ((pow(c, 2.0) * t_2) * 4.5)) - (fma(-0.5, (t_3 * t_5), fma(-0.5, ((t_0 * 5.0625) + (pow((a * (c * -3.0)), 4.0) * 0.015625)), fma(0.125, (t_1 * (-3.375 * t_4)), (t_0 * -2.53125)))) / a))) / pow(b, 7.0))));
}
function code(a, b, c)
	t_0 = Float64(c * a) ^ 4.0
	t_1 = Float64(c * a) ^ 2.0
	t_2 = Float64(t_1 * -3.375)
	t_3 = Float64(a * Float64(c * 3.0))
	t_4 = t_3 ^ 2.0
	t_5 = fma(-0.5, Float64(a * Float64(c * Float64(t_4 * -1.125))), Float64((Float64(c * a) ^ 3.0) * 3.375))
	return Float64(Float64(-0.5 * Float64(c / b)) + Float64(0.3333333333333333 * Float64(Float64(Float64(Float64(Float64((c ^ 2.0) * Float64(a * -4.5)) - Float64(t_2 / a)) / (b ^ 3.0)) + Float64(Float64(Float64(Float64((a ^ 2.0) * (c ^ 3.0)) * 6.75) - Float64(t_5 / a)) / (b ^ 5.0))) + Float64(fma(-10.125, Float64((a ^ 3.0) * (c ^ 4.0)), Float64(Float64(a * Float64(Float64((c ^ 2.0) * t_2) * 4.5)) - Float64(fma(-0.5, Float64(t_3 * t_5), fma(-0.5, Float64(Float64(t_0 * 5.0625) + Float64((Float64(a * Float64(c * -3.0)) ^ 4.0) * 0.015625)), fma(0.125, Float64(t_1 * Float64(-3.375 * t_4)), Float64(t_0 * -2.53125)))) / a))) / (b ^ 7.0)))))
end
code[a_, b_, c_] := Block[{t$95$0 = N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(c * a), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * -3.375), $MachinePrecision]}, Block[{t$95$3 = N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[t$95$3, 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(-0.5 * N[(a * N[(c * N[(t$95$4 * -1.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(c * a), $MachinePrecision], 3.0], $MachinePrecision] * 3.375), $MachinePrecision]), $MachinePrecision]}, N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(N[(N[(N[(N[(N[Power[c, 2.0], $MachinePrecision] * N[(a * -4.5), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 / a), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] * 6.75), $MachinePrecision] - N[(t$95$5 / a), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-10.125 * N[(N[Power[a, 3.0], $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(N[(N[Power[c, 2.0], $MachinePrecision] * t$95$2), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision] - N[(N[(-0.5 * N[(t$95$3 * t$95$5), $MachinePrecision] + N[(-0.5 * N[(N[(t$95$0 * 5.0625), $MachinePrecision] + N[(N[Power[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision], 4.0], $MachinePrecision] * 0.015625), $MachinePrecision]), $MachinePrecision] + N[(0.125 * N[(t$95$1 * N[(-3.375 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * -2.53125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(c \cdot a\right)}^{4}\\
t_1 := {\left(c \cdot a\right)}^{2}\\
t_2 := t_1 \cdot -3.375\\
t_3 := a \cdot \left(c \cdot 3\right)\\
t_4 := {t_3}^{2}\\
t_5 := \mathsf{fma}\left(-0.5, a \cdot \left(c \cdot \left(t_4 \cdot -1.125\right)\right), {\left(c \cdot a\right)}^{3} \cdot 3.375\right)\\
-0.5 \cdot \frac{c}{b} + 0.3333333333333333 \cdot \left(\left(\frac{{c}^{2} \cdot \left(a \cdot -4.5\right) - \frac{t_2}{a}}{{b}^{3}} + \frac{\left({a}^{2} \cdot {c}^{3}\right) \cdot 6.75 - \frac{t_5}{a}}{{b}^{5}}\right) + \frac{\mathsf{fma}\left(-10.125, {a}^{3} \cdot {c}^{4}, a \cdot \left(\left({c}^{2} \cdot t_2\right) \cdot 4.5\right) - \frac{\mathsf{fma}\left(-0.5, t_3 \cdot t_5, \mathsf{fma}\left(-0.5, t_0 \cdot 5.0625 + {\left(a \cdot \left(c \cdot -3\right)\right)}^{4} \cdot 0.015625, \mathsf{fma}\left(0.125, t_1 \cdot \left(-3.375 \cdot t_4\right), t_0 \cdot -2.53125\right)\right)\right)}{a}\right)}{{b}^{7}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 35.2%

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c} - b}}{3 \cdot a} \]
    4. div-sub34.5%

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-un-lft-identity35.2%

      \[\leadsto \frac{\sqrt{\color{blue}{1 \cdot \mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}} - b}{3 \cdot a} \]
    2. *-un-lft-identity35.2%

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

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

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

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

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{-3 \cdot \left(a \cdot c\right)}\right)} - b}{3 \cdot a} \]
    7. associate-*l*35.2%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\sqrt{{b}^{4} - \color{blue}{\left(-3 \cdot -3\right)} \cdot \left(\left(a \cdot c\right) \cdot \left(a \cdot c\right)\right)}}{\sqrt{\mathsf{fma}\left(b, b, 3 \cdot \left(a \cdot c\right)\right)}} - b}{3 \cdot a} \]
    5. swap-sqr34.9%

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

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

      \[\leadsto \frac{\frac{\sqrt{{b}^{4} - \left(-3 \cdot \left(a \cdot c\right)\right) \cdot \color{blue}{\left(a \cdot \left(c \cdot -3\right)\right)}}}{\sqrt{\mathsf{fma}\left(b, b, 3 \cdot \left(a \cdot c\right)\right)}} - b}{3 \cdot a} \]
    8. *-commutative34.9%

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

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

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

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

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

      \[\leadsto \frac{\frac{\sqrt{{b}^{4} - {\left(a \cdot \left(c \cdot -3\right)\right)}^{2}}}{\sqrt{b \cdot b + \color{blue}{{\left(3 \cdot \left(a \cdot c\right)\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(3 \cdot \left(a \cdot c\right)\right)}^{\left(\frac{1}{2}\right)}}}} - b}{3 \cdot a} \]
    14. hypot-def34.9%

      \[\leadsto \frac{\frac{\sqrt{{b}^{4} - {\left(a \cdot \left(c \cdot -3\right)\right)}^{2}}}{\color{blue}{\mathsf{hypot}\left(b, {\left(3 \cdot \left(a \cdot c\right)\right)}^{\left(\frac{1}{2}\right)}\right)}} - b}{3 \cdot a} \]
    15. metadata-eval34.9%

      \[\leadsto \frac{\frac{\sqrt{{b}^{4} - {\left(a \cdot \left(c \cdot -3\right)\right)}^{2}}}{\mathsf{hypot}\left(b, {\left(3 \cdot \left(a \cdot c\right)\right)}^{\color{blue}{0.5}}\right)} - b}{3 \cdot a} \]
    16. unpow1/234.9%

      \[\leadsto \frac{\frac{\sqrt{{b}^{4} - {\left(a \cdot \left(c \cdot -3\right)\right)}^{2}}}{\mathsf{hypot}\left(b, \color{blue}{\sqrt{3 \cdot \left(a \cdot c\right)}}\right)} - b}{3 \cdot a} \]
  8. Simplified34.9%

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{{b}^{4} - {\left(a \cdot \left(c \cdot -3\right)\right)}^{2}}}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(3 \cdot c\right)}\right)}} - b}{3 \cdot a} \]
  9. Taylor expanded in b around inf 93.2%

    \[\leadsto \color{blue}{-0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{3}\right)}^{2}}{b} + \left(0.3333333333333333 \cdot \frac{-10.125 \cdot \left({a}^{3} \cdot {c}^{4}\right) + \left(-1 \cdot \frac{-0.5 \cdot \left(a \cdot \left(c \cdot \left({\left(\sqrt{3}\right)}^{2} \cdot \left(-0.5 \cdot \left(a \cdot \left(c \cdot \left({\left(\sqrt{3}\right)}^{2} \cdot \left(-0.25 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right) + -0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right)\right)\right)\right)\right) + 0.125 \cdot \left({a}^{3} \cdot \left({c}^{3} \cdot {\left(\sqrt{3}\right)}^{6}\right)\right)\right)\right)\right)\right) + \left(-0.5 \cdot \left(0.0625 \cdot \left({a}^{4} \cdot \left({c}^{4} \cdot {\left(\sqrt{3}\right)}^{8}\right)\right) + {\left(-0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right)\right)}^{2}\right) + \left(-0.03125 \cdot \left({a}^{4} \cdot \left({c}^{4} \cdot {\left(\sqrt{3}\right)}^{8}\right)\right) + 0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot \left({\left(\sqrt{3}\right)}^{4} \cdot \left(-0.25 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right) + -0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right)\right)\right)\right)\right)\right)\right)}{a} + 4.5 \cdot \left(a \cdot \left({c}^{2} \cdot \left(-0.25 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right) + -0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right)\right)\right)\right)\right)}{{b}^{7}} + \left(0.3333333333333333 \cdot \frac{-4.5 \cdot \left(a \cdot {c}^{2}\right) + -1 \cdot \frac{-0.25 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right) + -0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right)}{a}}{{b}^{3}} + 0.3333333333333333 \cdot \frac{-1 \cdot \frac{-0.5 \cdot \left(a \cdot \left(c \cdot \left({\left(\sqrt{3}\right)}^{2} \cdot \left(-0.25 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right) + -0.125 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot {\left(\sqrt{3}\right)}^{4}\right)\right)\right)\right)\right)\right) + 0.125 \cdot \left({a}^{3} \cdot \left({c}^{3} \cdot {\left(\sqrt{3}\right)}^{6}\right)\right)}{a} + 2.25 \cdot \left({a}^{2} \cdot \left({c}^{3} \cdot {\left(\sqrt{3}\right)}^{2}\right)\right)}{{b}^{5}}\right)\right)} \]
  10. Simplified94.6%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + 0.3333333333333333 \cdot \left(\left(\frac{{c}^{2} \cdot \left(a \cdot -4.5\right) - \frac{{\left(a \cdot c\right)}^{2} \cdot -3.375}{a}}{{b}^{3}} + \frac{\left({a}^{2} \cdot {c}^{3}\right) \cdot 6.75 - \frac{\mathsf{fma}\left(-0.5, a \cdot \left(c \cdot \left({\left(a \cdot \left(c \cdot 3\right)\right)}^{2} \cdot -1.125\right)\right), {\left(a \cdot c\right)}^{3} \cdot 3.375\right)}{a}}{{b}^{5}}\right) + \frac{\mathsf{fma}\left(-10.125, {a}^{3} \cdot {c}^{4}, a \cdot \left(\left({c}^{2} \cdot \left({\left(a \cdot c\right)}^{2} \cdot -3.375\right)\right) \cdot 4.5\right) - \frac{\mathsf{fma}\left(-0.5, \left(a \cdot \left(c \cdot 3\right)\right) \cdot \mathsf{fma}\left(-0.5, a \cdot \left(c \cdot \left({\left(a \cdot \left(c \cdot 3\right)\right)}^{2} \cdot -1.125\right)\right), {\left(a \cdot c\right)}^{3} \cdot 3.375\right), \mathsf{fma}\left(-0.5, {\left(a \cdot c\right)}^{4} \cdot 5.0625 + {\left(a \cdot \left(c \cdot -3\right)\right)}^{4} \cdot 0.015625, \mathsf{fma}\left(0.125, \left({\left(a \cdot \left(c \cdot 3\right)\right)}^{2} \cdot -3.375\right) \cdot {\left(a \cdot c\right)}^{2}, {\left(a \cdot c\right)}^{4} \cdot -2.53125\right)\right)\right)}{a}\right)}{{b}^{7}}\right)} \]
  11. Final simplification94.6%

    \[\leadsto -0.5 \cdot \frac{c}{b} + 0.3333333333333333 \cdot \left(\left(\frac{{c}^{2} \cdot \left(a \cdot -4.5\right) - \frac{{\left(c \cdot a\right)}^{2} \cdot -3.375}{a}}{{b}^{3}} + \frac{\left({a}^{2} \cdot {c}^{3}\right) \cdot 6.75 - \frac{\mathsf{fma}\left(-0.5, a \cdot \left(c \cdot \left({\left(a \cdot \left(c \cdot 3\right)\right)}^{2} \cdot -1.125\right)\right), {\left(c \cdot a\right)}^{3} \cdot 3.375\right)}{a}}{{b}^{5}}\right) + \frac{\mathsf{fma}\left(-10.125, {a}^{3} \cdot {c}^{4}, a \cdot \left(\left({c}^{2} \cdot \left({\left(c \cdot a\right)}^{2} \cdot -3.375\right)\right) \cdot 4.5\right) - \frac{\mathsf{fma}\left(-0.5, \left(a \cdot \left(c \cdot 3\right)\right) \cdot \mathsf{fma}\left(-0.5, a \cdot \left(c \cdot \left({\left(a \cdot \left(c \cdot 3\right)\right)}^{2} \cdot -1.125\right)\right), {\left(c \cdot a\right)}^{3} \cdot 3.375\right), \mathsf{fma}\left(-0.5, {\left(c \cdot a\right)}^{4} \cdot 5.0625 + {\left(a \cdot \left(c \cdot -3\right)\right)}^{4} \cdot 0.015625, \mathsf{fma}\left(0.125, {\left(c \cdot a\right)}^{2} \cdot \left(-3.375 \cdot {\left(a \cdot \left(c \cdot 3\right)\right)}^{2}\right), {\left(c \cdot a\right)}^{4} \cdot -2.53125\right)\right)\right)}{a}\right)}{{b}^{7}}\right) \]
  12. Add Preprocessing

Alternative 2: 95.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(c \cdot a\right)}^{4}\\ -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, t_0, t_0 \cdot 1.265625\right) \cdot \mathsf{reciprocal}\left(\left(a \cdot {b}^{7}\right)\right)\right)\right)\right) \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (pow (* c a) 4.0)))
   (+
    (* -0.5625 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 5.0)))
    (+
     (* -0.5 (/ c b))
     (+
      (* -0.375 (/ (* (pow c 2.0) a) (pow b 3.0)))
      (*
       -0.16666666666666666
       (*
        (fma 5.0625 t_0 (* t_0 1.265625))
        (reciprocal (* a (pow b 7.0))))))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(c \cdot a\right)}^{4}\\
-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, t_0, t_0 \cdot 1.265625\right) \cdot \mathsf{reciprocal}\left(\left(a \cdot {b}^{7}\right)\right)\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 35.2%

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

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
  4. Step-by-step derivation
    1. div-inv94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \color{blue}{\left(\left(5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)}\right)\right) \]
    2. fma-def94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\color{blue}{\mathsf{fma}\left(5.0625, {a}^{4} \cdot {c}^{4}, {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}\right)} \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    3. pow-prod-down94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, \color{blue}{{\left(a \cdot c\right)}^{4}}, {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    4. *-commutative94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\color{blue}{\left(\left({a}^{2} \cdot {c}^{2}\right) \cdot -1.125\right)}}^{2}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    5. unpow-prod-down94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, \color{blue}{{\left({a}^{2} \cdot {c}^{2}\right)}^{2} \cdot {-1.125}^{2}}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    6. pow-prod-down94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\color{blue}{\left({\left(a \cdot c\right)}^{2}\right)}}^{2} \cdot {-1.125}^{2}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    7. pow-pow94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, \color{blue}{{\left(a \cdot c\right)}^{\left(2 \cdot 2\right)}} \cdot {-1.125}^{2}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    8. metadata-eval94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\left(a \cdot c\right)}^{\color{blue}{4}} \cdot {-1.125}^{2}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    9. metadata-eval94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\left(a \cdot c\right)}^{4} \cdot \color{blue}{1.265625}\right) \cdot \frac{1}{a \cdot {b}^{7}}\right)\right)\right) \]
    10. reciprocal-define94.6%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\left(a \cdot c\right)}^{4} \cdot 1.265625\right) \cdot \color{blue}{\mathsf{reciprocal}\left(\left(a \cdot {b}^{7}\right)\right)}\right)\right)\right) \]
  5. Applied egg-rr94.6%

    \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \color{blue}{\left(\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\left(a \cdot c\right)}^{4} \cdot 1.265625\right) \cdot \mathsf{reciprocal}\left(\left(a \cdot {b}^{7}\right)\right)\right)}\right)\right) \]
  6. Final simplification94.6%

    \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.16666666666666666 \cdot \left(\mathsf{fma}\left(5.0625, {\left(c \cdot a\right)}^{4}, {\left(c \cdot a\right)}^{4} \cdot 1.265625\right) \cdot \mathsf{reciprocal}\left(\left(a \cdot {b}^{7}\right)\right)\right)\right)\right) \]
  7. Add Preprocessing

Alternative 3: 95.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.16666666666666666 \cdot \frac{{\left(c \cdot a\right)}^{4}}{\frac{a \cdot {b}^{7}}{6.328125}}\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (+
  (* -0.5625 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 5.0)))
  (+
   (* -0.5 (/ c b))
   (+
    (* -0.375 (/ (* (pow c 2.0) a) (pow b 3.0)))
    (*
     -0.16666666666666666
     (/ (pow (* c a) 4.0) (/ (* a (pow b 7.0)) 6.328125)))))))
double code(double a, double b, double c) {
	return (-0.5625 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((pow(c, 2.0) * a) / pow(b, 3.0))) + (-0.16666666666666666 * (pow((c * a), 4.0) / ((a * pow(b, 7.0)) / 6.328125)))));
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((-0.5625d0) * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 5.0d0))) + (((-0.5d0) * (c / b)) + (((-0.375d0) * (((c ** 2.0d0) * a) / (b ** 3.0d0))) + ((-0.16666666666666666d0) * (((c * a) ** 4.0d0) / ((a * (b ** 7.0d0)) / 6.328125d0)))))
end function
public static double code(double a, double b, double c) {
	return (-0.5625 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((Math.pow(c, 2.0) * a) / Math.pow(b, 3.0))) + (-0.16666666666666666 * (Math.pow((c * a), 4.0) / ((a * Math.pow(b, 7.0)) / 6.328125)))));
}
def code(a, b, c):
	return (-0.5625 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((math.pow(c, 2.0) * a) / math.pow(b, 3.0))) + (-0.16666666666666666 * (math.pow((c * a), 4.0) / ((a * math.pow(b, 7.0)) / 6.328125)))))
function code(a, b, c)
	return Float64(Float64(-0.5625 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + Float64(Float64(-0.5 * Float64(c / b)) + Float64(Float64(-0.375 * Float64(Float64((c ^ 2.0) * a) / (b ^ 3.0))) + Float64(-0.16666666666666666 * Float64((Float64(c * a) ^ 4.0) / Float64(Float64(a * (b ^ 7.0)) / 6.328125))))))
end
function tmp = code(a, b, c)
	tmp = (-0.5625 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * (((c ^ 2.0) * a) / (b ^ 3.0))) + (-0.16666666666666666 * (((c * a) ^ 4.0) / ((a * (b ^ 7.0)) / 6.328125)))));
end
code[a_, b_, c_] := N[(N[(-0.5625 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.375 * N[(N[(N[Power[c, 2.0], $MachinePrecision] * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision] / N[(N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] / 6.328125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.16666666666666666 \cdot \frac{{\left(c \cdot a\right)}^{4}}{\frac{a \cdot {b}^{7}}{6.328125}}\right)\right)
\end{array}
Derivation
  1. Initial program 35.2%

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

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
  4. Taylor expanded in c around 0 94.5%

    \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{-0.16666666666666666 \cdot \frac{{c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}\right)\right) \]
  5. Step-by-step derivation
    1. associate-*r/94.5%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\frac{-0.16666666666666666 \cdot \left({c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)\right)}{a \cdot {b}^{7}}}\right)\right) \]
  6. Simplified94.5%

    \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{-0.16666666666666666 \cdot \frac{{\left(a \cdot c\right)}^{4}}{\frac{a \cdot {b}^{7}}{6.328125}}}\right)\right) \]
  7. Final simplification94.5%

    \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.16666666666666666 \cdot \frac{{\left(c \cdot a\right)}^{4}}{\frac{a \cdot {b}^{7}}{6.328125}}\right)\right) \]
  8. Add Preprocessing

Alternative 4: 93.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ -0.5625 \cdot \left(\left({a}^{2} \cdot {c}^{3}\right) \cdot \mathsf{reciprocal}\left(\left({b}^{5}\right)\right)\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (+
  (* -0.5625 (* (* (pow a 2.0) (pow c 3.0)) (reciprocal (pow b 5.0))))
  (+ (* -0.5 (/ c b)) (* -0.375 (/ (* (pow c 2.0) a) (pow b 3.0))))))
\begin{array}{l}

\\
-0.5625 \cdot \left(\left({a}^{2} \cdot {c}^{3}\right) \cdot \mathsf{reciprocal}\left(\left({b}^{5}\right)\right)\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)
\end{array}
Derivation
  1. Initial program 35.2%

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

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
  4. Step-by-step derivation
    1. clear-num92.3%

      \[\leadsto -0.5625 \cdot \color{blue}{\frac{1}{\frac{{b}^{5}}{{a}^{2} \cdot {c}^{3}}}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
    2. inv-pow92.3%

      \[\leadsto -0.5625 \cdot \color{blue}{{\left(\frac{{b}^{5}}{{a}^{2} \cdot {c}^{3}}\right)}^{-1}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
  5. Applied egg-rr92.3%

    \[\leadsto -0.5625 \cdot \color{blue}{{\left(\frac{{b}^{5}}{{a}^{2} \cdot {c}^{3}}\right)}^{-1}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
  6. Step-by-step derivation
    1. unpow-192.3%

      \[\leadsto -0.5625 \cdot \color{blue}{\frac{1}{\frac{{b}^{5}}{{a}^{2} \cdot {c}^{3}}}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
    2. associate-/r/92.3%

      \[\leadsto -0.5625 \cdot \color{blue}{\left(\frac{1}{{b}^{5}} \cdot \left({a}^{2} \cdot {c}^{3}\right)\right)} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
    3. reciprocal-define92.3%

      \[\leadsto -0.5625 \cdot \left(\color{blue}{\mathsf{reciprocal}\left(\left({b}^{5}\right)\right)} \cdot \left({a}^{2} \cdot {c}^{3}\right)\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
  7. Simplified92.3%

    \[\leadsto -0.5625 \cdot \color{blue}{\left(\mathsf{reciprocal}\left(\left({b}^{5}\right)\right) \cdot \left({a}^{2} \cdot {c}^{3}\right)\right)} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
  8. Final simplification92.3%

    \[\leadsto -0.5625 \cdot \left(\left({a}^{2} \cdot {c}^{3}\right) \cdot \mathsf{reciprocal}\left(\left({b}^{5}\right)\right)\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) \]
  9. Add Preprocessing

Alternative 5: 93.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (+
  (* -0.5625 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 5.0)))
  (+ (* -0.5 (/ c b)) (* -0.375 (/ (* (pow c 2.0) a) (pow b 3.0))))))
double code(double a, double b, double c) {
	return (-0.5625 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((pow(c, 2.0) * a) / pow(b, 3.0))));
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((-0.5625d0) * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 5.0d0))) + (((-0.5d0) * (c / b)) + ((-0.375d0) * (((c ** 2.0d0) * a) / (b ** 3.0d0))))
end function
public static double code(double a, double b, double c) {
	return (-0.5625 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((Math.pow(c, 2.0) * a) / Math.pow(b, 3.0))));
}
def code(a, b, c):
	return (-0.5625 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((math.pow(c, 2.0) * a) / math.pow(b, 3.0))))
function code(a, b, c)
	return Float64(Float64(-0.5625 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + Float64(Float64(-0.5 * Float64(c / b)) + Float64(-0.375 * Float64(Float64((c ^ 2.0) * a) / (b ^ 3.0)))))
end
function tmp = code(a, b, c)
	tmp = (-0.5625 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + ((-0.5 * (c / b)) + (-0.375 * (((c ^ 2.0) * a) / (b ^ 3.0))));
end
code[a_, b_, c_] := N[(N[(-0.5625 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(N[Power[c, 2.0], $MachinePrecision] * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)
\end{array}
Derivation
  1. Initial program 35.2%

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

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
  4. Final simplification92.3%

    \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) \]
  5. Add Preprocessing

Alternative 6: 83.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{if}\;t_0 \leq -1 \cdot 10^{-11}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
   (if (<= t_0 -1e-11) t_0 (/ (* -0.5 c) b))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (t_0 <= -1e-11) {
		tmp = t_0;
	} else {
		tmp = (-0.5 * c) / b;
	}
	return tmp;
}
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
    real(8) :: tmp
    t_0 = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
    if (t_0 <= (-1d-11)) then
        tmp = t_0
    else
        tmp = ((-0.5d0) * c) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (t_0 <= -1e-11) {
		tmp = t_0;
	} else {
		tmp = (-0.5 * c) / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)
	tmp = 0
	if t_0 <= -1e-11:
		tmp = t_0
	else:
		tmp = (-0.5 * c) / b
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (t_0 <= -1e-11)
		tmp = t_0;
	else
		tmp = Float64(Float64(-0.5 * c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	tmp = 0.0;
	if (t_0 <= -1e-11)
		tmp = t_0;
	else
		tmp = (-0.5 * c) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-11], t$95$0, N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-11}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -9.99999999999999939e-12

    1. Initial program 70.2%

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

    if -9.99999999999999939e-12 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 10.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 95.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. associate-*r/95.9%

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

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

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

Alternative 7: 90.7% accurate, 0.5× speedup?

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

\\
-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}
\end{array}
Derivation
  1. Initial program 35.2%

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

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
  4. Final simplification88.3%

    \[\leadsto -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} \]
  5. Add Preprocessing

Alternative 8: 81.2% accurate, 23.2× speedup?

\[\begin{array}{l} \\ \frac{-0.5 \cdot 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(Float64(-0.5 * c) / b)
end
function tmp = code(a, b, c)
	tmp = (-0.5 * c) / b;
end
code[a_, b_, c_] := N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}

\\
\frac{-0.5 \cdot c}{b}
\end{array}
Derivation
  1. Initial program 35.2%

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

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  4. Step-by-step derivation
    1. associate-*r/78.1%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
  5. Simplified78.1%

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

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

Reproduce

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