Cubic critical, narrow range

Percentage Accurate: 54.9% → 90.9%
Time: 19.2s
Alternatives: 14
Speedup: 23.2×

Specification

?
\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(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 14 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: 54.9% 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: 90.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(a \cdot c\right)}^{4}\\ \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(\frac{-0.16666666666666666}{a}, \frac{\mathsf{fma}\left(5.0625, t_0, t_0 \cdot 1.265625\right)}{{b}^{7}}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\right)\right) \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (pow (* a c) 4.0)))
   (fma
    -0.5625
    (* (/ (* a a) (pow b 5.0)) (pow c 3.0))
    (fma
     (/ -0.16666666666666666 a)
     (/ (fma 5.0625 t_0 (* t_0 1.265625)) (pow b 7.0))
     (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (* -0.5 (/ c b)))))))
double code(double a, double b, double c) {
	double t_0 = pow((a * c), 4.0);
	return fma(-0.5625, (((a * a) / pow(b, 5.0)) * pow(c, 3.0)), fma((-0.16666666666666666 / a), (fma(5.0625, t_0, (t_0 * 1.265625)) / pow(b, 7.0)), fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (-0.5 * (c / b)))));
}
function code(a, b, c)
	t_0 = Float64(a * c) ^ 4.0
	return fma(-0.5625, Float64(Float64(Float64(a * a) / (b ^ 5.0)) * (c ^ 3.0)), fma(Float64(-0.16666666666666666 / a), Float64(fma(5.0625, t_0, Float64(t_0 * 1.265625)) / (b ^ 7.0)), fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(-0.5 * Float64(c / b)))))
end
code[a_, b_, c_] := Block[{t$95$0 = N[Power[N[(a * c), $MachinePrecision], 4.0], $MachinePrecision]}, N[(-0.5625 * N[(N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.16666666666666666 / a), $MachinePrecision] * N[(N[(5.0625 * t$95$0 + N[(t$95$0 * 1.265625), $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(a \cdot c\right)}^{4}\\
\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(\frac{-0.16666666666666666}{a}, \frac{\mathsf{fma}\left(5.0625, t_0, t_0 \cdot 1.265625\right)}{{b}^{7}}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 53.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. neg-sub053.4%

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{{\left(\frac{0.3333333333333333}{a}\right)}^{-1}}} \]
  6. Step-by-step derivation
    1. div-inv53.5%

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

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

    \[\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)} \]
  9. Simplified92.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(\frac{-0.16666666666666666}{a}, \frac{\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\left(a \cdot c\right)}^{4} \cdot 1.265625\right)}{{b}^{7}}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\right)\right)} \]
  10. Final simplification92.0%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(\frac{-0.16666666666666666}{a}, \frac{\mathsf{fma}\left(5.0625, {\left(a \cdot c\right)}^{4}, {\left(a \cdot c\right)}^{4} \cdot 1.265625\right)}{{b}^{7}}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\right)\right) \]

Alternative 2: 90.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666}{a} \cdot \frac{{\left(a \cdot c\right)}^{4} \cdot 6.328125}{{b}^{7}}\right)\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -0.5625
  (/ (* a a) (/ (pow b 5.0) (pow c 3.0)))
  (fma
   -0.5
   (/ c b)
   (fma
    -0.375
    (/ a (/ (pow b 3.0) (* c c)))
    (*
     (/ -0.16666666666666666 a)
     (/ (* (pow (* a c) 4.0) 6.328125) (pow b 7.0)))))))
double code(double a, double b, double c) {
	return fma(-0.5625, ((a * a) / (pow(b, 5.0) / pow(c, 3.0))), fma(-0.5, (c / b), fma(-0.375, (a / (pow(b, 3.0) / (c * c))), ((-0.16666666666666666 / a) * ((pow((a * c), 4.0) * 6.328125) / pow(b, 7.0))))));
}
function code(a, b, c)
	return fma(-0.5625, Float64(Float64(a * a) / Float64((b ^ 5.0) / (c ^ 3.0))), fma(-0.5, Float64(c / b), fma(-0.375, Float64(a / Float64((b ^ 3.0) / Float64(c * c))), Float64(Float64(-0.16666666666666666 / a) * Float64(Float64((Float64(a * c) ^ 4.0) * 6.328125) / (b ^ 7.0))))))
