Quadratic roots, wide range

Percentage Accurate: 47.4% → 66.2%
Time: 22.3s
Alternatives: 8
Speedup: 29.0×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(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: 47.4% 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: 66.2% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;a \leq 0.0088:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(\left(-0.25 \cdot \frac{16 \cdot t\_0 + 4 \cdot t\_0}{a \cdot {b}^{7}} - {\left(\frac{c}{b}\right)}^{2} \cdot \frac{a}{b}\right) - \frac{c}{b}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.95e-25

    1. Initial program 75.6%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg75.6%

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

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

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

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

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

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

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

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

    if 1.95e-25 < a < 0.00880000000000000053

    1. Initial program 58.3%

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u38.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine59.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      5. times-frac59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1} \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1 \]
    7. Applied egg-rr59.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1} \]
    8. Step-by-step derivation
      1. sub-neg59.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \left(-1\right)} \]
      2. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \color{blue}{-1} \]
      3. +-commutative59.5%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
      4. log1p-undefine59.5%

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

        \[\leadsto -1 + \color{blue}{\left(1 + -1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      6. mul-1-neg69.6%

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative69.6%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*69.6%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses69.6%

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

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

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.00880000000000000053 < a

    1. Initial program 42.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. *-commutative42.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 65.8% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.85 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

\mathbf{elif}\;a \leq 0.0072:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.85000000000000004e-25

    1. Initial program 75.6%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg75.6%

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

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

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

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

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

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

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

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

    if 1.85000000000000004e-25 < a < 0.0071999999999999998

    1. Initial program 58.3%

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u38.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine59.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      5. times-frac59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1} \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1 \]
    7. Applied egg-rr59.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1} \]
    8. Step-by-step derivation
      1. sub-neg59.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \left(-1\right)} \]
      2. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \color{blue}{-1} \]
      3. +-commutative59.5%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
      4. log1p-undefine59.5%

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

        \[\leadsto -1 + \color{blue}{\left(1 + -1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      6. mul-1-neg69.6%

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative69.6%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*69.6%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses69.6%

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

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

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.0071999999999999998 < a

    1. Initial program 42.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. *-commutative42.0%

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

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

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

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

Alternative 3: 65.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.45 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

\mathbf{elif}\;a \leq 0.0136:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.45e-25

    1. Initial program 75.6%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg75.6%

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

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

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

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

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

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

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

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

    if 1.45e-25 < a < 0.0135999999999999992

    1. Initial program 58.3%

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u38.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine59.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      5. times-frac59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1} \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1 \]
    7. Applied egg-rr59.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1} \]
    8. Step-by-step derivation
      1. sub-neg59.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \left(-1\right)} \]
      2. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \color{blue}{-1} \]
      3. +-commutative59.5%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
      4. log1p-undefine59.5%

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

        \[\leadsto -1 + \color{blue}{\left(1 + -1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      6. mul-1-neg69.6%

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative69.6%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*69.6%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses69.6%

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

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

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.0135999999999999992 < a

    1. Initial program 42.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. *-commutative42.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-4, \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}, -2 \cdot \left(a \cdot \frac{c}{b} + \frac{\color{blue}{1 \cdot \left(a \cdot c\right)}}{{b}^{1.5} \cdot \frac{{b}^{1.5}}{a \cdot c}}\right)\right)}{a \cdot 2} \]
      16. *-un-lft-identity78.1%

        \[\leadsto \frac{\mathsf{fma}\left(-4, \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}, -2 \cdot \left(a \cdot \frac{c}{b} + \frac{\color{blue}{a \cdot c}}{{b}^{1.5} \cdot \frac{{b}^{1.5}}{a \cdot c}}\right)\right)}{a \cdot 2} \]
    11. Applied egg-rr78.1%

      \[\leadsto \frac{\mathsf{fma}\left(-4, \frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}, -2 \cdot \left(a \cdot \frac{c}{b} + \color{blue}{\frac{a \cdot c}{{b}^{1.5} \cdot \frac{{b}^{1.5}}{a \cdot c}}}\right)\right)}{a \cdot 2} \]
    12. Step-by-step derivation
      1. associate-*r/78.1%

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

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

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

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

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

Alternative 4: 64.9% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;a \leq 0.0065:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 3.9e-25

    1. Initial program 75.6%

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

    if 3.9e-25 < a < 0.0064999999999999997

    1. Initial program 58.3%

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u38.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine59.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      5. times-frac59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1} \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1 \]
    7. Applied egg-rr59.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1} \]
    8. Step-by-step derivation
      1. sub-neg59.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \left(-1\right)} \]
      2. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \color{blue}{-1} \]
      3. +-commutative59.5%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
      4. log1p-undefine59.5%

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

        \[\leadsto -1 + \color{blue}{\left(1 + -1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      6. mul-1-neg69.6%

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative69.6%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*69.6%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses69.6%

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

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

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.0064999999999999997 < a

    1. Initial program 42.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. *-commutative42.0%

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + -2 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. distribute-lft-out75.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-c}{b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    10. Simplified75.9%

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

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

Alternative 5: 65.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 1.26 \cdot 10^{-25}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;a \leq 0.0067:\\ \;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= a 1.26e-25)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
   (if (<= a 0.0067)
     (+ -1.0 (- 1.0 (/ c b)))
     (- (/ c (- b)) (* a (/ (pow c 2.0) (pow b 3.0)))))))
