Cubic critical, wide range

Percentage Accurate: 63.8% → 79.6%
Time: 49.9s
Alternatives: 10
Speedup: 5.3×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 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: 63.8% accurate, 1.0× speedup?

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

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

Alternative 1: 79.6% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(a \cdot \left(c \cdot -1.5\right)\right)}^{2}\\
t_1 := \mathsf{fma}\left(1.5, t\_0 \cdot \left(c \cdot a\right), a \cdot \left(c \cdot 0\right)\right)\\
\mathbf{if}\;b \leq 21000000000:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{b}, -0.16666666666666666 \cdot \left(\left(\frac{t\_0}{a \cdot {b}^{3}} + \frac{t\_1}{a \cdot {b}^{5}}\right) + \frac{\mathsf{fma}\left(a \cdot 1.5, c \cdot t\_1, {\left(-0.5 \cdot t\_0\right)}^{2}\right)}{a \cdot {b}^{7}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\


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

    1. Initial program 42.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip3--41.8%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\frac{1}{\frac{{b}^{\color{blue}{4}} + \left(\left(3 \cdot \left(a \cdot c\right)\right) \cdot \left(3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot b\right) \cdot \left(3 \cdot \left(a \cdot c\right)\right)\right)}{{\left(b \cdot b\right)}^{3} - {\left(3 \cdot \left(a \cdot c\right)\right)}^{3}}}}}{3 \cdot a} \]
      7. distribute-rgt-out37.4%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\frac{1}{\frac{{b}^{4} + \left(3 \cdot \left(a \cdot c\right)\right) \cdot \mathsf{fma}\left(b, b, 3 \cdot \left(a \cdot c\right)\right)}{{b}^{6} - {\left(3 \cdot \left(a \cdot c\right)\right)}^{3}}}}}}{3 \cdot a} \]
    7. Taylor expanded in b around inf 86.2%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + \left(-0.16666666666666666 \cdot \frac{-9 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 9 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)\right)\right) + \left(1.5 \cdot \left(a \cdot \left(c \cdot \left(-3 \cdot \left(a \cdot \left(c \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 9 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)\right)\right) + 1.5 \cdot \left(a \cdot \left(c \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + \left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + {\left(-1.5 \cdot \left(a \cdot c\right)\right)}^{2}\right)\right)\right)\right)\right)\right)\right) + \left(9 \cdot \left({a}^{2} \cdot \left({c}^{2} \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 9 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)\right)\right) + {\left(-0.5 \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + \left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + {\left(-1.5 \cdot \left(a \cdot c\right)\right)}^{2}\right)\right)\right)}^{2}\right)\right)}{a \cdot {b}^{7}} + \left(-0.16666666666666666 \cdot \frac{-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + \left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + {\left(-1.5 \cdot \left(a \cdot c\right)\right)}^{2}\right)}{a \cdot {b}^{3}} + -0.16666666666666666 \cdot \frac{-3 \cdot \left(a \cdot \left(c \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 9 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)\right)\right) + 1.5 \cdot \left(a \cdot \left(c \cdot \left(-9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + \left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + {\left(-1.5 \cdot \left(a \cdot c\right)\right)}^{2}\right)\right)\right)\right)}{a \cdot {b}^{5}}\right)\right)} \]
    8. Simplified86.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5, \frac{c}{b}, -0.16666666666666666 \cdot \left(\left(\frac{{\left(a \cdot \left(c \cdot -1.5\right)\right)}^{2} + 0}{a \cdot {b}^{3}} + \frac{\mathsf{fma}\left(1.5, \left(a \cdot c\right) \cdot \left({\left(a \cdot \left(c \cdot -1.5\right)\right)}^{2} + 0\right), a \cdot \left(c \cdot 0\right)\right)}{a \cdot {b}^{5}}\right) + \frac{\mathsf{fma}\left(1.5 \cdot a, c \cdot \mathsf{fma}\left(1.5, \left(a \cdot c\right) \cdot \left({\left(a \cdot \left(c \cdot -1.5\right)\right)}^{2} + 0\right), a \cdot \left(c \cdot 0\right)\right), {\left(0 + -0.5 \cdot {\left(a \cdot \left(c \cdot -1.5\right)\right)}^{2}\right)}^{2} + 0\right) + 0}{a \cdot {b}^{7}}\right)\right)} \]

    if 2.1e10 < b

    1. Initial program 75.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv29.8%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative29.8%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/29.9%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity29.9%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative29.9%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac30.0%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval30.0%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified30.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u29.9%

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

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

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(\color{blue}{\frac{a \cdot c}{b}}\right)} - 1}{a} \]
    13. Applied egg-rr86.8%

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

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

