Quadratic roots, narrow range

Percentage Accurate: 55.8% → 99.4%
Time: 16.4s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 55.8% 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: 99.4% accurate, 0.3× speedup?

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

\\
\frac{-2 \cdot \frac{a \cdot c}{a}}{b + \sqrt{\frac{{b}^{4} - {\left(a \cdot c\right)}^{2} \cdot 16}{\mathsf{fma}\left(a \cdot c, 4, b \cdot b\right)}}}
\end{array}
Derivation
  1. Initial program 53.9%

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      4. distribute-rgt-neg-in53.9%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\frac{{b}^{2} \cdot \color{blue}{{b}^{2}}}{b \cdot b + \left(4 \cdot a\right) \cdot c} - \frac{\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)}{b \cdot b + \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2} \]
      11. pow-prod-up53.5%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\frac{{b}^{4}}{\mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)} - \frac{{\left(4 \cdot \left(a \cdot c\right)\right)}^{2}}{\color{blue}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}} - b}{a \cdot 2} \]
      18. associate-*l*53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 99.3% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \frac{\frac{\left(a \cdot c\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)}}}{a \cdot 2} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (/ (/ (* (* a c) -4.0) (+ b (sqrt (fma -4.0 (* a c) (* b b))))) (* a 2.0)))
    double code(double a, double b, double c) {
    	return (((a * c) * -4.0) / (b + sqrt(fma(-4.0, (a * c), (b * b))))) / (a * 2.0);
    }
    
    function code(a, b, c)
    	return Float64(Float64(Float64(Float64(a * c) * -4.0) / Float64(b + sqrt(fma(-4.0, Float64(a * c), Float64(b * b))))) / Float64(a * 2.0))
    end
    
    code[a_, b_, c_] := N[(N[(N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision] / N[(b + N[Sqrt[N[(-4.0 * N[(a * c), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{\frac{\left(a \cdot c\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(-4, a \cdot c, b \cdot b\right)}}}{a \cdot 2}
    \end{array}
    
    Derivation
    1. Initial program 53.9%

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

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

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

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

          \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
        4. distribute-rgt-neg-in53.9%

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

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

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

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

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

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

          \[\leadsto \frac{\sqrt{\frac{{b}^{2} \cdot \color{blue}{{b}^{2}}}{b \cdot b + \left(4 \cdot a\right) \cdot c} - \frac{\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)}{b \cdot b + \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2} \]
        11. pow-prod-up53.5%

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

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

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

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

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

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

          \[\leadsto \frac{\sqrt{\frac{{b}^{4}}{\mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)} - \frac{{\left(4 \cdot \left(a \cdot c\right)\right)}^{2}}{\color{blue}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}} - b}{a \cdot 2} \]
        18. associate-*l*53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 99.3% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \frac{\frac{\left(a \cdot c\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}}{a \cdot 2} \end{array} \]
      (FPCore (a b c)
       :precision binary64
       (/ (/ (* (* a c) -4.0) (+ b (sqrt (fma b b (* a (* c -4.0)))))) (* a 2.0)))
      double code(double a, double b, double c) {
      	return (((a * c) * -4.0) / (b + sqrt(fma(b, b, (a * (c * -4.0)))))) / (a * 2.0);
      }
      
      function code(a, b, c)
      	return Float64(Float64(Float64(Float64(a * c) * -4.0) / Float64(b + sqrt(fma(b, b, Float64(a * Float64(c * -4.0)))))) / Float64(a * 2.0))
      end
      
      code[a_, b_, c_] := N[(N[(N[(N[(a * c), $MachinePrecision] * -4.0), $MachinePrecision] / N[(b + N[Sqrt[N[(b * b + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \frac{\frac{\left(a \cdot c\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}}{a \cdot 2}
      \end{array}
      
      Derivation
      1. Initial program 53.9%

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

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

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

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

            \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
          4. distribute-rgt-neg-in53.9%

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

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

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

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

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

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

            \[\leadsto \frac{\sqrt{\frac{{b}^{2} \cdot \color{blue}{{b}^{2}}}{b \cdot b + \left(4 \cdot a\right) \cdot c} - \frac{\left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)}{b \cdot b + \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2} \]
          11. pow-prod-up53.5%

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

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

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

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

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

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

            \[\leadsto \frac{\sqrt{\frac{{b}^{4}}{\mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)} - \frac{{\left(4 \cdot \left(a \cdot c\right)\right)}^{2}}{\color{blue}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}} - b}{a \cdot 2} \]
          18. associate-*l*53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 4: 85.2% accurate, 0.5× speedup?

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

          1. Initial program 79.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. Simplified79.4%

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

            if 12 < b

            1. Initial program 47.3%

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

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

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

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

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

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

                \[\leadsto \frac{-c}{b} - \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}} \]
              6. associate-/r/86.7%

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

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

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

                \[\leadsto \frac{-c}{b} - \frac{a}{\color{blue}{\left(b \cdot b\right) \cdot b}} \cdot \left(c \cdot c\right) \]
            6. Applied egg-rr86.7%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 12:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{a}{b \cdot \left(b \cdot b\right)} \cdot \left(c \cdot c\right)\\ \end{array} \]

          Alternative 5: 85.2% accurate, 1.0× speedup?

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

            1. Initial program 79.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. Simplified79.4%

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

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

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

                  \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
                4. distribute-rgt-neg-in79.4%

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

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

                  \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - \left(4 \cdot a\right) \cdot c}} - b}{a \cdot 2} \]
                7. associate-*l*79.4%

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

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

              if 12 < b

              1. Initial program 47.3%

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

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

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

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

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

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

                  \[\leadsto \frac{-c}{b} - \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}} \]
                6. associate-/r/86.7%

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

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

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

                  \[\leadsto \frac{-c}{b} - \frac{a}{\color{blue}{\left(b \cdot b\right) \cdot b}} \cdot \left(c \cdot c\right) \]
              6. Applied egg-rr86.7%

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

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

            Alternative 6: 81.3% accurate, 7.3× speedup?

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

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

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

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

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

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

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

                \[\leadsto \frac{-c}{b} - \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}} \]
              6. associate-/r/81.4%

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

                \[\leadsto \frac{-c}{b} - \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)} \]
            4. Simplified81.4%

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

                \[\leadsto \frac{-c}{b} - \frac{a}{\color{blue}{\left(b \cdot b\right) \cdot b}} \cdot \left(c \cdot c\right) \]
            6. Applied egg-rr81.4%

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

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

            Alternative 7: 64.1% 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 53.9%

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

              \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
            3. Step-by-step derivation
              1. mul-1-neg65.4%

                \[\leadsto \color{blue}{-\frac{c}{b}} \]
              2. distribute-neg-frac65.4%

                \[\leadsto \color{blue}{\frac{-c}{b}} \]
            4. Simplified65.4%

              \[\leadsto \color{blue}{\frac{-c}{b}} \]
            5. Final simplification65.4%

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

            Alternative 8: 3.2% accurate, 38.7× speedup?

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

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

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

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

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

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

                \[\leadsto \frac{\left(-b\right) + \sqrt{\left(b + \color{blue}{2} \cdot \sqrt{a \cdot c}\right) \cdot \left(b - \sqrt{\left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
              6. associate-*l*53.9%

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

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

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

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

                \[\leadsto \frac{\left(-b\right) + \sqrt{\left(b + \color{blue}{\sqrt{a \cdot c} \cdot 2}\right) \cdot \left(b - 2 \cdot \sqrt{a \cdot c}\right)}}{2 \cdot a} \]
              2. cancel-sign-sub-inv53.9%

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

                \[\leadsto \frac{\left(-b\right) + \sqrt{\left(b + \sqrt{a \cdot c} \cdot 2\right) \cdot \left(b + \color{blue}{-2} \cdot \sqrt{a \cdot c}\right)}}{2 \cdot a} \]
            5. Simplified53.9%

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

              \[\leadsto \color{blue}{0.25 \cdot \frac{-2 \cdot \sqrt{a \cdot c} + 2 \cdot \sqrt{a \cdot c}}{a}} \]
            7. Step-by-step derivation
              1. associate-*r/3.2%

                \[\leadsto \color{blue}{\frac{0.25 \cdot \left(-2 \cdot \sqrt{a \cdot c} + 2 \cdot \sqrt{a \cdot c}\right)}{a}} \]
              2. distribute-rgt-out3.2%

                \[\leadsto \frac{0.25 \cdot \color{blue}{\left(\sqrt{a \cdot c} \cdot \left(-2 + 2\right)\right)}}{a} \]
              3. metadata-eval3.2%

                \[\leadsto \frac{0.25 \cdot \left(\sqrt{a \cdot c} \cdot \color{blue}{0}\right)}{a} \]
              4. mul0-rgt3.2%

                \[\leadsto \frac{0.25 \cdot \color{blue}{0}}{a} \]
              5. metadata-eval3.2%

                \[\leadsto \frac{\color{blue}{0}}{a} \]
            8. Simplified3.2%

              \[\leadsto \color{blue}{\frac{0}{a}} \]
            9. Final simplification3.2%

              \[\leadsto \frac{0}{a} \]

            Reproduce

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