double code(double a, double b, double c) {
	double tmp;
	if (a <= 1.26e-25) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
	} else if (a <= 0.0067) {
		tmp = -1.0 + (1.0 - (c / b));
	} else {
		tmp = (c / -b) - (a * (pow(c, 2.0) / pow(b, 3.0)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (a <= 1.26e-25)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
	elseif (a <= 0.0067)
		tmp = Float64(-1.0 + Float64(1.0 - Float64(c / b)));
	else
		tmp = Float64(Float64(c / Float64(-b)) - Float64(a * Float64((c ^ 2.0) / (b ^ 3.0))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[a, 1.26e-25], 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], If[LessEqual[a, 0.0067], N[(-1.0 + N[(1.0 - N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / (-b)), $MachinePrecision] - N[(a * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.26 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

\mathbf{elif}\;a \leq 0.0067:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.26e-25

    1. Initial program 75.6%

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg75.6%

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

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

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

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

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

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

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

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

    if 1.26e-25 < a < 0.00670000000000000023

    1. Initial program 58.3%

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u38.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine59.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      5. times-frac59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1} \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1 \]
    7. Applied egg-rr59.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1} \]
    8. Step-by-step derivation
      1. sub-neg59.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \left(-1\right)} \]
      2. metadata-eval59.5%

        \[\leadsto e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \color{blue}{-1} \]
      3. +-commutative59.5%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
      4. log1p-undefine59.5%

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

        \[\leadsto -1 + \color{blue}{\left(1 + -1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      6. mul-1-neg69.6%

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative69.6%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*69.6%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses69.6%

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

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

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.00670000000000000023 < a

    1. Initial program 42.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. *-commutative42.0%

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + -2 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. distribute-lft-out75.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-c}{b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    10. Simplified75.9%

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

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

Alternative 6: 60.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{if}\;a \leq 2.85 \cdot 10^{-25}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.038:\\ \;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\ \mathbf{elif}\;a \leq 0.92 \lor \neg \left(a \leq 1900000\right):\\ \;\;\;\;\frac{c}{-b}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))))
   (if (<= a 2.85e-25)
     t_0
     (if (<= a 0.038)
       (+ -1.0 (- 1.0 (/ c b)))
       (if (or (<= a 0.92) (not (<= a 1900000.0))) (/ c (- b)) t_0)))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	double tmp;
	if (a <= 2.85e-25) {
		tmp = t_0;
	} else if (a <= 0.038) {
		tmp = -1.0 + (1.0 - (c / b));
	} else if ((a <= 0.92) || !(a <= 1900000.0)) {
		tmp = c / -b;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
    if (a <= 2.85d-25) then
        tmp = t_0
    else if (a <= 0.038d0) then
        tmp = (-1.0d0) + (1.0d0 - (c / b))
    else if ((a <= 0.92d0) .or. (.not. (a <= 1900000.0d0))) then
        tmp = c / -b
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	double tmp;
	if (a <= 2.85e-25) {
		tmp = t_0;
	} else if (a <= 0.038) {
		tmp = -1.0 + (1.0 - (c / b));
	} else if ((a <= 0.92) || !(a <= 1900000.0)) {
		tmp = c / -b;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)
	tmp = 0
	if a <= 2.85e-25:
		tmp = t_0
	elif a <= 0.038:
		tmp = -1.0 + (1.0 - (c / b))
	elif (a <= 0.92) or not (a <= 1900000.0):
		tmp = c / -b
	else:
		tmp = t_0
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0))
	tmp = 0.0
	if (a <= 2.85e-25)
		tmp = t_0;
	elseif (a <= 0.038)
		tmp = Float64(-1.0 + Float64(1.0 - Float64(c / b)));
	elseif ((a <= 0.92) || !(a <= 1900000.0))
		tmp = Float64(c / Float64(-b));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	tmp = 0.0;
	if (a <= 2.85e-25)
		tmp = t_0;
	elseif (a <= 0.038)
		tmp = -1.0 + (1.0 - (c / b));
	elseif ((a <= 0.92) || ~((a <= 1900000.0)))
		tmp = c / -b;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 2.85e-25], t$95$0, If[LessEqual[a, 0.038], N[(-1.0 + N[(1.0 - N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[a, 0.92], N[Not[LessEqual[a, 1900000.0]], $MachinePrecision]], N[(c / (-b)), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;a \leq 2.85 \cdot 10^{-25}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;a \leq 0.038:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

\mathbf{elif}\;a \leq 0.92 \lor \neg \left(a \leq 1900000\right):\\
\;\;\;\;\frac{c}{-b}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 2.8500000000000002e-25 or 0.92000000000000004 < a < 1.9e6

    1. Initial program 69.5%

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

    if 2.8500000000000002e-25 < a < 0.0379999999999999991

    1. Initial program 59.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. *-commutative59.0%

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u37.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine58.3%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative58.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{2 \cdot a}}\right)} - 1 \]
      5. times-frac58.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval58.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1} \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1 \]
    7. Applied egg-rr58.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} - 1} \]
    8. Step-by-step derivation
      1. sub-neg58.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \left(-1\right)} \]
      2. metadata-eval58.3%

        \[\leadsto e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} + \color{blue}{-1} \]
      3. +-commutative58.3%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
      4. log1p-undefine58.3%

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

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

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative68.7%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*68.7%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses68.7%

        \[\leadsto -1 + \left(1 - \frac{c}{b} \cdot \color{blue}{1}\right) \]
      11. *-rgt-identity68.7%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b}}\right) \]
    9. Simplified68.7%

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.0379999999999999991 < a < 0.92000000000000004 or 1.9e6 < a

    1. Initial program 34.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. *-commutative34.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg76.8%

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

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified76.8%

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 2.85 \cdot 10^{-25}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;a \leq 0.038:\\ \;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\ \mathbf{elif}\;a \leq 0.92 \lor \neg \left(a \leq 1900000\right):\\ \;\;\;\;\frac{c}{-b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 61.6% accurate, 5.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 0.035 \lor \neg \left(a \leq 0.8\right) \land a \leq 47000000:\\ \;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (or (<= a 0.035) (and (not (<= a 0.8)) (<= a 47000000.0)))
   (+ -1.0 (- 1.0 (/ c b)))
   (/ c (- b))))
