Quadratic roots, narrow range

Percentage Accurate: 55.1% → 91.9%
Time: 16.2s
Alternatives: 11
Speedup: 29.0×

Specification

?
\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.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) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \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 11 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: 55.1% accurate, 1.0× speedup?

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

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}

Alternative 1: 91.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)\\ \mathbf{if}\;b \leq 0.38:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(a, t\_0, -{b}^{2}\right)}{b + \sqrt{a \cdot t\_0}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma c -4.0 (/ (pow b 2.0) a))))
   (if (<= b 0.38)
     (/ (/ (fma a t_0 (- (pow b 2.0))) (+ b (sqrt (* a t_0)))) (* a 2.0))
     (-
      (*
       a
       (*
        (* c c)
        (+
         (*
          c
          (*
           a
           (+ (* -5.0 (/ (* a c) (pow b 7.0))) (* 2.0 (/ -1.0 (pow b 5.0))))))
         (/ -1.0 (pow b 3.0)))))
      (/ c b)))))
double code(double a, double b, double c) {
	double t_0 = fma(c, -4.0, (pow(b, 2.0) / a));
	double tmp;
	if (b <= 0.38) {
		tmp = (fma(a, t_0, -pow(b, 2.0)) / (b + sqrt((a * t_0)))) / (a * 2.0);
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * ((a * c) / pow(b, 7.0))) + (2.0 * (-1.0 / pow(b, 5.0)))))) + (-1.0 / pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(c, -4.0, Float64((b ^ 2.0) / a))
	tmp = 0.0
	if (b <= 0.38)
		tmp = Float64(Float64(fma(a, t_0, Float64(-(b ^ 2.0))) / Float64(b + sqrt(Float64(a * t_0)))) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(a * Float64(Float64(c * c) * Float64(Float64(c * Float64(a * Float64(Float64(-5.0 * Float64(Float64(a * c) / (b ^ 7.0))) + Float64(2.0 * Float64(-1.0 / (b ^ 5.0)))))) + Float64(-1.0 / (b ^ 3.0))))) - Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * -4.0 + N[(N[Power[b, 2.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 0.38], N[(N[(N[(a * t$95$0 + (-N[Power[b, 2.0], $MachinePrecision])), $MachinePrecision] / N[(b + N[Sqrt[N[(a * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(c * c), $MachinePrecision] * N[(N[(c * N[(a * N[(N[(-5.0 * N[(N[(a * c), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(-1.0 / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)\\
\mathbf{if}\;b \leq 0.38:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(a, t\_0, -{b}^{2}\right)}{b + \sqrt{a \cdot t\_0}}}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\


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

    1. Initial program 86.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 86.4%

      \[\leadsto \frac{\sqrt{\color{blue}{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)}} - b}{a \cdot 2} \]
    6. Step-by-step derivation
      1. flip--86.7%

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} \cdot \sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} - b \cdot b}{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} + b}}}{a \cdot 2} \]
      2. add-sqr-sqrt88.0%

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

        \[\leadsto \frac{\frac{a \cdot \left(\color{blue}{c \cdot -4} + \frac{{b}^{2}}{a}\right) - b \cdot b}{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} + b}}{a \cdot 2} \]
      4. fma-define88.0%

        \[\leadsto \frac{\frac{a \cdot \color{blue}{\mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)} - b \cdot b}{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} + b}}{a \cdot 2} \]
      5. unpow288.0%

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

        \[\leadsto \frac{\frac{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right) - {b}^{2}}{\sqrt{a \cdot \left(\color{blue}{c \cdot -4} + \frac{{b}^{2}}{a}\right)} + b}}{a \cdot 2} \]
      7. fma-define88.0%

        \[\leadsto \frac{\frac{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right) - {b}^{2}}{\sqrt{a \cdot \color{blue}{\mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)}} + b}}{a \cdot 2} \]
    7. Applied egg-rr88.0%

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

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

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

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

    if 0.38 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg92.4%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified92.4%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 92.4%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in a around 0 92.4%

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Step-by-step derivation
      1. unpow292.4%

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

      \[\leadsto a \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.38:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right), -{b}^{2}\right)}{b + \sqrt{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 91.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)\\ \mathbf{if}\;b \leq 0.36:\\ \;\;\;\;\frac{\frac{t\_0 - {b}^{2}}{b + \sqrt{t\_0}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (fma c -4.0 (/ (pow b 2.0) a)))))
   (if (<= b 0.36)
     (/ (/ (- t_0 (pow b 2.0)) (+ b (sqrt t_0))) (* a 2.0))
     (-
      (*
       a
       (*
        (* c c)
        (+
         (*
          c
          (*
           a
           (+ (* -5.0 (/ (* a c) (pow b 7.0))) (* 2.0 (/ -1.0 (pow b 5.0))))))
         (/ -1.0 (pow b 3.0)))))
      (/ c b)))))
double code(double a, double b, double c) {
	double t_0 = a * fma(c, -4.0, (pow(b, 2.0) / a));
	double tmp;
	if (b <= 0.36) {
		tmp = ((t_0 - pow(b, 2.0)) / (b + sqrt(t_0))) / (a * 2.0);
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * ((a * c) / pow(b, 7.0))) + (2.0 * (-1.0 / pow(b, 5.0)))))) + (-1.0 / pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(a * fma(c, -4.0, Float64((b ^ 2.0) / a)))
	tmp = 0.0
	if (b <= 0.36)
		tmp = Float64(Float64(Float64(t_0 - (b ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(a * Float64(Float64(c * c) * Float64(Float64(c * Float64(a * Float64(Float64(-5.0 * Float64(Float64(a * c) / (b ^ 7.0))) + Float64(2.0 * Float64(-1.0 / (b ^ 5.0)))))) + Float64(-1.0 / (b ^ 3.0))))) - Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -4.0 + N[(N[Power[b, 2.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 0.36], N[(N[(N[(t$95$0 - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(c * c), $MachinePrecision] * N[(N[(c * N[(a * N[(N[(-5.0 * N[(N[(a * c), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(-1.0 / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)\\
\mathbf{if}\;b \leq 0.36:\\
\;\;\;\;\frac{\frac{t\_0 - {b}^{2}}{b + \sqrt{t\_0}}}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\


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

    1. Initial program 86.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 86.4%

      \[\leadsto \frac{\sqrt{\color{blue}{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)}} - b}{a \cdot 2} \]
    6. Step-by-step derivation
      1. flip--86.7%

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} \cdot \sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} - b \cdot b}{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} + b}}}{a \cdot 2} \]
      2. add-sqr-sqrt88.0%

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

        \[\leadsto \frac{\frac{a \cdot \left(\color{blue}{c \cdot -4} + \frac{{b}^{2}}{a}\right) - b \cdot b}{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} + b}}{a \cdot 2} \]
      4. fma-define88.0%

        \[\leadsto \frac{\frac{a \cdot \color{blue}{\mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)} - b \cdot b}{\sqrt{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)} + b}}{a \cdot 2} \]
      5. unpow288.0%

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

        \[\leadsto \frac{\frac{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right) - {b}^{2}}{\sqrt{a \cdot \left(\color{blue}{c \cdot -4} + \frac{{b}^{2}}{a}\right)} + b}}{a \cdot 2} \]
      7. fma-define88.0%

        \[\leadsto \frac{\frac{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right) - {b}^{2}}{\sqrt{a \cdot \color{blue}{\mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)}} + b}}{a \cdot 2} \]
    7. Applied egg-rr88.0%

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

    if 0.35999999999999999 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg92.4%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified92.4%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 92.4%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in a around 0 92.4%

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Step-by-step derivation
      1. unpow292.4%

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

      \[\leadsto a \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.36:\\ \;\;\;\;\frac{\frac{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right) - {b}^{2}}{b + \sqrt{a \cdot \mathsf{fma}\left(c, -4, \frac{{b}^{2}}{a}\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 91.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.35:\\ \;\;\;\;{\left(\sqrt[3]{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a}}\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 0.35)
   (pow (cbrt (* 0.5 (/ (- (sqrt (fma a (* c -4.0) (pow b 2.0))) b) a))) 3.0)
   (-
    (*
     a
     (*
      (* c c)
      (+
       (*
        c
        (*
         a
         (+ (* -5.0 (/ (* a c) (pow b 7.0))) (* 2.0 (/ -1.0 (pow b 5.0))))))
       (/ -1.0 (pow b 3.0)))))
    (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.35) {
		tmp = pow(cbrt((0.5 * ((sqrt(fma(a, (c * -4.0), pow(b, 2.0))) - b) / a))), 3.0);
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * ((a * c) / pow(b, 7.0))) + (2.0 * (-1.0 / pow(b, 5.0)))))) + (-1.0 / pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 0.35)
		tmp = cbrt(Float64(0.5 * Float64(Float64(sqrt(fma(a, Float64(c * -4.0), (b ^ 2.0))) - b) / a))) ^ 3.0;
	else
		tmp = Float64(Float64(a * Float64(Float64(c * c) * Float64(Float64(c * Float64(a * Float64(Float64(-5.0 * Float64(Float64(a * c) / (b ^ 7.0))) + Float64(2.0 * Float64(-1.0 / (b ^ 5.0)))))) + Float64(-1.0 / (b ^ 3.0))))) - Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 0.35], N[Power[N[Power[N[(0.5 * N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], N[(N[(a * N[(N[(c * c), $MachinePrecision] * N[(N[(c * N[(a * N[(N[(-5.0 * N[(N[(a * c), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(-1.0 / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.35:\\
\;\;\;\;{\left(\sqrt[3]{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a}}\right)}^{3}\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\


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

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, \color{blue}{{b}^{2}}\right)}}{a} + \left(-\frac{b}{a \cdot 2}\right) \]
      8. *-un-lft-identity86.3%

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} + \left(-\frac{1 \cdot b}{\color{blue}{2 \cdot a}}\right) \]
      10. times-frac86.3%

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - 0.5 \cdot \frac{b}{a}} \]
      2. distribute-lft-out--86.3%

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

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

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

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

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

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

    if 0.34999999999999998 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg92.4%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified92.4%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 92.4%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in a around 0 92.4%

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Step-by-step derivation
      1. unpow292.4%

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

      \[\leadsto a \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.35:\\ \;\;\;\;{\left(\sqrt[3]{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a}}\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 91.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.34:\\ \;\;\;\;0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 0.34)
   (*
    0.5
    (+
     (/ (- (sqrt (fma a (* c -4.0) (* b b))) b) a)
     (fma (/ -1.0 a) b (/ b a))))
   (-
    (*
     a
     (*
      (* c c)
      (+
       (*
        c
        (*
         a
         (+ (* -5.0 (/ (* a c) (pow b 7.0))) (* 2.0 (/ -1.0 (pow b 5.0))))))
       (/ -1.0 (pow b 3.0)))))
    (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.34) {
		tmp = 0.5 * (((sqrt(fma(a, (c * -4.0), (b * b))) - b) / a) + fma((-1.0 / a), b, (b / a)));
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * ((a * c) / pow(b, 7.0))) + (2.0 * (-1.0 / pow(b, 5.0)))))) + (-1.0 / pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 0.34)
		tmp = Float64(0.5 * Float64(Float64(Float64(sqrt(fma(a, Float64(c * -4.0), Float64(b * b))) - b) / a) + fma(Float64(-1.0 / a), b, Float64(b / a))));
	else
		tmp = Float64(Float64(a * Float64(Float64(c * c) * Float64(Float64(c * Float64(a * Float64(Float64(-5.0 * Float64(Float64(a * c) / (b ^ 7.0))) + Float64(2.0 * Float64(-1.0 / (b ^ 5.0)))))) + Float64(-1.0 / (b ^ 3.0))))) - Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 0.34], N[(0.5 * N[(N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] + N[(N[(-1.0 / a), $MachinePrecision] * b + N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(c * c), $MachinePrecision] * N[(N[(c * N[(a * N[(N[(-5.0 * N[(N[(a * c), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(-1.0 / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.34:\\
\;\;\;\;0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\


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

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, \color{blue}{{b}^{2}}\right)}}{a} + \left(-\frac{b}{a \cdot 2}\right) \]
      8. *-un-lft-identity86.3%

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} + \left(-\frac{1 \cdot b}{\color{blue}{2 \cdot a}}\right) \]
      10. times-frac86.3%

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - 0.5 \cdot \frac{b}{a}} \]
      2. distribute-lft-out--86.3%

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} \cdot \frac{1}{a}} - \frac{b}{a}\right) \]
      2. div-inv86.7%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}, \frac{1}{a}, -\frac{1}{a} \cdot b\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right)} \]
    10. Applied egg-rr86.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}, \frac{1}{a}, -\frac{1}{a} \cdot b\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right)} \]
    11. Step-by-step derivation
      1. fma-undefine86.5%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} \cdot \frac{1}{a} + \left(-\frac{1}{a} \cdot b\right)\right)} + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      2. associate-*r/86.4%

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

        \[\leadsto 0.5 \cdot \left(\left(\frac{\color{blue}{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}}{a} + \left(-\frac{1}{a} \cdot b\right)\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      4. unsub-neg86.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \frac{1}{a} \cdot b\right)} + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      5. associate-*l/85.9%

        \[\leadsto 0.5 \cdot \left(\left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \color{blue}{\frac{1 \cdot b}{a}}\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      6. *-lft-identity85.9%

        \[\leadsto 0.5 \cdot \left(\left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \frac{\color{blue}{b}}{a}\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      7. div-sub86.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a}} + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      8. distribute-neg-frac86.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a} + \mathsf{fma}\left(\frac{\color{blue}{-1}}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      10. associate-*l/86.9%

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \color{blue}{\frac{1 \cdot b}{a}}\right)\right) \]
      11. *-lft-identity86.9%

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{\color{blue}{b}}{a}\right)\right) \]
    12. Simplified86.9%

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

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, \color{blue}{b \cdot b}\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right) \]
    14. Applied egg-rr86.9%

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

    if 0.340000000000000024 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg92.4%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified92.4%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 92.4%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in a around 0 92.4%

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Step-by-step derivation
      1. unpow292.4%

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

      \[\leadsto a \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.34:\\ \;\;\;\;0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} + 2 \cdot \frac{-1}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 89.4% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.38:\\
\;\;\;\;0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot {b}^{-5}\right) - {b}^{-3}\right)\right) - \frac{c}{b}\\


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

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, \color{blue}{{b}^{2}}\right)}}{a} + \left(-\frac{b}{a \cdot 2}\right) \]
      8. *-un-lft-identity86.3%

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

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} + \left(-\frac{1 \cdot b}{\color{blue}{2 \cdot a}}\right) \]
      10. times-frac86.3%

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - 0.5 \cdot \frac{b}{a}} \]
      2. distribute-lft-out--86.3%

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

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

        \[\leadsto 0.5 \cdot \left(\color{blue}{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} \cdot \frac{1}{a}} - \frac{b}{a}\right) \]
      2. div-inv86.7%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}, \frac{1}{a}, -\frac{1}{a} \cdot b\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right)} \]
    10. Applied egg-rr86.8%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}, \frac{1}{a}, -\frac{1}{a} \cdot b\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right)} \]
    11. Step-by-step derivation
      1. fma-undefine86.5%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} \cdot \frac{1}{a} + \left(-\frac{1}{a} \cdot b\right)\right)} + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      2. associate-*r/86.4%

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

        \[\leadsto 0.5 \cdot \left(\left(\frac{\color{blue}{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}}{a} + \left(-\frac{1}{a} \cdot b\right)\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      4. unsub-neg86.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \frac{1}{a} \cdot b\right)} + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      5. associate-*l/85.9%

        \[\leadsto 0.5 \cdot \left(\left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \color{blue}{\frac{1 \cdot b}{a}}\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      6. *-lft-identity85.9%

        \[\leadsto 0.5 \cdot \left(\left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \frac{\color{blue}{b}}{a}\right) + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      7. div-sub86.4%

        \[\leadsto 0.5 \cdot \left(\color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a}} + \mathsf{fma}\left(-\frac{1}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      8. distribute-neg-frac86.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a} + \mathsf{fma}\left(\frac{\color{blue}{-1}}{a}, b, \frac{1}{a} \cdot b\right)\right) \]
      10. associate-*l/86.9%

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \color{blue}{\frac{1 \cdot b}{a}}\right)\right) \]
      11. *-lft-identity86.9%

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{\color{blue}{b}}{a}\right)\right) \]
    12. Simplified86.9%

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

        \[\leadsto 0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, \color{blue}{b \cdot b}\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right) \]
    14. Applied egg-rr86.9%

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

    if 0.38 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg92.4%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified92.4%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 92.4%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in a around 0 92.4%

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Taylor expanded in c around 0 89.7%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(-2 \cdot \frac{a \cdot c}{{b}^{5}} - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    11. Step-by-step derivation
      1. associate-*r/89.7%

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

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\frac{\color{blue}{\left(a \cdot c\right) \cdot -2}}{{b}^{5}} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      3. associate-/l*89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\color{blue}{\left(a \cdot c\right) \cdot \frac{-2}{{b}^{5}}} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      4. metadata-eval89.7%

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

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \color{blue}{\left(-2 \cdot \frac{1}{{b}^{5}}\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      6. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot \frac{1}{\color{blue}{e^{\log b \cdot 5}}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      7. exp-neg89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot \color{blue}{e^{-\log b \cdot 5}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      8. distribute-rgt-neg-in89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot e^{\color{blue}{\log b \cdot \left(-5\right)}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      9. metadata-eval89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot e^{\log b \cdot \color{blue}{-5}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      10. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot \color{blue}{{b}^{-5}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      11. *-commutative89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\color{blue}{\left(c \cdot a\right)} \cdot \left(-2 \cdot {b}^{-5}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      12. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - \frac{1}{\color{blue}{e^{\log b \cdot 3}}}\right)\right) - \frac{c}{b} \]
      13. rec-exp89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - \color{blue}{e^{-\log b \cdot 3}}\right)\right) - \frac{c}{b} \]
      14. distribute-rgt-neg-in89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - e^{\color{blue}{\log b \cdot \left(-3\right)}}\right)\right) - \frac{c}{b} \]
      15. metadata-eval89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - e^{\log b \cdot \color{blue}{-3}}\right)\right) - \frac{c}{b} \]
      16. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - \color{blue}{{b}^{-3}}\right)\right) - \frac{c}{b} \]
    12. Simplified89.7%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - {b}^{-3}\right)\right)} - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.38:\\ \;\;\;\;0.5 \cdot \left(\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a} + \mathsf{fma}\left(\frac{-1}{a}, b, \frac{b}{a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot {b}^{-5}\right) - {b}^{-3}\right)\right) - \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 89.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.36:\\ \;\;\;\;\frac{\sqrt{a \cdot \frac{{b}^{2} + -4 \cdot \left(a \cdot c\right)}{a}} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot {b}^{-5}\right) - {b}^{-3}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 0.36)
   (/ (- (sqrt (* a (/ (+ (pow b 2.0) (* -4.0 (* a c))) a))) b) (* a 2.0))
   (-
    (* a (* (pow c 2.0) (- (* (* a c) (* -2.0 (pow b -5.0))) (pow b -3.0))))
    (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.36) {
		tmp = (sqrt((a * ((pow(b, 2.0) + (-4.0 * (a * c))) / a))) - b) / (a * 2.0);
	} else {
		tmp = (a * (pow(c, 2.0) * (((a * c) * (-2.0 * pow(b, -5.0))) - pow(b, -3.0)))) - (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) :: tmp
    if (b <= 0.36d0) then
        tmp = (sqrt((a * (((b ** 2.0d0) + ((-4.0d0) * (a * c))) / a))) - b) / (a * 2.0d0)
    else
        tmp = (a * ((c ** 2.0d0) * (((a * c) * ((-2.0d0) * (b ** (-5.0d0)))) - (b ** (-3.0d0))))) - (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.36) {
		tmp = (Math.sqrt((a * ((Math.pow(b, 2.0) + (-4.0 * (a * c))) / a))) - b) / (a * 2.0);
	} else {
		tmp = (a * (Math.pow(c, 2.0) * (((a * c) * (-2.0 * Math.pow(b, -5.0))) - Math.pow(b, -3.0)))) - (c / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 0.36:
		tmp = (math.sqrt((a * ((math.pow(b, 2.0) + (-4.0 * (a * c))) / a))) - b) / (a * 2.0)
	else:
		tmp = (a * (math.pow(c, 2.0) * (((a * c) * (-2.0 * math.pow(b, -5.0))) - math.pow(b, -3.0)))) - (c / b)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 0.36)
		tmp = Float64(Float64(sqrt(Float64(a * Float64(Float64((b ^ 2.0) + Float64(-4.0 * Float64(a * c))) / a))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(a * Float64((c ^ 2.0) * Float64(Float64(Float64(a * c) * Float64(-2.0 * (b ^ -5.0))) - (b ^ -3.0)))) - Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 0.36)
		tmp = (sqrt((a * (((b ^ 2.0) + (-4.0 * (a * c))) / a))) - b) / (a * 2.0);
	else
		tmp = (a * ((c ^ 2.0) * (((a * c) * (-2.0 * (b ^ -5.0))) - (b ^ -3.0)))) - (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 0.36], N[(N[(N[Sqrt[N[(a * N[(N[(N[Power[b, 2.0], $MachinePrecision] + N[(-4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(N[(a * c), $MachinePrecision] * N[(-2.0 * N[Power[b, -5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[b, -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.36:\\
\;\;\;\;\frac{\sqrt{a \cdot \frac{{b}^{2} + -4 \cdot \left(a \cdot c\right)}{a}} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot {b}^{-5}\right) - {b}^{-3}\right)\right) - \frac{c}{b}\\


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

    1. Initial program 86.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 86.4%

      \[\leadsto \frac{\sqrt{\color{blue}{a \cdot \left(-4 \cdot c + \frac{{b}^{2}}{a}\right)}} - b}{a \cdot 2} \]
    6. Taylor expanded in a around 0 86.8%

      \[\leadsto \frac{\sqrt{a \cdot \color{blue}{\frac{-4 \cdot \left(a \cdot c\right) + {b}^{2}}{a}}} - b}{a \cdot 2} \]

    if 0.35999999999999999 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 92.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg92.4%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg92.4%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified92.4%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 92.4%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in a around 0 92.4%

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Taylor expanded in c around 0 89.7%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(-2 \cdot \frac{a \cdot c}{{b}^{5}} - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    11. Step-by-step derivation
      1. associate-*r/89.7%

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

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\frac{\color{blue}{\left(a \cdot c\right) \cdot -2}}{{b}^{5}} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      3. associate-/l*89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\color{blue}{\left(a \cdot c\right) \cdot \frac{-2}{{b}^{5}}} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      4. metadata-eval89.7%

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

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \color{blue}{\left(-2 \cdot \frac{1}{{b}^{5}}\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      6. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot \frac{1}{\color{blue}{e^{\log b \cdot 5}}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      7. exp-neg89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot \color{blue}{e^{-\log b \cdot 5}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      8. distribute-rgt-neg-in89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot e^{\color{blue}{\log b \cdot \left(-5\right)}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      9. metadata-eval89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot e^{\log b \cdot \color{blue}{-5}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      10. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(a \cdot c\right) \cdot \left(-2 \cdot \color{blue}{{b}^{-5}}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      11. *-commutative89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\color{blue}{\left(c \cdot a\right)} \cdot \left(-2 \cdot {b}^{-5}\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
      12. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - \frac{1}{\color{blue}{e^{\log b \cdot 3}}}\right)\right) - \frac{c}{b} \]
      13. rec-exp89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - \color{blue}{e^{-\log b \cdot 3}}\right)\right) - \frac{c}{b} \]
      14. distribute-rgt-neg-in89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - e^{\color{blue}{\log b \cdot \left(-3\right)}}\right)\right) - \frac{c}{b} \]
      15. metadata-eval89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - e^{\log b \cdot \color{blue}{-3}}\right)\right) - \frac{c}{b} \]
      16. exp-to-pow89.7%

        \[\leadsto a \cdot \left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - \color{blue}{{b}^{-3}}\right)\right) - \frac{c}{b} \]
    12. Simplified89.7%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(\left(c \cdot a\right) \cdot \left(-2 \cdot {b}^{-5}\right) - {b}^{-3}\right)\right)} - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.3%

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

Alternative 7: 84.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 46:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{{c}^{2}}{{b}^{3}} \cdot \left(-a\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 46.0)
   (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
   (- (* (/ (pow c 2.0) (pow b 3.0)) (- a)) (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 46.0) {
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	} else {
		tmp = ((pow(c, 2.0) / pow(b, 3.0)) * -a) - (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) :: tmp
    if (b <= 46.0d0) then
        tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
    else
        tmp = (((c ** 2.0d0) / (b ** 3.0d0)) * -a) - (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 46.0) {
		tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	} else {
		tmp = ((Math.pow(c, 2.0) / Math.pow(b, 3.0)) * -a) - (c / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 46.0:
		tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)
	else:
		tmp = ((math.pow(c, 2.0) / math.pow(b, 3.0)) * -a) - (c / b)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 46.0)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(Float64((c ^ 2.0) / (b ^ 3.0)) * Float64(-a)) - Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 46.0)
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	else
		tmp = (((c ^ 2.0) / (b ^ 3.0)) * -a) - (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 46.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * (-a)), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 46:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{{c}^{2}}{{b}^{3}} \cdot \left(-a\right) - \frac{c}{b}\\


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

    1. Initial program 79.5%

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

    if 46 < b

    1. Initial program 48.4%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 86.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    6. Step-by-step derivation
      1. mul-1-neg86.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
      3. mul-1-neg86.8%

        \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      4. distribute-neg-frac286.8%

        \[\leadsto \color{blue}{\frac{c}{-b}} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      5. associate-/l*86.8%

        \[\leadsto \frac{c}{-b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    7. Simplified86.8%

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

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

Alternative 8: 84.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 46:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-c\right) - a \cdot {\left(\frac{c}{b}\right)}^{2}}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 46.0)
   (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
   (/ (- (- c) (* a (pow (/ c b) 2.0))) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 46.0) {
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	} else {
		tmp = (-c - (a * pow((c / b), 2.0))) / 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) :: tmp
    if (b <= 46.0d0) then
        tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
    else
        tmp = (-c - (a * ((c / b) ** 2.0d0))) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 46.0) {
		tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	} else {
		tmp = (-c - (a * Math.pow((c / b), 2.0))) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 46.0:
		tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)
	else:
		tmp = (-c - (a * math.pow((c / b), 2.0))) / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 46.0)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(Float64(-c) - Float64(a * (Float64(c / b) ^ 2.0))) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 46.0)
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	else
		tmp = (-c - (a * ((c / b) ^ 2.0))) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 46.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[((-c) - N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 46:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-c\right) - a \cdot {\left(\frac{c}{b}\right)}^{2}}{b}\\


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

    1. Initial program 79.5%

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

    if 46 < b

    1. Initial program 48.4%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 93.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.8%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
      2. mul-1-neg93.8%

        \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
      3. unsub-neg93.8%

        \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
    7. Simplified93.8%

      \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    8. Taylor expanded in c around 0 93.8%

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Taylor expanded in b around inf 86.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} - c}{b}} \]
    10. Step-by-step derivation
      1. sub-neg86.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}}{b} \]
      5. associate-/l*86.8%

        \[\leadsto \frac{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}{b} \]
      6. unpow286.8%

        \[\leadsto \frac{\left(-c\right) - a \cdot \frac{\color{blue}{c \cdot c}}{{b}^{2}}}{b} \]
      7. unpow286.8%

        \[\leadsto \frac{\left(-c\right) - a \cdot \frac{c \cdot c}{\color{blue}{b \cdot b}}}{b} \]
      8. times-frac86.8%

        \[\leadsto \frac{\left(-c\right) - a \cdot \color{blue}{\left(\frac{c}{b} \cdot \frac{c}{b}\right)}}{b} \]
      9. unpow286.8%

        \[\leadsto \frac{\left(-c\right) - a \cdot \color{blue}{{\left(\frac{c}{b}\right)}^{2}}}{b} \]
    11. Simplified86.8%

      \[\leadsto \color{blue}{\frac{\left(-c\right) - a \cdot {\left(\frac{c}{b}\right)}^{2}}{b}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.8%

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

Alternative 9: 81.5% accurate, 1.0× speedup?

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

\\
\frac{\left(-c\right) - a \cdot {\left(\frac{c}{b}\right)}^{2}}{b}
\end{array}
Derivation
  1. Initial program 57.0%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in a around 0 89.5%

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative89.5%

      \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + -1 \cdot \frac{c}{b}} \]
    2. mul-1-neg89.5%

      \[\leadsto a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \color{blue}{\left(-\frac{c}{b}\right)} \]
    3. unsub-neg89.5%

      \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot \frac{{c}^{4}}{{b}^{6}} + 16 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) - \frac{c}{b}} \]
  7. Simplified89.5%

    \[\leadsto \color{blue}{a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, \frac{-0.25 \cdot \left(a \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right)\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
  8. Taylor expanded in c around 0 89.5%

    \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(c \cdot \left(-5 \cdot \frac{{a}^{2} \cdot c}{{b}^{7}} + -2 \cdot \frac{a}{{b}^{5}}\right) - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
  9. Taylor expanded in b around inf 79.7%

    \[\leadsto \color{blue}{\frac{-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} - c}{b}} \]
  10. Step-by-step derivation
    1. sub-neg79.7%

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

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

      \[\leadsto \frac{\left(-c\right) + \color{blue}{\left(-\frac{a \cdot {c}^{2}}{{b}^{2}}\right)}}{b} \]
    4. unsub-neg79.7%

      \[\leadsto \frac{\color{blue}{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}}{b} \]
    5. associate-/l*79.7%

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

      \[\leadsto \frac{\left(-c\right) - a \cdot \frac{\color{blue}{c \cdot c}}{{b}^{2}}}{b} \]
    7. unpow279.7%

      \[\leadsto \frac{\left(-c\right) - a \cdot \frac{c \cdot c}{\color{blue}{b \cdot b}}}{b} \]
    8. times-frac79.7%

      \[\leadsto \frac{\left(-c\right) - a \cdot \color{blue}{\left(\frac{c}{b} \cdot \frac{c}{b}\right)}}{b} \]
    9. unpow279.7%

      \[\leadsto \frac{\left(-c\right) - a \cdot \color{blue}{{\left(\frac{c}{b}\right)}^{2}}}{b} \]
  11. Simplified79.7%

    \[\leadsto \color{blue}{\frac{\left(-c\right) - a \cdot {\left(\frac{c}{b}\right)}^{2}}{b}} \]
  12. Add Preprocessing

Alternative 10: 64.5% accurate, 29.0× speedup?

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

\\
\frac{-c}{b}
\end{array}
Derivation
  1. Initial program 57.0%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in a around 0 63.3%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
    2. mul-1-neg63.3%

      \[\leadsto \frac{\color{blue}{-c}}{b} \]
  7. Simplified63.3%

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Add Preprocessing

Alternative 11: 3.2% accurate, 116.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
	return 0.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.0d0
end function
public static double code(double a, double b, double c) {
	return 0.0;
}
def code(a, b, c):
	return 0.0
function code(a, b, c)
	return 0.0
end
function tmp = code(a, b, c)
	tmp = 0.0;
end
code[a_, b_, c_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 57.0%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in a around 0 63.3%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
    2. mul-1-neg63.3%

      \[\leadsto \frac{\color{blue}{-c}}{b} \]
  7. Simplified63.3%

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Step-by-step derivation
    1. distribute-frac-neg63.3%

      \[\leadsto \color{blue}{-\frac{c}{b}} \]
    2. mul-1-neg63.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. expm1-log1p-u56.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-1 \cdot \frac{c}{b}\right)\right)} \]
    4. expm1-undefine43.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{c}{b}\right)} - 1} \]
    5. mul-1-neg43.9%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-\frac{c}{b}}\right)} - 1 \]
    6. distribute-frac-neg243.9%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{c}{-b}}\right)} - 1 \]
  9. Applied egg-rr43.9%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c}{-b}\right)} - 1} \]
  10. Step-by-step derivation
    1. sub-neg43.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c}{-b}\right)} + \left(-1\right)} \]
    2. log1p-undefine43.9%

      \[\leadsto e^{\color{blue}{\log \left(1 + \frac{c}{-b}\right)}} + \left(-1\right) \]
    3. rem-exp-log50.6%

      \[\leadsto \color{blue}{\left(1 + \frac{c}{-b}\right)} + \left(-1\right) \]
    4. distribute-frac-neg250.6%

      \[\leadsto \left(1 + \color{blue}{\left(-\frac{c}{b}\right)}\right) + \left(-1\right) \]
    5. unsub-neg50.6%

      \[\leadsto \color{blue}{\left(1 - \frac{c}{b}\right)} + \left(-1\right) \]
    6. metadata-eval50.6%

      \[\leadsto \left(1 - \frac{c}{b}\right) + \color{blue}{-1} \]
  11. Simplified50.6%

    \[\leadsto \color{blue}{\left(1 - \frac{c}{b}\right) + -1} \]
  12. Taylor expanded in c around 0 3.2%

    \[\leadsto \color{blue}{1} + -1 \]
  13. Final simplification3.2%

    \[\leadsto 0 \]
  14. Add Preprocessing

Reproduce

?
herbie shell --seed 2024141 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))