end
code[a_, b_, c_] := N[(-0.5625 * N[(N[(a * a), $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(a / N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.16666666666666666 / a), $MachinePrecision] * N[(N[(N[Power[N[(a * c), $MachinePrecision], 4.0], $MachinePrecision] * 6.328125), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666}{a} \cdot \frac{{\left(a \cdot c\right)}^{4} \cdot 6.328125}{{b}^{7}}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 53.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-neg53.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-neg53.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*53.4%

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

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

    \[\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)} \]
  5. Step-by-step derivation
    1. fma-def92.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}, -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)} \]
    2. associate-/l*92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -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) \]
    3. unpow292.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{\color{blue}{a \cdot a}}{\frac{{b}^{5}}{{c}^{3}}}, -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. fma-def92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \color{blue}{\mathsf{fma}\left(-0.5, \frac{c}{b}, -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) \]
    5. fma-def92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \color{blue}{\mathsf{fma}\left(-0.375, \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)\right) \]
  6. Simplified92.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, -0.16666666666666666 \cdot \frac{\mathsf{fma}\left(5.0625, {a}^{4} \cdot {c}^{4}, {\left(\left(-1.125 \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot c\right)\right)}^{2}\right)}{a \cdot {b}^{7}}\right)\right)\right)} \]
  7. Taylor expanded in c around 0 92.0%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{-0.16666666666666666 \cdot \frac{{c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}\right)\right)\right) \]
  8. Step-by-step derivation
    1. associate-*r/92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\frac{-0.16666666666666666 \cdot \left({c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)\right)}{a \cdot {b}^{7}}}\right)\right)\right) \]
    2. distribute-rgt-in92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666 \cdot \color{blue}{\left(\left(1.265625 \cdot {a}^{4}\right) \cdot {c}^{4} + \left(5.0625 \cdot {a}^{4}\right) \cdot {c}^{4}\right)}}{a \cdot {b}^{7}}\right)\right)\right) \]
    3. associate-*r*92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666 \cdot \left(\color{blue}{1.265625 \cdot \left({a}^{4} \cdot {c}^{4}\right)} + \left(5.0625 \cdot {a}^{4}\right) \cdot {c}^{4}\right)}{a \cdot {b}^{7}}\right)\right)\right) \]
    4. associate-*r*92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666 \cdot \left(1.265625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + \color{blue}{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right)}\right)}{a \cdot {b}^{7}}\right)\right)\right) \]
    5. times-frac92.0%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\frac{-0.16666666666666666}{a} \cdot \frac{1.265625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + 5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right)}{{b}^{7}}}\right)\right)\right) \]
  9. Simplified92.0%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\frac{-0.16666666666666666}{a} \cdot \frac{{\left(a \cdot c\right)}^{4} \cdot 6.328125}{{b}^{7}}}\right)\right)\right) \]
  10. Final simplification92.0%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666}{a} \cdot \frac{{\left(a \cdot c\right)}^{4} \cdot 6.328125}{{b}^{7}}\right)\right)\right) \]