double code(double a, double b, double c) {
	double tmp;
	if ((a <= 0.035) || (!(a <= 0.8) && (a <= 47000000.0))) {
		tmp = -1.0 + (1.0 - (c / b));
	} else {
		tmp = 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 ((a <= 0.035d0) .or. (.not. (a <= 0.8d0)) .and. (a <= 47000000.0d0)) then
        tmp = (-1.0d0) + (1.0d0 - (c / b))
    else
        tmp = c / -b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if ((a <= 0.035) || (!(a <= 0.8) && (a <= 47000000.0))) {
		tmp = -1.0 + (1.0 - (c / b));
	} else {
		tmp = c / -b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if (a <= 0.035) or (not (a <= 0.8) and (a <= 47000000.0)):
		tmp = -1.0 + (1.0 - (c / b))
	else:
		tmp = c / -b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if ((a <= 0.035) || (!(a <= 0.8) && (a <= 47000000.0)))
		tmp = Float64(-1.0 + Float64(1.0 - Float64(c / b)));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if ((a <= 0.035) || (~((a <= 0.8)) && (a <= 47000000.0)))
		tmp = -1.0 + (1.0 - (c / b));
	else
		tmp = c / -b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[Or[LessEqual[a, 0.035], And[N[Not[LessEqual[a, 0.8]], $MachinePrecision], LessEqual[a, 47000000.0]]], N[(-1.0 + N[(1.0 - N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 0.035 \lor \neg \left(a \leq 0.8\right) \land a \leq 47000000:\\
\;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 0.035000000000000003 or 0.80000000000000004 < a < 4.7e7

    1. Initial program 62.7%

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. expm1-log1p-u34.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\right)\right)} \]
      2. expm1-undefine55.9%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}}{a \cdot 2}\right)} - 1 \]
      4. *-commutative55.9%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-2}{2} \cdot \frac{a \cdot \frac{c}{b}}{a}}\right)} - 1 \]
      6. metadata-eval55.9%

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

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

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

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

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

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

        \[\leadsto -1 + \color{blue}{\left(1 + -1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      6. mul-1-neg65.6%

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

        \[\leadsto -1 + \color{blue}{\left(1 - \frac{a \cdot \frac{c}{b}}{a}\right)} \]
      8. *-commutative65.6%

        \[\leadsto -1 + \left(1 - \frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right) \]
      9. associate-/l*65.6%

        \[\leadsto -1 + \left(1 - \color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right) \]
      10. *-inverses65.6%

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

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

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{c}{b}\right)} \]

    if 0.035000000000000003 < a < 0.80000000000000004 or 4.7e7 < a

    1. Initial program 32.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 0.035 \lor \neg \left(a \leq 0.8\right) \land a \leq 47000000:\\ \;\;\;\;-1 + \left(1 - \frac{c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 60.8% 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(c / Float64(-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 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{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in b around inf 55.6%

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

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

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
  7. Simplified55.6%

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Final simplification55.6%

    \[\leadsto \frac{c}{-b} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024046 
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))