Cubic critical, wide range

Percentage Accurate: 33.3% → 81.6%
Time: 19.5s
Alternatives: 11
Speedup: 23.2×

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 11 alternatives:

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

Initial Program: 33.3% 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: 81.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 8.6 \cdot 10^{+25} \lor \neg \left(b \leq 2.95 \cdot 10^{+27}\right) \land b \leq 9.4 \cdot 10^{+27}:\\ \;\;\;\;-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(a \cdot c\right)}^{4} \cdot 1.265625}{a \cdot {b}^{7}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (or (<= b 8.6e+25) (and (not (<= b 2.95e+27)) (<= b 9.4e+27)))
   (+
    (* -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 (* a c) 4.0) 1.265625))
        (* a (pow b 7.0)))))))
   (/ (log (exp (* a (* (/ c b) -1.5)))) (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if ((b <= 8.6e+25) || (!(b <= 2.95e+27) && (b <= 9.4e+27))) {
		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((a * c), 4.0) * 1.265625)) / (a * pow(b, 7.0))))));
	} else {
		tmp = log(exp((a * ((c / b) * -1.5)))) / (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 <= 8.6d+25) .or. (.not. (b <= 2.95d+27)) .and. (b <= 9.4d+27)) then
        tmp = ((-0.5625d0) * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 5.0d0))) + (((-0.5d0) * (c / b)) + (((-0.375d0) * ((a * (c ** 2.0d0)) / (b ** 3.0d0))) + ((-0.16666666666666666d0) * (((5.0625d0 * ((a ** 4.0d0) * (c ** 4.0d0))) + (((a * c) ** 4.0d0) * 1.265625d0)) / (a * (b ** 7.0d0))))))
    else
        tmp = log(exp((a * ((c / b) * (-1.5d0))))) / (a * 3.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if ((b <= 8.6e+25) || (!(b <= 2.95e+27) && (b <= 9.4e+27))) {
		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((a * c), 4.0) * 1.265625)) / (a * Math.pow(b, 7.0))))));
	} else {
		tmp = Math.log(Math.exp((a * ((c / b) * -1.5)))) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if (b <= 8.6e+25) or (not (b <= 2.95e+27) and (b <= 9.4e+27)):
		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((a * c), 4.0) * 1.265625)) / (a * math.pow(b, 7.0))))))
	else:
		tmp = math.log(math.exp((a * ((c / b) * -1.5)))) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if ((b <= 8.6e+25) || (!(b <= 2.95e+27) && (b <= 9.4e+27)))
		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((Float64(a * c) ^ 4.0) * 1.265625)) / Float64(a * (b ^ 7.0)))))));
	else
		tmp = Float64(log(exp(Float64(a * Float64(Float64(c / b) * -1.5)))) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if ((b <= 8.6e+25) || (~((b <= 2.95e+27)) && (b <= 9.4e+27)))
		tmp = (-0.5625 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * (c ^ 2.0)) / (b ^ 3.0))) + (-0.16666666666666666 * (((5.0625 * ((a ^ 4.0) * (c ^ 4.0))) + (((a * c) ^ 4.0) * 1.265625)) / (a * (b ^ 7.0))))));
	else
		tmp = log(exp((a * ((c / b) * -1.5)))) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[Or[LessEqual[b, 8.6e+25], And[N[Not[LessEqual[b, 2.95e+27]], $MachinePrecision], LessEqual[b, 9.4e+27]]], 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[(N[Power[N[(a * c), $MachinePrecision], 4.0], $MachinePrecision] * 1.265625), $MachinePrecision]), $MachinePrecision] / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[Exp[N[(a * N[(N[(c / b), $MachinePrecision] * -1.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.6 \cdot 10^{+25} \lor \neg \left(b \leq 2.95 \cdot 10^{+27}\right) \land b \leq 9.4 \cdot 10^{+27}:\\
\;\;\;\;-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(a \cdot c\right)}^{4} \cdot 1.265625}{a \cdot {b}^{7}}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 8.59999999999999996e25 or 2.95000000000000022e27 < b < 9.39999999999999952e27

    1. Initial program 29.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 88.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)} \]
    4. Step-by-step derivation
      1. *-commutative88.2%

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

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

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

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

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

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

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

    if 8.59999999999999996e25 < b < 2.95000000000000022e27 or 9.39999999999999952e27 < b

    1. Initial program 65.7%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified38.6%

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

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

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

        \[\leadsto \frac{\log \left(1 + \mathsf{expm1}\left(\color{blue}{\frac{-1.5 \cdot a}{\frac{b}{c}}}\right)\right)}{3 \cdot a} \]
    7. Applied egg-rr79.1%

      \[\leadsto \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. add-exp-log79.1%

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

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\frac{-1.5 \cdot a}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      4. div-inv79.1%

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(-1.5 \cdot a\right) \cdot \frac{1}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      5. clear-num79.1%

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(a \cdot -1.5\right)} \cdot \frac{c}{b}}\right)}{3 \cdot a} \]
      7. associate-*l*79.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 8.6 \cdot 10^{+25} \lor \neg \left(b \leq 2.95 \cdot 10^{+27}\right) \land b \leq 9.4 \cdot 10^{+27}:\\ \;\;\;\;-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(a \cdot c\right)}^{4} \cdot 1.265625}{a \cdot {b}^{7}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{+25} \lor \neg \left(b \leq 2.95 \cdot 10^{+27}\right) \land b \leq 1.7 \cdot 10^{+28}:\\ \;\;\;\;-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}:\\ \;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (or (<= b 6.5e+25) (and (not (<= b 2.95e+27)) (<= b 1.7e+28)))
   (+
    (* -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)))))
   (/ (log (exp (* a (* (/ c b) -1.5)))) (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if ((b <= 6.5e+25) || (!(b <= 2.95e+27) && (b <= 1.7e+28))) {
		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 = log(exp((a * ((c / b) * -1.5)))) / (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 <= 6.5d+25) .or. (.not. (b <= 2.95d+27)) .and. (b <= 1.7d+28)) then
        tmp = ((-0.5625d0) * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 5.0d0))) + (((-0.5d0) * (c / b)) + ((-0.375d0) * ((a * (c ** 2.0d0)) / (b ** 3.0d0))))
    else
        tmp = log(exp((a * ((c / b) * (-1.5d0))))) / (a * 3.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if ((b <= 6.5e+25) || (!(b <= 2.95e+27) && (b <= 1.7e+28))) {
		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 = Math.log(Math.exp((a * ((c / b) * -1.5)))) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if (b <= 6.5e+25) or (not (b <= 2.95e+27) and (b <= 1.7e+28)):
		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 = math.log(math.exp((a * ((c / b) * -1.5)))) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if ((b <= 6.5e+25) || (!(b <= 2.95e+27) && (b <= 1.7e+28)))
		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(log(exp(Float64(a * Float64(Float64(c / b) * -1.5)))) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if ((b <= 6.5e+25) || (~((b <= 2.95e+27)) && (b <= 1.7e+28)))
		tmp = (-0.5625 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 5.0))) + ((-0.5 * (c / b)) + (-0.375 * ((a * (c ^ 2.0)) / (b ^ 3.0))));
	else
		tmp = log(exp((a * ((c / b) * -1.5)))) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[Or[LessEqual[b, 6.5e+25], And[N[Not[LessEqual[b, 2.95e+27]], $MachinePrecision], LessEqual[b, 1.7e+28]]], 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[(N[Log[N[Exp[N[(a * N[(N[(c / b), $MachinePrecision] * -1.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.5 \cdot 10^{+25} \lor \neg \left(b \leq 2.95 \cdot 10^{+27}\right) \land b \leq 1.7 \cdot 10^{+28}:\\
\;\;\;\;-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}:\\
\;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 6.50000000000000005e25 or 2.95000000000000022e27 < b < 1.7e28

    1. Initial program 29.1%

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

      \[\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 6.50000000000000005e25 < b < 2.95000000000000022e27 or 1.7e28 < b

    1. Initial program 65.7%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified38.6%

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

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

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

        \[\leadsto \frac{\log \left(1 + \mathsf{expm1}\left(\color{blue}{\frac{-1.5 \cdot a}{\frac{b}{c}}}\right)\right)}{3 \cdot a} \]
    7. Applied egg-rr79.1%

      \[\leadsto \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. add-exp-log79.1%

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

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\frac{-1.5 \cdot a}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      4. div-inv79.1%

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(-1.5 \cdot a\right) \cdot \frac{1}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      5. clear-num79.1%

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(a \cdot -1.5\right)} \cdot \frac{c}{b}}\right)}{3 \cdot a} \]
      7. associate-*l*79.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{+25} \lor \neg \left(b \leq 2.95 \cdot 10^{+27}\right) \land b \leq 1.7 \cdot 10^{+28}:\\ \;\;\;\;-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}:\\ \;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.4% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 66.2%

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

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

    1. Initial program 25.3%

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

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

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

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

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

Alternative 4: 73.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c \cdot -0.5}{b}\\ \mathbf{if}\;b \leq 9.5 \cdot 10^{+22}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{+23}:\\ \;\;\;\;\log \left(1 + \mathsf{expm1}\left(c \cdot \frac{-0.5}{b}\right)\right)\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (* c -0.5) b)))
   (if (<= b 9.5e+22)
     t_0
     (if (<= b 5.6e+23)
       (log (+ 1.0 (expm1 (* c (/ -0.5 b)))))
       (if (<= b 8.5e+25)
         t_0
         (/ (log (exp (* a (* (/ c b) -1.5)))) (* a 3.0)))))))
double code(double a, double b, double c) {
	double t_0 = (c * -0.5) / b;
	double tmp;
	if (b <= 9.5e+22) {
		tmp = t_0;
	} else if (b <= 5.6e+23) {
		tmp = log((1.0 + expm1((c * (-0.5 / b)))));
	} else if (b <= 8.5e+25) {
		tmp = t_0;
	} else {
		tmp = log(exp((a * ((c / b) * -1.5)))) / (a * 3.0);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double t_0 = (c * -0.5) / b;
	double tmp;
	if (b <= 9.5e+22) {
		tmp = t_0;
	} else if (b <= 5.6e+23) {
		tmp = Math.log((1.0 + Math.expm1((c * (-0.5 / b)))));
	} else if (b <= 8.5e+25) {
		tmp = t_0;
	} else {
		tmp = Math.log(Math.exp((a * ((c / b) * -1.5)))) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (c * -0.5) / b
	tmp = 0
	if b <= 9.5e+22:
		tmp = t_0
	elif b <= 5.6e+23:
		tmp = math.log((1.0 + math.expm1((c * (-0.5 / b)))))
	elif b <= 8.5e+25:
		tmp = t_0
	else:
		tmp = math.log(math.exp((a * ((c / b) * -1.5)))) / (a * 3.0)
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(c * -0.5) / b)
	tmp = 0.0
	if (b <= 9.5e+22)
		tmp = t_0;
	elseif (b <= 5.6e+23)
		tmp = log(Float64(1.0 + expm1(Float64(c * Float64(-0.5 / b)))));
	elseif (b <= 8.5e+25)
		tmp = t_0;
	else
		tmp = Float64(log(exp(Float64(a * Float64(Float64(c / b) * -1.5)))) / Float64(a * 3.0));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[b, 9.5e+22], t$95$0, If[LessEqual[b, 5.6e+23], N[Log[N[(1.0 + N[(Exp[N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[b, 8.5e+25], t$95$0, N[(N[Log[N[Exp[N[(a * N[(N[(c / b), $MachinePrecision] * -1.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c \cdot -0.5}{b}\\
\mathbf{if}\;b \leq 9.5 \cdot 10^{+22}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 5.6 \cdot 10^{+23}:\\
\;\;\;\;\log \left(1 + \mathsf{expm1}\left(c \cdot \frac{-0.5}{b}\right)\right)\\

\mathbf{elif}\;b \leq 8.5 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 9.49999999999999937e22 or 5.6e23 < b < 8.5000000000000007e25

    1. Initial program 27.2%

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

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

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

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

    if 9.49999999999999937e22 < b < 5.6e23

    1. Initial program 72.0%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
      2. associate-/l*33.8%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    5. Simplified33.8%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    6. Step-by-step derivation
      1. log1p-expm1-u33.8%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-0.5}{\frac{b}{c}}\right)\right)} \]
      2. log1p-udef84.7%

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

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

      \[\leadsto \color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{-0.5}{b} \cdot c\right)\right)} \]

    if 8.5000000000000007e25 < b

    1. Initial program 62.1%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified42.8%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. add-exp-log69.9%

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}\right)}{3 \cdot a} \]
      3. log1p-expm1-u69.9%

        \[\leadsto \frac{\log \left(e^{\color{blue}{\frac{-1.5 \cdot a}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      4. div-inv69.9%

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(-1.5 \cdot a\right) \cdot \frac{1}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      5. clear-num69.9%

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(a \cdot -1.5\right)} \cdot \frac{c}{b}}\right)}{3 \cdot a} \]
      7. associate-*l*69.9%

        \[\leadsto \frac{\log \left(e^{\color{blue}{a \cdot \left(-1.5 \cdot \frac{c}{b}\right)}}\right)}{3 \cdot a} \]
    9. Applied egg-rr69.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 9.5 \cdot 10^{+22}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{+23}:\\ \;\;\;\;\log \left(1 + \mathsf{expm1}\left(c \cdot \frac{-0.5}{b}\right)\right)\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{+25}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(e^{a \cdot \left(\frac{c}{b} \cdot -1.5\right)}\right)}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 28.9%

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

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

    if 6.99999999999999999e25 < b

    1. Initial program 62.1%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified42.8%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}{3 \cdot a} \]
    8. Step-by-step derivation
      1. add-exp-log69.9%

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}\right)}{3 \cdot a} \]
      3. log1p-expm1-u69.9%

        \[\leadsto \frac{\log \left(e^{\color{blue}{\frac{-1.5 \cdot a}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      4. div-inv69.9%

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(-1.5 \cdot a\right) \cdot \frac{1}{\frac{b}{c}}}}\right)}{3 \cdot a} \]
      5. clear-num69.9%

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{\left(a \cdot -1.5\right)} \cdot \frac{c}{b}}\right)}{3 \cdot a} \]
      7. associate-*l*69.9%

        \[\leadsto \frac{\log \left(e^{\color{blue}{a \cdot \left(-1.5 \cdot \frac{c}{b}\right)}}\right)}{3 \cdot a} \]
    9. Applied egg-rr69.9%

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

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