Alternative 3: 89.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), c \cdot \frac{-0.5}{b}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (expm1 (log1p (* a 3.0))))
   (fma
    -0.5625
    (* (/ (* a a) (pow b 5.0)) (pow c 3.0))
    (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (* c (/ -0.5 b))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / expm1(log1p((a * 3.0)));
	} else {
		tmp = fma(-0.5625, (((a * a) / pow(b, 5.0)) * pow(c, 3.0)), fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (c * (-0.5 / b))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / expm1(log1p(Float64(a * 3.0))));
	else
		tmp = fma(-0.5625, Float64(Float64(Float64(a * a) / (b ^ 5.0)) * (c ^ 3.0)), fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(c * Float64(-0.5 / b))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(Exp[N[Log[1 + N[(a * 3.0), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), c \cdot \frac{-0.5}{b}\right)\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot a\right)\right)}} \]
    5. Applied egg-rr81.3%

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

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

    1. Initial program 48.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. neg-sub048.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. clear-num48.6%

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

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

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

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

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

      \[\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)} \]
    9. Step-by-step derivation
      1. fma-def93.7%

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      3. associate-/r/93.7%

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{\color{blue}{a \cdot a}}{{b}^{5}} \cdot {c}^{3}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      5. +-commutative93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \color{blue}{-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.5 \cdot \frac{c}{b}}\right) \]
      6. fma-def93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \color{blue}{\mathsf{fma}\left(-0.375, \frac{a \cdot {c}^{2}}{{b}^{3}}, -0.5 \cdot \frac{c}{b}\right)}\right) \]
      7. associate-/l*93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}}, -0.5 \cdot \frac{c}{b}\right)\right) \]
      8. associate-/r/93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \color{blue}{\frac{a}{{b}^{3}} \cdot {c}^{2}}, -0.5 \cdot \frac{c}{b}\right)\right) \]
      9. unpow293.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)}, -0.5 \cdot \frac{c}{b}\right)\right) \]
      10. associate-*r/93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \color{blue}{\frac{-0.5 \cdot c}{b}}\right)\right) \]
      11. associate-/l*93.5%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \color{blue}{\frac{-0.5}{\frac{b}{c}}}\right)\right) \]
    10. Simplified93.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5}{\frac{b}{c}}\right)\right)} \]
    11. Step-by-step derivation
      1. associate-/r/93.5%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \color{blue}{\frac{-0.5}{b} \cdot c}\right)\right) \]
    12. Applied egg-rr93.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), c \cdot \frac{-0.5}{b}\right)\right)\\ \end{array} \]

Alternative 4: 89.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5}{\frac{b}{c}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (expm1 (log1p (* a 3.0))))
   (fma
    -0.5625
    (* (/ (* a a) (pow b 5.0)) (pow c 3.0))
    (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (/ -0.5 (/ b c))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / expm1(log1p((a * 3.0)));
	} else {
		tmp = fma(-0.5625, (((a * a) / pow(b, 5.0)) * pow(c, 3.0)), fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (-0.5 / (b / c))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / expm1(log1p(Float64(a * 3.0))));
	else
		tmp = fma(-0.5625, Float64(Float64(Float64(a * a) / (b ^ 5.0)) * (c ^ 3.0)), fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(-0.5 / Float64(b / c))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(Exp[N[Log[1 + N[(a * 3.0), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5}{\frac{b}{c}}\right)\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot a\right)\right)}} \]
    5. Applied egg-rr81.3%

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

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

    1. Initial program 48.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. neg-sub048.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. clear-num48.6%

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

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

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

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

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

      \[\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)} \]
    9. Step-by-step derivation
      1. fma-def93.7%

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      3. associate-/r/93.7%

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{\color{blue}{a \cdot a}}{{b}^{5}} \cdot {c}^{3}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      5. +-commutative93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \color{blue}{-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.5 \cdot \frac{c}{b}}\right) \]
      6. fma-def93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \color{blue}{\mathsf{fma}\left(-0.375, \frac{a \cdot {c}^{2}}{{b}^{3}}, -0.5 \cdot \frac{c}{b}\right)}\right) \]
      7. associate-/l*93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}}, -0.5 \cdot \frac{c}{b}\right)\right) \]
      8. associate-/r/93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \color{blue}{\frac{a}{{b}^{3}} \cdot {c}^{2}}, -0.5 \cdot \frac{c}{b}\right)\right) \]
      9. unpow293.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)}, -0.5 \cdot \frac{c}{b}\right)\right) \]
      10. associate-*r/93.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \color{blue}{\frac{-0.5 \cdot c}{b}}\right)\right) \]
      11. associate-/l*93.5%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \color{blue}{\frac{-0.5}{\frac{b}{c}}}\right)\right) \]
    10. Simplified93.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5}{\frac{b}{c}}\right)\right)\\ \end{array} \]