Alternative 2: 79.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 21000000000:\\ \;\;\;\;-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 21000000000.0)
   (+
    (* -0.5625 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 5.0)))
    (+
     (* -0.5 (/ c b))
     (+
      (* -0.375 (/ (* a (pow c 2.0)) (pow b 3.0)))
      (*
       -0.16666666666666666
       (/
        (+
         (* 5.0625 (* (pow a 4.0) (pow c 4.0)))
         (pow (* -1.125 (* (pow a 2.0) (pow c 2.0))) 2.0))
        (* a (pow b 7.0)))))))
   (* -0.5 (/ (+ (exp (log1p (/ (* c a) b))) -1.0) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 21000000000.0) {
		tmp = (-0.5625 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * pow(c, 2.0)) / pow(b, 3.0))) + (-0.16666666666666666 * (((5.0625 * (pow(a, 4.0) * pow(c, 4.0))) + pow((-1.125 * (pow(a, 2.0) * pow(c, 2.0))), 2.0)) / (a * pow(b, 7.0))))));
	} else {
		tmp = -0.5 * ((exp(log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 21000000000.0) {
		tmp = (-0.5625 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0))) + (-0.16666666666666666 * (((5.0625 * (Math.pow(a, 4.0) * Math.pow(c, 4.0))) + Math.pow((-1.125 * (Math.pow(a, 2.0) * Math.pow(c, 2.0))), 2.0)) / (a * Math.pow(b, 7.0))))));
	} else {
		tmp = -0.5 * ((Math.exp(Math.log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 21000000000.0:
		tmp = (-0.5625 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 3.0))) + (-0.16666666666666666 * (((5.0625 * (math.pow(a, 4.0) * math.pow(c, 4.0))) + math.pow((-1.125 * (math.pow(a, 2.0) * math.pow(c, 2.0))), 2.0)) / (a * math.pow(b, 7.0))))))
	else:
		tmp = -0.5 * ((math.exp(math.log1p(((c * a) / b))) + -1.0) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 21000000000.0)
		tmp = Float64(Float64(-0.5625 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + Float64(Float64(-0.5 * Float64(c / b)) + Float64(Float64(-0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0))) + Float64(-0.16666666666666666 * Float64(Float64(Float64(5.0625 * Float64((a ^ 4.0) * (c ^ 4.0))) + (Float64(-1.125 * Float64((a ^ 2.0) * (c ^ 2.0))) ^ 2.0)) / Float64(a * (b ^ 7.0)))))));
	else
		tmp = Float64(-0.5 * Float64(Float64(exp(log1p(Float64(Float64(c * a) / b))) + -1.0) / a));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 21000000000.0], N[(N[(-0.5625 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[(N[(5.0625 * N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(-1.125 * N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[Exp[N[Log[1 + N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 21000000000:\\
\;\;\;\;-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\


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

    1. Initial program 42.5%

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

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

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

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

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

    if 2.1e10 < b

    1. Initial program 75.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv29.8%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative29.8%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/29.9%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity29.9%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative29.9%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac30.0%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval30.0%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified30.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u29.9%

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

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

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(\color{blue}{\frac{a \cdot c}{b}}\right)} - 1}{a} \]
    13. Applied egg-rr86.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 21000000000:\\ \;\;\;\;-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 21000000000:\\ \;\;\;\;-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 21000000000.0)
   (+
    (* -0.5625 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 5.0)))
    (+ (* -0.5 (/ c b)) (* -0.375 (/ (* a (pow c 2.0)) (pow b 3.0)))))
   (* -0.5 (/ (+ (exp (log1p (/ (* c a) b))) -1.0) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 21000000000.0) {
		tmp = (-0.5625 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((a * pow(c, 2.0)) / pow(b, 3.0))));
	} else {
		tmp = -0.5 * ((exp(log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 21000000000.0) {
		tmp = (-0.5625 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0))));
	} else {
		tmp = -0.5 * ((Math.exp(Math.log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 21000000000.0:
		tmp = (-0.5625 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 3.0))))
	else:
		tmp = -0.5 * ((math.exp(math.log1p(((c * a) / b))) + -1.0) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 21000000000.0)
		tmp = Float64(Float64(-0.5625 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + Float64(Float64(-0.5 * Float64(c / b)) + Float64(-0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0)))));
	else
		tmp = Float64(-0.5 * Float64(Float64(exp(log1p(Float64(Float64(c * a) / b))) + -1.0) / a));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 21000000000.0], N[(N[(-0.5625 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[Exp[N[Log[1 + N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 21000000000:\\
\;\;\;\;-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\


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

    1. Initial program 42.5%

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

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

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

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

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

    if 2.1e10 < b

    1. Initial program 75.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv29.8%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative29.8%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/29.9%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity29.9%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative29.9%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac30.0%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval30.0%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified30.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u29.9%

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

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

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(\color{blue}{\frac{a \cdot c}{b}}\right)} - 1}{a} \]
    13. Applied egg-rr86.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 21000000000:\\ \;\;\;\;-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 69.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-0.5 \cdot c}{b}\\ \mathbf{if}\;b \leq 7000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 22000000:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 6500000000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{\log \left(1 + \mathsf{expm1}\left(\frac{c \cdot a}{b}\right)\right)}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (* -0.5 c) b)))
   (if (<= b 7000000.0)
     t_0
     (if (<= b 22000000.0)
       (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
       (if (<= b 6500000000.0)
         t_0
         (* -0.5 (/ (log (+ 1.0 (expm1 (/ (* c a) b)))) a)))))))
double code(double a, double b, double c) {
	double t_0 = (-0.5 * c) / b;
	double tmp;
	if (b <= 7000000.0) {
		tmp = t_0;
	} else if (b <= 22000000.0) {
		tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
	} else if (b <= 6500000000.0) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (log((1.0 + expm1(((c * a) / b)))) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double t_0 = (-0.5 * c) / b;
	double tmp;
	if (b <= 7000000.0) {
		tmp = t_0;
	} else if (b <= 22000000.0) {
		tmp = (Math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
	} else if (b <= 6500000000.0) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (Math.log((1.0 + Math.expm1(((c * a) / b)))) / a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (-0.5 * c) / b
	tmp = 0
	if b <= 7000000.0:
		tmp = t_0
	elif b <= 22000000.0:
		tmp = (math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0)
	elif b <= 6500000000.0:
		tmp = t_0
	else:
		tmp = -0.5 * (math.log((1.0 + math.expm1(((c * a) / b)))) / a)
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(-0.5 * c) / b)
	tmp = 0.0
	if (b <= 7000000.0)
		tmp = t_0;
	elseif (b <= 22000000.0)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0));
	elseif (b <= 6500000000.0)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(log(Float64(1.0 + expm1(Float64(Float64(c * a) / b)))) / a));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[b, 7000000.0], t$95$0, If[LessEqual[b, 22000000.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6500000000.0], t$95$0, N[(-0.5 * N[(N[Log[N[(1.0 + N[(Exp[N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-0.5 \cdot c}{b}\\
\mathbf{if}\;b \leq 7000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 22000000:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\

\mathbf{elif}\;b \leq 6500000000:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\log \left(1 + \mathsf{expm1}\left(\frac{c \cdot a}{b}\right)\right)}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 7e6 or 2.2e7 < b < 6.5e9

    1. Initial program 39.4%

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

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

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

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

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

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

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

    if 7e6 < b < 2.2e7

    1. Initial program 96.2%

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

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

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

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

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

    if 6.5e9 < b

    1. Initial program 75.2%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    7. Simplified30.0%

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv30.0%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative30.0%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr30.0%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/30.1%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity30.1%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative30.1%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac30.2%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval30.2%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified30.2%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
    12. Step-by-step derivation
      1. log1p-expm1-u24.4%

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(a \cdot \frac{c}{b}\right)\right)}}{a} \]
      3. associate-*r/80.9%

        \[\leadsto -0.5 \cdot \frac{\log \left(1 + \mathsf{expm1}\left(\color{blue}{\frac{a \cdot c}{b}}\right)\right)}{a} \]
    13. Applied egg-rr80.9%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{a \cdot c}{b}\right)\right)}}{a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 7000000:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{elif}\;b \leq 22000000:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 6500000000:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{\log \left(1 + \mathsf{expm1}\left(\frac{c \cdot a}{b}\right)\right)}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-0.5 \cdot c}{b}\\ \mathbf{if}\;b \leq 7000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 22000000:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 3800000000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (* -0.5 c) b)))
   (if (<= b 7000000.0)
     t_0
     (if (<= b 22000000.0)
       (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
       (if (<= b 3800000000.0)
         t_0
         (* -0.5 (/ (+ (exp (log1p (/ (* c a) b))) -1.0) a)))))))
double code(double a, double b, double c) {
	double t_0 = (-0.5 * c) / b;
	double tmp;
	if (b <= 7000000.0) {
		tmp = t_0;
	} else if (b <= 22000000.0) {
		tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
	} else if (b <= 3800000000.0) {
		tmp = t_0;
	} else {
		tmp = -0.5 * ((exp(log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double t_0 = (-0.5 * c) / b;
	double tmp;
	if (b <= 7000000.0) {
		tmp = t_0;
	} else if (b <= 22000000.0) {
		tmp = (Math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
	} else if (b <= 3800000000.0) {
		tmp = t_0;
	} else {
		tmp = -0.5 * ((Math.exp(Math.log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (-0.5 * c) / b
	tmp = 0
	if b <= 7000000.0:
		tmp = t_0
	elif b <= 22000000.0:
		tmp = (math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0)
	elif b <= 3800000000.0:
		tmp = t_0
	else:
		tmp = -0.5 * ((math.exp(math.log1p(((c * a) / b))) + -1.0) / a)
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(-0.5 * c) / b)
	tmp = 0.0
	if (b <= 7000000.0)
		tmp = t_0;
	elseif (b <= 22000000.0)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0));
	elseif (b <= 3800000000.0)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(Float64(exp(log1p(Float64(Float64(c * a) / b))) + -1.0) / a));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[b, 7000000.0], t$95$0, If[LessEqual[b, 22000000.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3800000000.0], t$95$0, N[(-0.5 * N[(N[(N[Exp[N[Log[1 + N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-0.5 \cdot c}{b}\\
\mathbf{if}\;b \leq 7000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 22000000:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\

\mathbf{elif}\;b \leq 3800000000:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 7e6 or 2.2e7 < b < 3.8e9

    1. Initial program 39.4%

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

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

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

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

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

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

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

    if 7e6 < b < 2.2e7

    1. Initial program 96.2%

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

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

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

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

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

    if 3.8e9 < b

    1. Initial program 75.2%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    7. Simplified30.0%

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv30.0%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative30.0%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr30.0%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/30.1%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity30.1%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative30.1%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac30.2%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval30.2%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified30.2%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u30.1%

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

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

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(\color{blue}{\frac{a \cdot c}{b}}\right)} - 1}{a} \]
    13. Applied egg-rr86.6%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{e^{\mathsf{log1p}\left(\frac{a \cdot c}{b}\right)} - 1}}{a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 7000000:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{elif}\;b \leq 22000000:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 3800000000:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 77.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 21000000000:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 21000000000.0)
   (+ (* -0.5 (/ c b)) (* -0.375 (/ (* a (pow c 2.0)) (pow b 3.0))))
   (* -0.5 (/ (+ (exp (log1p (/ (* c a) b))) -1.0) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 21000000000.0) {
		tmp = (-0.5 * (c / b)) + (-0.375 * ((a * pow(c, 2.0)) / pow(b, 3.0)));
	} else {
		tmp = -0.5 * ((exp(log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 21000000000.0) {
		tmp = (-0.5 * (c / b)) + (-0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0)));
	} else {
		tmp = -0.5 * ((Math.exp(Math.log1p(((c * a) / b))) + -1.0) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 21000000000.0:
		tmp = (-0.5 * (c / b)) + (-0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 3.0)))
	else:
		tmp = -0.5 * ((math.exp(math.log1p(((c * a) / b))) + -1.0) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 21000000000.0)
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(-0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0))));
	else
		tmp = Float64(-0.5 * Float64(Float64(exp(log1p(Float64(Float64(c * a) / b))) + -1.0) / a));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 21000000000.0], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[Exp[N[Log[1 + N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 21000000000:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{e^{\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)} + -1}{a}\\


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

    1. Initial program 42.5%

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

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

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

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

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

    if 2.1e10 < b

    1. Initial program 75.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv29.8%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative29.8%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/29.9%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity29.9%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative29.9%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac30.0%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval30.0%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified30.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u29.9%

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

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

        \[\leadsto -0.5 \cdot \frac{e^{\mathsf{log1p}\left(\color{blue}{\frac{a \cdot c}{b}}\right)} - 1}{a} \]
    13. Applied egg-rr86.8%

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

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

Alternative 7: 67.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{-0.5 \cdot c}{b}\\
t_1 := \frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq 7600000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 22000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 350000000000:\\
\;\;\;\;-0.5 \cdot \frac{\frac{c}{b} \cdot a}{a}\\

\mathbf{elif}\;b \leq 7800000000000:\\
\;\;\;\;\frac{\left(b + -1.5 \cdot \frac{c \cdot a}{b}\right) - b}{a \cdot 3}\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < 7.6e6 or 7.8e12 < b < 1.8e15

    1. Initial program 40.9%

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

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

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

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

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

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

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

    if 7.6e6 < b < 2.2e7 or 1.8e15 < b

    1. Initial program 80.7%

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

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

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

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

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

    if 2.2e7 < b < 3.5e11

    1. Initial program 37.7%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1.5 \cdot \left(a \cdot c\right)}{b}}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. div-inv72.8%

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

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

        \[\leadsto \left(-1.5 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      4. *-commutative72.7%

        \[\leadsto \left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot 3}} \]
    9. Applied egg-rr72.7%

      \[\leadsto \color{blue}{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Step-by-step derivation
      1. associate-*r/72.8%

        \[\leadsto \color{blue}{\frac{\left(-1.5 \cdot \left(a \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot 3}} \]
      2. *-rgt-identity72.8%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}}{a \cdot 3} \]
      3. *-commutative72.8%

        \[\leadsto \frac{-1.5 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{3 \cdot a}} \]
      4. times-frac72.9%

        \[\leadsto \color{blue}{\frac{-1.5}{3} \cdot \frac{a \cdot \frac{c}{b}}{a}} \]
      5. metadata-eval72.9%

        \[\leadsto \color{blue}{-0.5} \cdot \frac{a \cdot \frac{c}{b}}{a} \]
    11. Simplified72.9%

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

    if 3.5e11 < b < 7.8e12

    1. Initial program 84.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 7600000:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{elif}\;b \leq 22000000:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 350000000000:\\ \;\;\;\;-0.5 \cdot \frac{\frac{c}{b} \cdot a}{a}\\ \mathbf{elif}\;b \leq 7800000000000:\\ \;\;\;\;\frac{\left(b + -1.5 \cdot \frac{c \cdot a}{b}\right) - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.2% accurate, 3.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 340000000000 \lor \neg \left(b \leq 7800000000000\right) \land b \leq 1.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + -1.5 \cdot \frac{c \cdot a}{b}\right) - b}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (or (<= b 340000000000.0)
         (and (not (<= b 7800000000000.0)) (<= b 1.8e+15)))
   (/ (* -0.5 c) b)
   (/ (- (+ b (* -1.5 (/ (* c a) b))) b) (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if ((b <= 340000000000.0) || (!(b <= 7800000000000.0) && (b <= 1.8e+15))) {
		tmp = (-0.5 * c) / b;
	} else {
		tmp = ((b + (-1.5 * ((c * a) / b))) - b) / (a * 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 ((b <= 340000000000.0d0) .or. (.not. (b <= 7800000000000.0d0)) .and. (b <= 1.8d+15)) then
        tmp = ((-0.5d0) * c) / b
    else
        tmp = ((b + ((-1.5d0) * ((c * a) / b))) - b) / (a * 3.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if ((b <= 340000000000.0) || (!(b <= 7800000000000.0) && (b <= 1.8e+15))) {
		tmp = (-0.5 * c) / b;
	} else {
		tmp = ((b + (-1.5 * ((c * a) / b))) - b) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if (b <= 340000000000.0) or (not (b <= 7800000000000.0) and (b <= 1.8e+15)):
		tmp = (-0.5 * c) / b
	else:
		tmp = ((b + (-1.5 * ((c * a) / b))) - b) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if ((b <= 340000000000.0) || (!(b <= 7800000000000.0) && (b <= 1.8e+15)))
		tmp = Float64(Float64(-0.5 * c) / b);
	else
		tmp = Float64(Float64(Float64(b + Float64(-1.5 * Float64(Float64(c * a) / b))) - b) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if ((b <= 340000000000.0) || (~((b <= 7800000000000.0)) && (b <= 1.8e+15)))
		tmp = (-0.5 * c) / b;
	else
		tmp = ((b + (-1.5 * ((c * a) / b))) - b) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[Or[LessEqual[b, 340000000000.0], And[N[Not[LessEqual[b, 7800000000000.0]], $MachinePrecision], LessEqual[b, 1.8e+15]]], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[(b + N[(-1.5 * N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 340000000000 \lor \neg \left(b \leq 7800000000000\right) \land b \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.4e11 or 7.8e12 < b < 1.8e15

    1. Initial program 42.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Simplified70.2%

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

    if 3.4e11 < b < 7.8e12 or 1.8e15 < b

    1. Initial program 80.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 340000000000 \lor \neg \left(b \leq 7800000000000\right) \land b \leq 1.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + -1.5 \cdot \frac{c \cdot a}{b}\right) - b}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 63.9% accurate, 5.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 390000000000 \lor \neg \left(b \leq 7800000000000\right) \land b \leq 1.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (or (<= b 390000000000.0)
         (and (not (<= b 7800000000000.0)) (<= b 1.8e+15)))
   (/ (* -0.5 c) b)
   (/ (- b b) (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if ((b <= 390000000000.0) || (!(b <= 7800000000000.0) && (b <= 1.8e+15))) {
		tmp = (-0.5 * c) / b;
	} else {
		tmp = (b - b) / (a * 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 ((b <= 390000000000.0d0) .or. (.not. (b <= 7800000000000.0d0)) .and. (b <= 1.8d+15)) then
        tmp = ((-0.5d0) * c) / b
    else
        tmp = (b - b) / (a * 3.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if ((b <= 390000000000.0) || (!(b <= 7800000000000.0) && (b <= 1.8e+15))) {
		tmp = (-0.5 * c) / b;
	} else {
		tmp = (b - b) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if (b <= 390000000000.0) or (not (b <= 7800000000000.0) and (b <= 1.8e+15)):
		tmp = (-0.5 * c) / b
	else:
		tmp = (b - b) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if ((b <= 390000000000.0) || (!(b <= 7800000000000.0) && (b <= 1.8e+15)))
		tmp = Float64(Float64(-0.5 * c) / b);
	else
		tmp = Float64(Float64(b - b) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if ((b <= 390000000000.0) || (~((b <= 7800000000000.0)) && (b <= 1.8e+15)))
		tmp = (-0.5 * c) / b;
	else
		tmp = (b - b) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[Or[LessEqual[b, 390000000000.0], And[N[Not[LessEqual[b, 7800000000000.0]], $MachinePrecision], LessEqual[b, 1.8e+15]]], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision], N[(N[(b - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 390000000000 \lor \neg \left(b \leq 7800000000000\right) \land b \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.9e11 or 7.8e12 < b < 1.8e15

    1. Initial program 42.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Simplified70.2%

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

    if 3.9e11 < b < 7.8e12 or 1.8e15 < b

    1. Initial program 80.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 390000000000 \lor \neg \left(b \leq 7800000000000\right) \land b \leq 1.8 \cdot 10^{+15}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 44.3% accurate, 23.2× speedup?

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
  7. Simplified45.7%

    \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
  8. Final simplification45.7%

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

Reproduce

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