Alternative 6: 73.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{+25}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

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


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

    1. Initial program 28.9%

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

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

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

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

    if 8.00000000000000072e25 < b

    1. Initial program 62.1%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified42.8%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\log \left(1 + \mathsf{expm1}\left(\frac{-1.5 \cdot a}{\frac{b}{c}}\right)\right)}}{3 \cdot a} \]
    8. Taylor expanded in a around 0 64.0%

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

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

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

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

        \[\leadsto \frac{\log \left(\color{blue}{\left(a \cdot -1.5\right)} \cdot \frac{c}{b} + 1\right)}{3 \cdot a} \]
      5. associate-*r*64.0%

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

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

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

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

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

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

Alternative 7: 72.8% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 8.2 \cdot 10^{+25}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + \left(\frac{a \cdot -1.5}{\frac{b}{c}} - b\right)}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 8.2e+25)
   (/ (* c -0.5) b)
   (/ (+ b (- (/ (* a -1.5) (/ b c)) b)) (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 8.2e+25) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (b + (((a * -1.5) / (b / c)) - 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 <= 8.2d+25) then
        tmp = (c * (-0.5d0)) / b
    else
        tmp = (b + (((a * (-1.5d0)) / (b / c)) - b)) / (a * 3.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 8.2e+25) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (b + (((a * -1.5) / (b / c)) - b)) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 8.2e+25:
		tmp = (c * -0.5) / b
	else:
		tmp = (b + (((a * -1.5) / (b / c)) - b)) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 8.2e+25)
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(Float64(b + Float64(Float64(Float64(a * -1.5) / Float64(b / c)) - b)) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 8.2e+25)
		tmp = (c * -0.5) / b;
	else
		tmp = (b + (((a * -1.5) / (b / c)) - b)) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 8.2e+25], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(b + N[(N[(N[(a * -1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2 \cdot 10^{+25}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

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


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

    1. Initial program 28.9%

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

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

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

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

    if 8.19999999999999933e25 < b

    1. Initial program 62.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. +-commutative62.1%

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

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

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

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

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

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

      \[\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 59.4%

      \[\leadsto \frac{\color{blue}{\left(b + -1.5 \cdot \frac{a \cdot c}{b}\right)} - b}{3 \cdot a} \]
    6. Step-by-step derivation
      1. associate--l+59.4%

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

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

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

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

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

Alternative 8: 72.8% accurate, 6.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 8.6 \cdot 10^{+25}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{elif}\;b \leq 4.7 \cdot 10^{+29}:\\ \;\;\;\;\frac{b - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{\frac{b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 8.6e+25)
   (/ (* c -0.5) b)
   (if (<= b 4.7e+29) (/ (- b b) (* a 3.0)) (/ -0.5 (/ b c)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 8.6e+25) {
		tmp = (c * -0.5) / b;
	} else if (b <= 4.7e+29) {
		tmp = (b - b) / (a * 3.0);
	} else {
		tmp = -0.5 / (b / c);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= 8.6d+25) then
        tmp = (c * (-0.5d0)) / b
    else if (b <= 4.7d+29) then
        tmp = (b - b) / (a * 3.0d0)
    else
        tmp = (-0.5d0) / (b / c)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 8.6e+25) {
		tmp = (c * -0.5) / b;
	} else if (b <= 4.7e+29) {
		tmp = (b - b) / (a * 3.0);
	} else {
		tmp = -0.5 / (b / c);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 8.6e+25:
		tmp = (c * -0.5) / b
	elif b <= 4.7e+29:
		tmp = (b - b) / (a * 3.0)
	else:
		tmp = -0.5 / (b / c)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 8.6e+25)
		tmp = Float64(Float64(c * -0.5) / b);
	elseif (b <= 4.7e+29)
		tmp = Float64(Float64(b - b) / Float64(a * 3.0));
	else
		tmp = Float64(-0.5 / Float64(b / c));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 8.6e+25)
		tmp = (c * -0.5) / b;
	elseif (b <= 4.7e+29)
		tmp = (b - b) / (a * 3.0);
	else
		tmp = -0.5 / (b / c);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 8.6e+25], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[b, 4.7e+29], N[(N[(b - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{elif}\;b \leq 4.7 \cdot 10^{+29}:\\
\;\;\;\;\frac{b - b}{a \cdot 3}\\

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


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

    1. Initial program 28.9%

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

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

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

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

    if 8.59999999999999996e25 < b < 4.7000000000000002e29

    1. Initial program 71.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. +-commutative71.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c} - 0\right) - b}{3 \cdot a}} \]
    3. Simplified71.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 65.5%

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

    if 4.7000000000000002e29 < b

    1. Initial program 42.1%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
      2. associate-/l*64.0%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    5. Simplified64.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 8.6 \cdot 10^{+25}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{elif}\;b \leq 4.7 \cdot 10^{+29}:\\ \;\;\;\;\frac{b - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.5}{\frac{b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 74.7% accurate, 23.2× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    2. associate-/l*73.7%

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

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

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

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

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

Alternative 10: 74.7% accurate, 23.2× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    2. associate-/l*73.7%

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

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

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

Alternative 11: 74.9% accurate, 23.2× speedup?

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

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

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

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

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

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

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

Reproduce

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