Alternative 5: 89.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (expm1 (log1p (* a 3.0))))
   (fma
    -0.5625
    (/ (* a a) (/ (pow b 5.0) (pow c 3.0)))
    (fma -0.5 (/ c b) (* -0.375 (/ a (/ (pow b 3.0) (* c c))))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / expm1(log1p((a * 3.0)));
	} else {
		tmp = fma(-0.5625, ((a * a) / (pow(b, 5.0) / pow(c, 3.0))), fma(-0.5, (c / b), (-0.375 * (a / (pow(b, 3.0) / (c * c))))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / expm1(log1p(Float64(a * 3.0))));
	else
		tmp = fma(-0.5625, Float64(Float64(a * a) / Float64((b ^ 5.0) / (c ^ 3.0))), fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(a / Float64((b ^ 3.0) / Float64(c * c))))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(Exp[N[Log[1 + N[(a * 3.0), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[(a * a), $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(a / N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right)\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot a\right)\right)}} \]
    5. Applied egg-rr81.3%

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

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

    1. Initial program 48.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-neg48.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-neg48.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*48.4%

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

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

      \[\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)} \]
    5. Step-by-step derivation
      1. fma-def93.7%

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      3. unpow293.7%

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

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}}\right)\right) \]
      6. unpow293.7%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{\color{blue}{c \cdot c}}}\right)\right) \]
    6. Simplified93.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right)\right)\\ \end{array} \]

Alternative 6: 89.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5625 \cdot \left(a \cdot a\right)}{\frac{{b}^{5}}{{c}^{3}}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (expm1 (log1p (* a 3.0))))
   (fma
    -0.5
    (/ c b)
    (fma
     -0.375
     (* (/ a (pow b 3.0)) (* c c))
     (/ (* -0.5625 (* a a)) (/ (pow b 5.0) (pow c 3.0)))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / expm1(log1p((a * 3.0)));
	} else {
		tmp = fma(-0.5, (c / b), fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), ((-0.5625 * (a * a)) / (pow(b, 5.0) / pow(c, 3.0)))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / expm1(log1p(Float64(a * 3.0))));
	else
		tmp = fma(-0.5, Float64(c / b), fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(Float64(-0.5625 * Float64(a * a)) / Float64((b ^ 5.0) / (c ^ 3.0)))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(Exp[N[Log[1 + N[(a * 3.0), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5625 * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5625 \cdot \left(a \cdot a\right)}{\frac{{b}^{5}}{{c}^{3}}}\right)\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot a\right)\right)}} \]
    5. Applied egg-rr81.3%

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

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

    1. Initial program 48.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. neg-sub048.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. clear-num48.6%

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

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

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

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

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

      \[\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)} \]
    9. Step-by-step derivation
      1. +-commutative93.7%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}}, -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}\right)\right) \]
      6. associate-/r/93.7%

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

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)}, -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}\right)\right) \]
      8. associate-/l*93.7%

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5625 \cdot \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}\right)\right) \]
      9. associate-*r/93.7%

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \color{blue}{\frac{-0.5625 \cdot {a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}\right)\right) \]
      10. unpow293.7%

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5625 \cdot \color{blue}{\left(a \cdot a\right)}}{\frac{{b}^{5}}{{c}^{3}}}\right)\right) \]
    10. Simplified93.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-0.5625 \cdot \left(a \cdot a\right)}{\frac{{b}^{5}}{{c}^{3}}}\right)\right)\\ \end{array} \]

Alternative 7: 85.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (expm1 (log1p (* a 3.0))))
   (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / expm1(log1p((a * 3.0)));
	} else {
		tmp = fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (-0.5 * (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / expm1(log1p(Float64(a * 3.0))));
	else
		tmp = fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(Exp[N[Log[1 + N[(a * 3.0), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(3 \cdot a\right)\right)}} \]
    5. Applied egg-rr81.3%

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

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

    1. Initial program 48.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-neg48.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-neg48.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*48.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)}, -0.5 \cdot \frac{c}{b}\right) \]
    6. Simplified88.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot 3\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \]

Alternative 8: 85.3% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot \color{blue}{\left(\sqrt{a} \cdot \sqrt{a}\right)}} \]
      5. associate-*r*81.2%

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

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\left(3 \cdot \sqrt{a}\right) \cdot \sqrt{a}}} \]
    6. Step-by-step derivation
      1. div-inv81.3%

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

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b\right) \cdot \frac{1}{\color{blue}{3 \cdot \left(\sqrt{a} \cdot \sqrt{a}\right)}} \]
      3. add-sqr-sqrt81.3%

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

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

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

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

    1. Initial program 48.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-neg48.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-neg48.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*48.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)}, -0.5 \cdot \frac{c}{b}\right) \]
    6. Simplified88.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b\right) \cdot \frac{1}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \]

Alternative 9: 85.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* c (* a -3.0)))) b) (* a 3.0))
   (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (c * (a * -3.0)))) - b) / (a * 3.0);
	} else {
		tmp = fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (-0.5 * (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -3.0)))) - b) / Float64(a * 3.0));
	else
		tmp = fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\


\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)) < -0.089999999999999997

    1. Initial program 81.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. neg-sub081.1%

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

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

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

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

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

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

    1. Initial program 48.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-neg48.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-neg48.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*48.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \color{blue}{\left(c \cdot c\right)}, -0.5 \cdot \frac{c}{b}\right) \]
    6. Simplified88.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \]

Alternative 10: 77.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -5 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -5e-7)
   (* 0.3333333333333333 (/ (- (sqrt (fma b b (* (* a c) -3.0))) b) a))
   (* -0.5 (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -5e-7) {
		tmp = 0.3333333333333333 * ((sqrt(fma(b, b, ((a * c) * -3.0))) - b) / a);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -5e-7)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(fma(b, b, Float64(Float64(a * c) * -3.0))) - b) / a));
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -5e-7], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(b * b + N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -5 \cdot 10^{-7}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)} - b}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{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)) < -4.99999999999999977e-7

    1. Initial program 70.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. neg-sub070.2%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{\frac{1}{\frac{0.3333333333333333}{a}}}} \]
      2. inv-pow70.2%

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{\color{blue}{\frac{1}{0.3333333333333333 \cdot \frac{1}{a}}}} - \frac{b}{{\left(0.3333333333333333 \cdot \frac{1}{a}\right)}^{-1}} \]
      3. un-div-inv68.6%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{\frac{1}{\frac{0.3333333333333333}{a}}} - \frac{b}{\color{blue}{\frac{1}{0.3333333333333333 \cdot \frac{1}{a}}}} \]
      5. un-div-inv69.4%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0.3333333333333333} \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{a} \]
      7. associate-*r*70.2%

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

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

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

    1. Initial program 33.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-neg33.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-neg33.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*33.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -5 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 11: 77.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{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)) < -4.99999999999999977e-7

    1. Initial program 70.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. neg-sub070.2%

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

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

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

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

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

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

    1. Initial program 33.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-neg33.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-neg33.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*33.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -5 \cdot 10^{-7}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 12: 77.0% 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 -5 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{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 -5e-7) t_0 (* -0.5 (/ c 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 <= -5e-7) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
    if (t_0 <= (-5d-7)) then
        tmp = t_0
    else
        tmp = (-0.5d0) * (c / 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 <= -5e-7) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (c / 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 <= -5e-7:
		tmp = t_0
	else:
		tmp = -0.5 * (c / 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 <= -5e-7)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(c / 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 <= -5e-7)
		tmp = t_0;
	else
		tmp = -0.5 * (c / 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, -5e-7], t$95$0, N[(-0.5 * N[(c / b), $MachinePrecision]), $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 -5 \cdot 10^{-7}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{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)) < -4.99999999999999977e-7

    1. Initial program 70.2%

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

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

    1. Initial program 33.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-neg33.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-neg33.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*33.4%

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

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

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

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

Alternative 13: 73.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 71.0%

      \[\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-neg71.0%

        \[\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-neg71.0%

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

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

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

    if 950 < b

    1. Initial program 40.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-neg40.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-neg40.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*40.3%

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

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

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

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

Alternative 14: 64.7% accurate, 23.2× speedup?

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

\\
-0.5 \cdot \frac{c}{b}
\end{array}
Derivation
  1. Initial program 53.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-neg53.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-neg53.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*53.4%

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

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

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

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

Reproduce

?
herbie shell --seed 2023283 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))