Cubic critical, narrow range

Percentage Accurate: 54.9% → 92.5%
Time: 18.2s
Alternatives: 18
Speedup: 2.9×

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 18 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: 92.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ t_1 := \sqrt{t\_0}\\ t_2 := b \cdot \left(b \cdot b\right)\\ t_3 := \frac{c}{t\_2} \cdot -0.375\\ t_4 := t\_0 \cdot t\_1\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(t\_2, \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(t\_0 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left(t\_1 \cdot \left(-t\_0\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot t\_2, t\_4 \cdot t\_4 + t\_2 \cdot t\_4\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_1, t\_0\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, -3 \cdot \mathsf{fma}\left(a, \mathsf{fma}\left(-0.75, \frac{c \cdot t\_3}{b \cdot b}, \mathsf{fma}\left(-0.2222222222222222, \frac{b \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 6.328125\right)}{c \cdot c}, \frac{\left(c \cdot c\right) \cdot 0.5625}{{b}^{5}}\right)\right), t\_3\right), \frac{1.5}{b}\right), \frac{b \cdot -2}{c}\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b)))
        (t_1 (sqrt t_0))
        (t_2 (* b (* b b)))
        (t_3 (* (/ c t_2) -0.375))
        (t_4 (* t_0 t_1)))
   (if (<= b 0.056)
     (/
      (/
       (/
        (fma
         t_2
         (* (* b b) (* (* b b) (* b b)))
         (* (* t_0 (* t_0 t_0)) (* t_1 (- t_0))))
        (fma b (* (* b b) t_2) (+ (* t_4 t_4) (* t_2 t_4))))
       (* a (fma b b (fma b t_1 t_0))))
      -3.0)
     (/
      1.0
      (fma
       a
       (fma
        a
        (*
         -3.0
         (fma
          a
          (fma
           -0.75
           (/ (* c t_3) (* b b))
           (fma
            -0.2222222222222222
            (/ (* b (* (/ (pow c 4.0) (pow b 6.0)) 6.328125)) (* c c))
            (/ (* (* c c) 0.5625) (pow b 5.0))))
          t_3))
        (/ 1.5 b))
       (/ (* b -2.0) c))))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double t_1 = sqrt(t_0);
	double t_2 = b * (b * b);
	double t_3 = (c / t_2) * -0.375;
	double t_4 = t_0 * t_1;
	double tmp;
	if (b <= 0.056) {
		tmp = ((fma(t_2, ((b * b) * ((b * b) * (b * b))), ((t_0 * (t_0 * t_0)) * (t_1 * -t_0))) / fma(b, ((b * b) * t_2), ((t_4 * t_4) + (t_2 * t_4)))) / (a * fma(b, b, fma(b, t_1, t_0)))) / -3.0;
	} else {
		tmp = 1.0 / fma(a, fma(a, (-3.0 * fma(a, fma(-0.75, ((c * t_3) / (b * b)), fma(-0.2222222222222222, ((b * ((pow(c, 4.0) / pow(b, 6.0)) * 6.328125)) / (c * c)), (((c * c) * 0.5625) / pow(b, 5.0)))), t_3)), (1.5 / b)), ((b * -2.0) / c));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	t_1 = sqrt(t_0)
	t_2 = Float64(b * Float64(b * b))
	t_3 = Float64(Float64(c / t_2) * -0.375)
	t_4 = Float64(t_0 * t_1)
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(fma(t_2, Float64(Float64(b * b) * Float64(Float64(b * b) * Float64(b * b))), Float64(Float64(t_0 * Float64(t_0 * t_0)) * Float64(t_1 * Float64(-t_0)))) / fma(b, Float64(Float64(b * b) * t_2), Float64(Float64(t_4 * t_4) + Float64(t_2 * t_4)))) / Float64(a * fma(b, b, fma(b, t_1, t_0)))) / -3.0);
	else
		tmp = Float64(1.0 / fma(a, fma(a, Float64(-3.0 * fma(a, fma(-0.75, Float64(Float64(c * t_3) / Float64(b * b)), fma(-0.2222222222222222, Float64(Float64(b * Float64(Float64((c ^ 4.0) / (b ^ 6.0)) * 6.328125)) / Float64(c * c)), Float64(Float64(Float64(c * c) * 0.5625) / (b ^ 5.0)))), t_3)), Float64(1.5 / b)), Float64(Float64(b * -2.0) / c)));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c / t$95$2), $MachinePrecision] * -0.375), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(N[(t$95$2 * N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * (-t$95$0)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * N[(N[(b * b), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(N[(t$95$4 * t$95$4), $MachinePrecision] + N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * b + N[(b * t$95$1 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision], N[(1.0 / N[(a * N[(a * N[(-3.0 * N[(a * N[(-0.75 * N[(N[(c * t$95$3), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(-0.2222222222222222 * N[(N[(b * N[(N[(N[Power[c, 4.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * 6.328125), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * c), $MachinePrecision] * 0.5625), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(1.5 / b), $MachinePrecision]), $MachinePrecision] + N[(N[(b * -2.0), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
t_2 := b \cdot \left(b \cdot b\right)\\
t_3 := \frac{c}{t\_2} \cdot -0.375\\
t_4 := t\_0 \cdot t\_1\\
\mathbf{if}\;b \leq 0.056:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(t\_2, \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(t\_0 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left(t\_1 \cdot \left(-t\_0\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot t\_2, t\_4 \cdot t\_4 + t\_2 \cdot t\_4\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_1, t\_0\right)\right)}}{-3}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, -3 \cdot \mathsf{fma}\left(a, \mathsf{fma}\left(-0.75, \frac{c \cdot t\_3}{b \cdot b}, \mathsf{fma}\left(-0.2222222222222222, \frac{b \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 6.328125\right)}{c \cdot c}, \frac{\left(c \cdot c\right) \cdot 0.5625}{{b}^{5}}\right)\right), t\_3\right), \frac{1.5}{b}\right), \frac{b \cdot -2}{c}\right)}\\


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

    1. Initial program 88.9%

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

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + a \cdot \left(a \cdot \left(-3 \cdot \left(a \cdot \left(\frac{-3}{4} \cdot \frac{c \cdot \left(\frac{-3}{4} \cdot \frac{c}{{b}^{3}} + \frac{3}{8} \cdot \frac{c}{{b}^{3}}\right)}{{b}^{2}} + \left(\frac{-2}{9} \cdot \frac{b \cdot \left(\frac{81}{64} \cdot \frac{{c}^{4}}{{b}^{6}} + \frac{81}{16} \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{{c}^{2}} + \frac{9}{16} \cdot \frac{{c}^{2}}{{b}^{5}}\right)\right)\right) + -3 \cdot \left(\frac{-3}{4} \cdot \frac{c}{{b}^{3}} + \frac{3}{8} \cdot \frac{c}{{b}^{3}}\right)\right) + \frac{3}{2} \cdot \frac{1}{b}\right)}} \]
    6. Applied rewrites93.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(b \cdot \left(b \cdot b\right), \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} \cdot \left(-\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot b\right)\right), \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) + \left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, -3 \cdot \mathsf{fma}\left(a, \mathsf{fma}\left(-0.75, \frac{c \cdot \left(\frac{c}{b \cdot \left(b \cdot b\right)} \cdot -0.375\right)}{b \cdot b}, \mathsf{fma}\left(-0.2222222222222222, \frac{b \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 6.328125\right)}{c \cdot c}, \frac{\left(c \cdot c\right) \cdot 0.5625}{{b}^{5}}\right)\right), \frac{c}{b \cdot \left(b \cdot b\right)} \cdot -0.375\right), \frac{1.5}{b}\right), \frac{b \cdot -2}{c}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 91.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \left(a \cdot a\right)\\ t_1 := \left(a \cdot c\right) \cdot -9\\ t_2 := \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(t\_1 \cdot t\_1\right)\right)\\ t_3 := \mathsf{fma}\left(-27, t\_0 \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(t\_1 \cdot t\_2\right)\right)\\ \frac{\frac{b \cdot \left(\frac{0.5 \cdot \mathsf{fma}\left(0.5, t\_1 \cdot t\_3, 0.25 \cdot \left(t\_2 \cdot t\_2\right)\right)}{{b}^{6}} - \mathsf{fma}\left(0.5, \frac{t\_3}{{b}^{4}} + \frac{t\_2}{b \cdot b}, 0.5 \cdot t\_1\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + c \cdot \mathsf{fma}\left(-1.5, \frac{a}{b}, c \cdot \mathsf{fma}\left(-1.6875, \frac{c \cdot t\_0}{{b}^{5}}, -1.125 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}\right)\right), \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (* a a)))
        (t_1 (* (* a c) -9.0))
        (t_2 (fma (* (* a a) (* c c)) 27.0 (* -0.25 (* t_1 t_1))))
        (t_3 (fma -27.0 (* t_0 (* c (* c c))) (* -0.5 (* t_1 t_2)))))
   (/
    (/
     (*
      b
      (-
       (/ (* 0.5 (fma 0.5 (* t_1 t_3) (* 0.25 (* t_2 t_2)))) (pow b 6.0))
       (fma 0.5 (+ (/ t_3 (pow b 4.0)) (/ t_2 (* b b))) (* 0.5 t_1))))
     (*
      a
      (fma
       b
       b
       (fma
        b
        (+
         b
         (*
          c
          (fma
           -1.5
           (/ a b)
           (*
            c
            (fma
             -1.6875
             (/ (* c t_0) (pow b 5.0))
             (* -1.125 (/ (* a a) (* b (* b b)))))))))
        (fma a (* c -3.0) (* b b))))))
    -3.0)))
double code(double a, double b, double c) {
	double t_0 = a * (a * a);
	double t_1 = (a * c) * -9.0;
	double t_2 = fma(((a * a) * (c * c)), 27.0, (-0.25 * (t_1 * t_1)));
	double t_3 = fma(-27.0, (t_0 * (c * (c * c))), (-0.5 * (t_1 * t_2)));
	return ((b * (((0.5 * fma(0.5, (t_1 * t_3), (0.25 * (t_2 * t_2)))) / pow(b, 6.0)) - fma(0.5, ((t_3 / pow(b, 4.0)) + (t_2 / (b * b))), (0.5 * t_1)))) / (a * fma(b, b, fma(b, (b + (c * fma(-1.5, (a / b), (c * fma(-1.6875, ((c * t_0) / pow(b, 5.0)), (-1.125 * ((a * a) / (b * (b * b))))))))), fma(a, (c * -3.0), (b * b)))))) / -3.0;
}
function code(a, b, c)
	t_0 = Float64(a * Float64(a * a))
	t_1 = Float64(Float64(a * c) * -9.0)
	t_2 = fma(Float64(Float64(a * a) * Float64(c * c)), 27.0, Float64(-0.25 * Float64(t_1 * t_1)))
	t_3 = fma(-27.0, Float64(t_0 * Float64(c * Float64(c * c))), Float64(-0.5 * Float64(t_1 * t_2)))
	return Float64(Float64(Float64(b * Float64(Float64(Float64(0.5 * fma(0.5, Float64(t_1 * t_3), Float64(0.25 * Float64(t_2 * t_2)))) / (b ^ 6.0)) - fma(0.5, Float64(Float64(t_3 / (b ^ 4.0)) + Float64(t_2 / Float64(b * b))), Float64(0.5 * t_1)))) / Float64(a * fma(b, b, fma(b, Float64(b + Float64(c * fma(-1.5, Float64(a / b), Float64(c * fma(-1.6875, Float64(Float64(c * t_0) / (b ^ 5.0)), Float64(-1.125 * Float64(Float64(a * a) / Float64(b * Float64(b * b))))))))), fma(a, Float64(c * -3.0), Float64(b * b)))))) / -3.0)
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a * c), $MachinePrecision] * -9.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a * a), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] * 27.0 + N[(-0.25 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-27.0 * N[(t$95$0 * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(b * N[(N[(N[(0.5 * N[(0.5 * N[(t$95$1 * t$95$3), $MachinePrecision] + N[(0.25 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(N[(t$95$3 / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * b + N[(b * N[(b + N[(c * N[(-1.5 * N[(a / b), $MachinePrecision] + N[(c * N[(-1.6875 * N[(N[(c * t$95$0), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[(a * a), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot a\right)\\
t_1 := \left(a \cdot c\right) \cdot -9\\
t_2 := \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(t\_1 \cdot t\_1\right)\right)\\
t_3 := \mathsf{fma}\left(-27, t\_0 \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(t\_1 \cdot t\_2\right)\right)\\
\frac{\frac{b \cdot \left(\frac{0.5 \cdot \mathsf{fma}\left(0.5, t\_1 \cdot t\_3, 0.25 \cdot \left(t\_2 \cdot t\_2\right)\right)}{{b}^{6}} - \mathsf{fma}\left(0.5, \frac{t\_3}{{b}^{4}} + \frac{t\_2}{b \cdot b}, 0.5 \cdot t\_1\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + c \cdot \mathsf{fma}\left(-1.5, \frac{a}{b}, c \cdot \mathsf{fma}\left(-1.6875, \frac{c \cdot t\_0}{{b}^{5}}, -1.125 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}\right)\right), \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}
\end{array}
\end{array}
Derivation
  1. Initial program 56.1%

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{b \cdot \left(\frac{0.5 \cdot \mathsf{fma}\left(0.5, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), 0.25 \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, 0.5 \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
  7. Taylor expanded in c around 0

    \[\leadsto \frac{\frac{b \cdot \left(\frac{\frac{1}{2} \cdot \mathsf{fma}\left(\frac{1}{2}, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), \frac{1}{4} \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(\frac{1}{2}, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, \frac{1}{2} \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \color{blue}{b + c \cdot \left(\frac{-3}{2} \cdot \frac{a}{b} + c \cdot \left(\frac{-27}{16} \cdot \frac{{a}^{3} \cdot c}{{b}^{5}} + \frac{-9}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
  8. Step-by-step derivation
    1. lower-+.f64N/A

      \[\leadsto \frac{\frac{b \cdot \left(\frac{\frac{1}{2} \cdot \mathsf{fma}\left(\frac{1}{2}, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), \frac{1}{4} \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(\frac{1}{2}, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, \frac{1}{2} \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \color{blue}{b + c \cdot \left(\frac{-3}{2} \cdot \frac{a}{b} + c \cdot \left(\frac{-27}{16} \cdot \frac{{a}^{3} \cdot c}{{b}^{5}} + \frac{-9}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{\frac{b \cdot \left(\frac{\frac{1}{2} \cdot \mathsf{fma}\left(\frac{1}{2}, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), \frac{1}{4} \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(\frac{1}{2}, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, \frac{1}{2} \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + \color{blue}{c \cdot \left(\frac{-3}{2} \cdot \frac{a}{b} + c \cdot \left(\frac{-27}{16} \cdot \frac{{a}^{3} \cdot c}{{b}^{5}} + \frac{-9}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    3. lower-fma.f64N/A

      \[\leadsto \frac{\frac{b \cdot \left(\frac{\frac{1}{2} \cdot \mathsf{fma}\left(\frac{1}{2}, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), \frac{1}{4} \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(\frac{1}{2}, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, \frac{1}{2} \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + c \cdot \color{blue}{\mathsf{fma}\left(\frac{-3}{2}, \frac{a}{b}, c \cdot \left(\frac{-27}{16} \cdot \frac{{a}^{3} \cdot c}{{b}^{5}} + \frac{-9}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    4. lower-/.f64N/A

      \[\leadsto \frac{\frac{b \cdot \left(\frac{\frac{1}{2} \cdot \mathsf{fma}\left(\frac{1}{2}, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), \frac{1}{4} \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(\frac{1}{2}, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, \frac{1}{2} \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + c \cdot \mathsf{fma}\left(\frac{-3}{2}, \color{blue}{\frac{a}{b}}, c \cdot \left(\frac{-27}{16} \cdot \frac{{a}^{3} \cdot c}{{b}^{5}} + \frac{-9}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)\right), \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    5. lower-*.f64N/A

      \[\leadsto \frac{\frac{b \cdot \left(\frac{\frac{1}{2} \cdot \mathsf{fma}\left(\frac{1}{2}, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), \frac{1}{4} \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(\frac{1}{2}, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), \frac{-1}{2} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, \frac{-1}{4} \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, \frac{1}{2} \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + c \cdot \mathsf{fma}\left(\frac{-3}{2}, \frac{a}{b}, \color{blue}{c \cdot \left(\frac{-27}{16} \cdot \frac{{a}^{3} \cdot c}{{b}^{5}} + \frac{-9}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)}\right), \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    6. lower-fma.f64N/A

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

    \[\leadsto \frac{\frac{b \cdot \left(\frac{0.5 \cdot \mathsf{fma}\left(0.5, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), 0.25 \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, 0.5 \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \color{blue}{b + c \cdot \mathsf{fma}\left(-1.5, \frac{a}{b}, c \cdot \mathsf{fma}\left(-1.6875, \frac{\left(a \cdot \left(a \cdot a\right)\right) \cdot c}{{b}^{5}}, -1.125 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}\right)\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
  10. Final simplification91.4%

    \[\leadsto \frac{\frac{b \cdot \left(\frac{0.5 \cdot \mathsf{fma}\left(0.5, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), 0.25 \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, 0.5 \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b + c \cdot \mathsf{fma}\left(-1.5, \frac{a}{b}, c \cdot \mathsf{fma}\left(-1.6875, \frac{c \cdot \left(a \cdot \left(a \cdot a\right)\right)}{{b}^{5}}, -1.125 \cdot \frac{a \cdot a}{b \cdot \left(b \cdot b\right)}\right)\right), \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
  11. Add Preprocessing

Alternative 3: 92.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ t_1 := \left(a \cdot c\right) \cdot 4.5\\ t_2 := \sqrt{t\_0}\\ t_3 := b \cdot \left(b \cdot b\right)\\ t_4 := b \cdot t\_3\\ t_5 := \mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right)\\ t_6 := \mathsf{fma}\left(t\_5, t\_1, \left(c \cdot \left(c \cdot c\right)\right) \cdot \left(-27 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\\ t_7 := t\_0 \cdot t\_2\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(t\_3, \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(t\_0 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left(t\_2 \cdot \left(-t\_0\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot t\_3, t\_7 \cdot t\_7 + t\_3 \cdot t\_7\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_2, t\_0\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(0.25, t\_5 \cdot t\_5, t\_6 \cdot \left(\left(a \cdot c\right) \cdot -4.5\right)\right)}{\left(b \cdot b\right) \cdot t\_4} - \left(\frac{t\_6}{t\_4} + \frac{t\_5}{b \cdot b}\right), t\_1\right)}{a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right), c \cdot \left(a \cdot -3\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b)))
        (t_1 (* (* a c) 4.5))
        (t_2 (sqrt t_0))
        (t_3 (* b (* b b)))
        (t_4 (* b t_3))
        (t_5 (fma (* a (* a (* c c))) -20.25 (* (* c c) (* (* a a) 27.0))))
        (t_6 (fma t_5 t_1 (* (* c (* c c)) (* -27.0 (* a (* a a))))))
        (t_7 (* t_0 t_2)))
   (if (<= b 0.056)
     (/
      (/
       (/
        (fma
         t_3
         (* (* b b) (* (* b b) (* b b)))
         (* (* t_0 (* t_0 t_0)) (* t_2 (- t_0))))
        (fma b (* (* b b) t_3) (+ (* t_7 t_7) (* t_3 t_7))))
       (* a (fma b b (fma b t_2 t_0))))
      -3.0)
     (/
      (*
       b
       (fma
        0.5
        (-
         (/ (fma 0.25 (* t_5 t_5) (* t_6 (* (* a c) -4.5))) (* (* b b) t_4))
         (+ (/ t_6 t_4) (/ t_5 (* b b))))
        t_1))
      (*
       a
       (*
        -3.0
        (fma
         b
         (+ b (+ b (sqrt (fma c (* a -3.0) (* b b)))))
         (* c (* a -3.0)))))))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double t_1 = (a * c) * 4.5;
	double t_2 = sqrt(t_0);
	double t_3 = b * (b * b);
	double t_4 = b * t_3;
	double t_5 = fma((a * (a * (c * c))), -20.25, ((c * c) * ((a * a) * 27.0)));
	double t_6 = fma(t_5, t_1, ((c * (c * c)) * (-27.0 * (a * (a * a)))));
	double t_7 = t_0 * t_2;
	double tmp;
	if (b <= 0.056) {
		tmp = ((fma(t_3, ((b * b) * ((b * b) * (b * b))), ((t_0 * (t_0 * t_0)) * (t_2 * -t_0))) / fma(b, ((b * b) * t_3), ((t_7 * t_7) + (t_3 * t_7)))) / (a * fma(b, b, fma(b, t_2, t_0)))) / -3.0;
	} else {
		tmp = (b * fma(0.5, ((fma(0.25, (t_5 * t_5), (t_6 * ((a * c) * -4.5))) / ((b * b) * t_4)) - ((t_6 / t_4) + (t_5 / (b * b)))), t_1)) / (a * (-3.0 * fma(b, (b + (b + sqrt(fma(c, (a * -3.0), (b * b))))), (c * (a * -3.0)))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	t_1 = Float64(Float64(a * c) * 4.5)
	t_2 = sqrt(t_0)
	t_3 = Float64(b * Float64(b * b))
	t_4 = Float64(b * t_3)
	t_5 = fma(Float64(a * Float64(a * Float64(c * c))), -20.25, Float64(Float64(c * c) * Float64(Float64(a * a) * 27.0)))
	t_6 = fma(t_5, t_1, Float64(Float64(c * Float64(c * c)) * Float64(-27.0 * Float64(a * Float64(a * a)))))
	t_7 = Float64(t_0 * t_2)
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(fma(t_3, Float64(Float64(b * b) * Float64(Float64(b * b) * Float64(b * b))), Float64(Float64(t_0 * Float64(t_0 * t_0)) * Float64(t_2 * Float64(-t_0)))) / fma(b, Float64(Float64(b * b) * t_3), Float64(Float64(t_7 * t_7) + Float64(t_3 * t_7)))) / Float64(a * fma(b, b, fma(b, t_2, t_0)))) / -3.0);
	else
		tmp = Float64(Float64(b * fma(0.5, Float64(Float64(fma(0.25, Float64(t_5 * t_5), Float64(t_6 * Float64(Float64(a * c) * -4.5))) / Float64(Float64(b * b) * t_4)) - Float64(Float64(t_6 / t_4) + Float64(t_5 / Float64(b * b)))), t_1)) / Float64(a * Float64(-3.0 * fma(b, Float64(b + Float64(b + sqrt(fma(c, Float64(a * -3.0), Float64(b * b))))), Float64(c * Float64(a * -3.0))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a * c), $MachinePrecision] * 4.5), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(b * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(a * N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -20.25 + N[(N[(c * c), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * t$95$1 + N[(N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[(-27.0 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$0 * t$95$2), $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(N[(t$95$3 * N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * (-t$95$0)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * N[(N[(b * b), $MachinePrecision] * t$95$3), $MachinePrecision] + N[(N[(t$95$7 * t$95$7), $MachinePrecision] + N[(t$95$3 * t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * b + N[(b * t$95$2 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision], N[(N[(b * N[(0.5 * N[(N[(N[(0.25 * N[(t$95$5 * t$95$5), $MachinePrecision] + N[(t$95$6 * N[(N[(a * c), $MachinePrecision] * -4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(b * b), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$6 / t$95$4), $MachinePrecision] + N[(t$95$5 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] / N[(a * N[(-3.0 * N[(b * N[(b + N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
t_1 := \left(a \cdot c\right) \cdot 4.5\\
t_2 := \sqrt{t\_0}\\
t_3 := b \cdot \left(b \cdot b\right)\\
t_4 := b \cdot t\_3\\
t_5 := \mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right)\\
t_6 := \mathsf{fma}\left(t\_5, t\_1, \left(c \cdot \left(c \cdot c\right)\right) \cdot \left(-27 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\\
t_7 := t\_0 \cdot t\_2\\
\mathbf{if}\;b \leq 0.056:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(t\_3, \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(t\_0 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left(t\_2 \cdot \left(-t\_0\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot t\_3, t\_7 \cdot t\_7 + t\_3 \cdot t\_7\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_2, t\_0\right)\right)}}{-3}\\

\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(0.25, t\_5 \cdot t\_5, t\_6 \cdot \left(\left(a \cdot c\right) \cdot -4.5\right)\right)}{\left(b \cdot b\right) \cdot t\_4} - \left(\frac{t\_6}{t\_4} + \frac{t\_5}{b \cdot b}\right), t\_1\right)}{a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right), c \cdot \left(a \cdot -3\right)\right)\right)}\\


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

    1. Initial program 88.9%

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

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{b \cdot \left(\frac{1}{2} \cdot \frac{\frac{1}{4} \cdot {\left(\left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 18 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) - \frac{1}{4} \cdot {\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right)}^{2}\right)}^{2} + \frac{1}{2} \cdot \left(\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right) \cdot \left(-27 \cdot \left({a}^{3} \cdot {c}^{3}\right) - \frac{1}{2} \cdot \left(\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right) \cdot \left(\left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 18 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) - \frac{1}{4} \cdot {\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right)}^{2}\right)\right)\right)\right)}{{b}^{6}} - \left(\frac{1}{2} \cdot \left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right) + \left(\frac{1}{2} \cdot \frac{-27 \cdot \left({a}^{3} \cdot {c}^{3}\right) - \frac{1}{2} \cdot \left(\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right) \cdot \left(\left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 18 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) - \frac{1}{4} \cdot {\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right)}^{2}\right)\right)}{{b}^{4}} + \frac{1}{2} \cdot \frac{\left(9 \cdot \left({a}^{2} \cdot {c}^{2}\right) + 18 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) - \frac{1}{4} \cdot {\left(-6 \cdot \left(a \cdot c\right) + -3 \cdot \left(a \cdot c\right)\right)}^{2}}{{b}^{2}}\right)\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    6. Applied rewrites93.0%

      \[\leadsto \frac{\frac{\color{blue}{b \cdot \left(\frac{0.5 \cdot \mathsf{fma}\left(0.5, \left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right), 0.25 \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{6}} - \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(-27, \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right), -0.5 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)\right)\right)}{{b}^{4}} + \frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, -0.25 \cdot \left(\left(\left(a \cdot c\right) \cdot -9\right) \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}{b \cdot b}, 0.5 \cdot \left(\left(a \cdot c\right) \cdot -9\right)\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3} \]
    7. Applied rewrites92.9%

      \[\leadsto \color{blue}{\frac{b \cdot \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(0.25, \mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right) \cdot \mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right), 4.5 \cdot \left(a \cdot c\right), \left(c \cdot \left(c \cdot c\right)\right) \cdot \left(-27 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right) \cdot \left(\left(a \cdot c\right) \cdot -4.5\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)} - \left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right), 4.5 \cdot \left(a \cdot c\right), \left(c \cdot \left(c \cdot c\right)\right) \cdot \left(-27 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \frac{\mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right)}{b \cdot b}\right), 4.5 \cdot \left(a \cdot c\right)\right)}{a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right), c \cdot \left(a \cdot -3\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(b \cdot \left(b \cdot b\right), \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} \cdot \left(-\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot b\right)\right), \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) + \left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \mathsf{fma}\left(0.5, \frac{\mathsf{fma}\left(0.25, \mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right) \cdot \mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right), \mathsf{fma}\left(\mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right), \left(a \cdot c\right) \cdot 4.5, \left(c \cdot \left(c \cdot c\right)\right) \cdot \left(-27 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right) \cdot \left(\left(a \cdot c\right) \cdot -4.5\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)} - \left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right), \left(a \cdot c\right) \cdot 4.5, \left(c \cdot \left(c \cdot c\right)\right) \cdot \left(-27 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \frac{\mathsf{fma}\left(a \cdot \left(a \cdot \left(c \cdot c\right)\right), -20.25, \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 27\right)\right)}{b \cdot b}\right), \left(a \cdot c\right) \cdot 4.5\right)}{a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right), c \cdot \left(a \cdot -3\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ t_1 := \sqrt{t\_0}\\ t_2 := b \cdot \left(b \cdot b\right)\\ t_3 := t\_0 \cdot t\_1\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(t\_2, \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(t\_0 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left(t\_1 \cdot \left(-t\_0\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot t\_2, t\_3 \cdot t\_3 + t\_2 \cdot t\_3\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_1, t\_0\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot t\_2}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_2 \cdot \left(a \cdot t\_2\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b)))
        (t_1 (sqrt t_0))
        (t_2 (* b (* b b)))
        (t_3 (* t_0 t_1)))
   (if (<= b 0.056)
     (/
      (/
       (/
        (fma
         t_2
         (* (* b b) (* (* b b) (* b b)))
         (* (* t_0 (* t_0 t_0)) (* t_1 (- t_0))))
        (fma b (* (* b b) t_2) (+ (* t_3 t_3) (* t_2 t_3))))
       (* a (fma b b (fma b t_1 t_0))))
      -3.0)
     (/
      (+
       (fma
        -0.5625
        (/ (* a (* a (* c (* c c)))) (* b t_2))
        (fma
         a
         (/ (* (* c c) -0.375) (* b b))
         (/
          (*
           6.328125
           (*
            -0.16666666666666666
            (* (* c c) (* (* c c) (* a (* a (* a a)))))))
          (* t_2 (* a t_2)))))
       (* c -0.5))
      b))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double t_1 = sqrt(t_0);
	double t_2 = b * (b * b);
	double t_3 = t_0 * t_1;
	double tmp;
	if (b <= 0.056) {
		tmp = ((fma(t_2, ((b * b) * ((b * b) * (b * b))), ((t_0 * (t_0 * t_0)) * (t_1 * -t_0))) / fma(b, ((b * b) * t_2), ((t_3 * t_3) + (t_2 * t_3)))) / (a * fma(b, b, fma(b, t_1, t_0)))) / -3.0;
	} else {
		tmp = (fma(-0.5625, ((a * (a * (c * (c * c)))) / (b * t_2)), fma(a, (((c * c) * -0.375) / (b * b)), ((6.328125 * (-0.16666666666666666 * ((c * c) * ((c * c) * (a * (a * (a * a))))))) / (t_2 * (a * t_2))))) + (c * -0.5)) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	t_1 = sqrt(t_0)
	t_2 = Float64(b * Float64(b * b))
	t_3 = Float64(t_0 * t_1)
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(fma(t_2, Float64(Float64(b * b) * Float64(Float64(b * b) * Float64(b * b))), Float64(Float64(t_0 * Float64(t_0 * t_0)) * Float64(t_1 * Float64(-t_0)))) / fma(b, Float64(Float64(b * b) * t_2), Float64(Float64(t_3 * t_3) + Float64(t_2 * t_3)))) / Float64(a * fma(b, b, fma(b, t_1, t_0)))) / -3.0);
	else
		tmp = Float64(Float64(fma(-0.5625, Float64(Float64(a * Float64(a * Float64(c * Float64(c * c)))) / Float64(b * t_2)), fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * b)), Float64(Float64(6.328125 * Float64(-0.16666666666666666 * Float64(Float64(c * c) * Float64(Float64(c * c) * Float64(a * Float64(a * Float64(a * a))))))) / Float64(t_2 * Float64(a * t_2))))) + Float64(c * -0.5)) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(N[(t$95$2 * N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * (-t$95$0)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * N[(N[(b * b), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(N[(t$95$3 * t$95$3), $MachinePrecision] + N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * b + N[(b * t$95$1 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision], N[(N[(N[(-0.5625 * N[(N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(6.328125 * N[(-0.16666666666666666 * N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(a * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
t_2 := b \cdot \left(b \cdot b\right)\\
t_3 := t\_0 \cdot t\_1\\
\mathbf{if}\;b \leq 0.056:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(t\_2, \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(t\_0 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left(t\_1 \cdot \left(-t\_0\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot t\_2, t\_3 \cdot t\_3 + t\_2 \cdot t\_3\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_1, t\_0\right)\right)}}{-3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot t\_2}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_2 \cdot \left(a \cdot t\_2\right)}\right)\right) + c \cdot -0.5}{b}\\


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

    1. Initial program 88.9%

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

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
    4. Applied rewrites92.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
    5. Applied rewrites92.9%

      \[\leadsto \frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right) \cdot 6.328125}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot a\right)}\right)\right) + c \cdot -0.5}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(b \cdot \left(b \cdot b\right), \left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right), \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} \cdot \left(-\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)\right)}{\mathsf{fma}\left(b, \left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot b\right)\right), \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right) + \left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(a \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\\ t_1 := \sqrt{t\_0}\\ t_2 := t\_0 \cdot \left(t\_0 \cdot t\_0\right)\\ t_3 := b \cdot \left(b \cdot b\right)\\ t_4 := \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ t_5 := t\_0 \cdot t\_1\\ \mathbf{if}\;b \leq 0.112:\\ \;\;\;\;\frac{t\_3 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot t\_3\right)\right) - t\_5 \cdot t\_2}{\left(a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + t\_1\right), c \cdot \left(a \cdot -3\right)\right)\right)\right) \cdot \mathsf{fma}\left(t\_3, t\_3 + t\_5, t\_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, -0.5625 \cdot \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{t\_4}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot t\_4\right)}\right)\right)\right)}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma c (* a -3.0) (* b b)))
        (t_1 (sqrt t_0))
        (t_2 (* t_0 (* t_0 t_0)))
        (t_3 (* b (* b b)))
        (t_4 (* (* b b) (* b b)))
        (t_5 (* t_0 t_1)))
   (if (<= b 0.112)
     (/
      (- (* t_3 (* (* b b) (* b t_3))) (* t_5 t_2))
      (*
       (* a (* -3.0 (fma b (+ b (+ b t_1)) (* c (* a -3.0)))))
       (fma t_3 (+ t_3 t_5) t_2)))
     (/
      (fma
       c
       -0.5
       (fma
        a
        (* -0.5625 (/ (* a (* c (* c c))) t_4))
        (fma
         a
         (/ (* (* c c) -0.375) (* b b))
         (/
          (* (* (* c c) (* (* c c) (* a (* a (* a a))))) -1.0546875)
          (* a (* (* b b) t_4))))))
      b))))
double code(double a, double b, double c) {
	double t_0 = fma(c, (a * -3.0), (b * b));
	double t_1 = sqrt(t_0);
	double t_2 = t_0 * (t_0 * t_0);
	double t_3 = b * (b * b);
	double t_4 = (b * b) * (b * b);
	double t_5 = t_0 * t_1;
	double tmp;
	if (b <= 0.112) {
		tmp = ((t_3 * ((b * b) * (b * t_3))) - (t_5 * t_2)) / ((a * (-3.0 * fma(b, (b + (b + t_1)), (c * (a * -3.0))))) * fma(t_3, (t_3 + t_5), t_2));
	} else {
		tmp = fma(c, -0.5, fma(a, (-0.5625 * ((a * (c * (c * c))) / t_4)), fma(a, (((c * c) * -0.375) / (b * b)), ((((c * c) * ((c * c) * (a * (a * (a * a))))) * -1.0546875) / (a * ((b * b) * t_4)))))) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(c, Float64(a * -3.0), Float64(b * b))
	t_1 = sqrt(t_0)
	t_2 = Float64(t_0 * Float64(t_0 * t_0))
	t_3 = Float64(b * Float64(b * b))
	t_4 = Float64(Float64(b * b) * Float64(b * b))
	t_5 = Float64(t_0 * t_1)
	tmp = 0.0
	if (b <= 0.112)
		tmp = Float64(Float64(Float64(t_3 * Float64(Float64(b * b) * Float64(b * t_3))) - Float64(t_5 * t_2)) / Float64(Float64(a * Float64(-3.0 * fma(b, Float64(b + Float64(b + t_1)), Float64(c * Float64(a * -3.0))))) * fma(t_3, Float64(t_3 + t_5), t_2)));
	else
		tmp = Float64(fma(c, -0.5, fma(a, Float64(-0.5625 * Float64(Float64(a * Float64(c * Float64(c * c))) / t_4)), fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * b)), Float64(Float64(Float64(Float64(c * c) * Float64(Float64(c * c) * Float64(a * Float64(a * Float64(a * a))))) * -1.0546875) / Float64(a * Float64(Float64(b * b) * t_4)))))) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[b, 0.112], N[(N[(N[(t$95$3 * N[(N[(b * b), $MachinePrecision] * N[(b * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$5 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[(a * N[(-3.0 * N[(b * N[(b + N[(b + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * N[(t$95$3 + t$95$5), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5 + N[(a * N[(-0.5625 * N[(N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -1.0546875), $MachinePrecision] / N[(a * N[(N[(b * b), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\\
t_1 := \sqrt{t\_0}\\
t_2 := t\_0 \cdot \left(t\_0 \cdot t\_0\right)\\
t_3 := b \cdot \left(b \cdot b\right)\\
t_4 := \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\
t_5 := t\_0 \cdot t\_1\\
\mathbf{if}\;b \leq 0.112:\\
\;\;\;\;\frac{t\_3 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot t\_3\right)\right) - t\_5 \cdot t\_2}{\left(a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + t\_1\right), c \cdot \left(a \cdot -3\right)\right)\right)\right) \cdot \mathsf{fma}\left(t\_3, t\_3 + t\_5, t\_2\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, -0.5625 \cdot \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{t\_4}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot t\_4\right)}\right)\right)\right)}{b}\\


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

    1. Initial program 87.3%

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

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

      \[\leadsto \frac{\color{blue}{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}}{-3} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}}{-3} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{-3 \cdot \left(a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)\right)}} \]
      4. lower-/.f64N/A

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

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

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

    if 0.112000000000000002 < b

    1. Initial program 52.5%

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

      \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
    4. Applied rewrites93.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
    5. Applied rewrites93.1%

      \[\leadsto \frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right) \cdot 6.328125}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot a\right)}\right)\right) + c \cdot -0.5}{b} \]
    6. Applied rewrites93.1%

      \[\leadsto \frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} \cdot -0.5625, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right)}\right)\right)\right)}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.112:\\ \;\;\;\;\frac{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right) - \left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right) \cdot \left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)\right)}{\left(a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right), c \cdot \left(a \cdot -3\right)\right)\right)\right) \cdot \mathsf{fma}\left(b \cdot \left(b \cdot b\right), b \cdot \left(b \cdot b\right) + \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, -0.5625 \cdot \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right)}\right)\right)\right)}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 92.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ t_1 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ t_2 := \sqrt{t\_1}\\ t_3 := \mathsf{fma}\left(t\_1, t\_2, t\_0\right)\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)}{t\_3} - \frac{t\_1 \cdot \left(t\_1 \cdot t\_1\right)}{t\_3}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_2, t\_1\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot t\_0}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_0 \cdot \left(a \cdot t\_0\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* b (* b b)))
        (t_1 (fma a (* c -3.0) (* b b)))
        (t_2 (sqrt t_1))
        (t_3 (fma t_1 t_2 t_0)))
   (if (<= b 0.056)
     (/
      (/
       (- (/ (* (* b b) (* (* b b) (* b b))) t_3) (/ (* t_1 (* t_1 t_1)) t_3))
       (* a (fma b b (fma b t_2 t_1))))
      -3.0)
     (/
      (+
       (fma
        -0.5625
        (/ (* a (* a (* c (* c c)))) (* b t_0))
        (fma
         a
         (/ (* (* c c) -0.375) (* b b))
         (/
          (*
           6.328125
           (*
            -0.16666666666666666
            (* (* c c) (* (* c c) (* a (* a (* a a)))))))
          (* t_0 (* a t_0)))))
       (* c -0.5))
      b))))
double code(double a, double b, double c) {
	double t_0 = b * (b * b);
	double t_1 = fma(a, (c * -3.0), (b * b));
	double t_2 = sqrt(t_1);
	double t_3 = fma(t_1, t_2, t_0);
	double tmp;
	if (b <= 0.056) {
		tmp = (((((b * b) * ((b * b) * (b * b))) / t_3) - ((t_1 * (t_1 * t_1)) / t_3)) / (a * fma(b, b, fma(b, t_2, t_1)))) / -3.0;
	} else {
		tmp = (fma(-0.5625, ((a * (a * (c * (c * c)))) / (b * t_0)), fma(a, (((c * c) * -0.375) / (b * b)), ((6.328125 * (-0.16666666666666666 * ((c * c) * ((c * c) * (a * (a * (a * a))))))) / (t_0 * (a * t_0))))) + (c * -0.5)) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(b * Float64(b * b))
	t_1 = fma(a, Float64(c * -3.0), Float64(b * b))
	t_2 = sqrt(t_1)
	t_3 = fma(t_1, t_2, t_0)
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(b * b) * Float64(Float64(b * b) * Float64(b * b))) / t_3) - Float64(Float64(t_1 * Float64(t_1 * t_1)) / t_3)) / Float64(a * fma(b, b, fma(b, t_2, t_1)))) / -3.0);
	else
		tmp = Float64(Float64(fma(-0.5625, Float64(Float64(a * Float64(a * Float64(c * Float64(c * c)))) / Float64(b * t_0)), fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * b)), Float64(Float64(6.328125 * Float64(-0.16666666666666666 * Float64(Float64(c * c) * Float64(Float64(c * c) * Float64(a * Float64(a * Float64(a * a))))))) / Float64(t_0 * Float64(a * t_0))))) + Float64(c * -0.5)) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$2 + t$95$0), $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(N[(N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] - N[(N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b * b + N[(b * t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision], N[(N[(N[(-0.5625 * N[(N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(6.328125 * N[(-0.16666666666666666 * N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(a * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
t_1 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
t_2 := \sqrt{t\_1}\\
t_3 := \mathsf{fma}\left(t\_1, t\_2, t\_0\right)\\
\mathbf{if}\;b \leq 0.056:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)}{t\_3} - \frac{t\_1 \cdot \left(t\_1 \cdot t\_1\right)}{t\_3}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, t\_2, t\_1\right)\right)}}{-3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot t\_0}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_0 \cdot \left(a \cdot t\_0\right)}\right)\right) + c \cdot -0.5}{b}\\


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

    1. Initial program 88.9%

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

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
    4. Applied rewrites92.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
    5. Applied rewrites92.9%

      \[\leadsto \frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right) \cdot 6.328125}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot a\right)}\right)\right) + c \cdot -0.5}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right), \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, b \cdot \left(b \cdot b\right)\right)} - \frac{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)}{\mathsf{fma}\left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right), \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, b \cdot \left(b \cdot b\right)\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(a \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 92.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ t_1 := b \cdot t\_0\\ t_2 := \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\\ t_3 := \sqrt{t\_2}\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\left(b \cdot b\right) \cdot t\_1 - t\_2 \cdot \left(t\_2 \cdot t\_2\right)}{\left(a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + t\_3\right), c \cdot \left(a \cdot -3\right)\right)\right)\right) \cdot \mathsf{fma}\left(t\_2, t\_3, t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{t\_1}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_0 \cdot \left(a \cdot t\_0\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* b (* b b)))
        (t_1 (* b t_0))
        (t_2 (fma c (* a -3.0) (* b b)))
        (t_3 (sqrt t_2)))
   (if (<= b 0.056)
     (/
      (- (* (* b b) t_1) (* t_2 (* t_2 t_2)))
      (*
       (* a (* -3.0 (fma b (+ b (+ b t_3)) (* c (* a -3.0)))))
       (fma t_2 t_3 t_0)))
     (/
      (+
       (fma
        -0.5625
        (/ (* a (* a (* c (* c c)))) t_1)
        (fma
         a
         (/ (* (* c c) -0.375) (* b b))
         (/
          (*
           6.328125
           (*
            -0.16666666666666666
            (* (* c c) (* (* c c) (* a (* a (* a a)))))))
          (* t_0 (* a t_0)))))
       (* c -0.5))
      b))))
double code(double a, double b, double c) {
	double t_0 = b * (b * b);
	double t_1 = b * t_0;
	double t_2 = fma(c, (a * -3.0), (b * b));
	double t_3 = sqrt(t_2);
	double tmp;
	if (b <= 0.056) {
		tmp = (((b * b) * t_1) - (t_2 * (t_2 * t_2))) / ((a * (-3.0 * fma(b, (b + (b + t_3)), (c * (a * -3.0))))) * fma(t_2, t_3, t_0));
	} else {
		tmp = (fma(-0.5625, ((a * (a * (c * (c * c)))) / t_1), fma(a, (((c * c) * -0.375) / (b * b)), ((6.328125 * (-0.16666666666666666 * ((c * c) * ((c * c) * (a * (a * (a * a))))))) / (t_0 * (a * t_0))))) + (c * -0.5)) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(b * Float64(b * b))
	t_1 = Float64(b * t_0)
	t_2 = fma(c, Float64(a * -3.0), Float64(b * b))
	t_3 = sqrt(t_2)
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(Float64(b * b) * t_1) - Float64(t_2 * Float64(t_2 * t_2))) / Float64(Float64(a * Float64(-3.0 * fma(b, Float64(b + Float64(b + t_3)), Float64(c * Float64(a * -3.0))))) * fma(t_2, t_3, t_0)));
	else
		tmp = Float64(Float64(fma(-0.5625, Float64(Float64(a * Float64(a * Float64(c * Float64(c * c)))) / t_1), fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * b)), Float64(Float64(6.328125 * Float64(-0.16666666666666666 * Float64(Float64(c * c) * Float64(Float64(c * c) * Float64(a * Float64(a * Float64(a * a))))))) / Float64(t_0 * Float64(a * t_0))))) + Float64(c * -0.5)) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(c * N[(a * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[t$95$2], $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(N[(b * b), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(t$95$2 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * N[(-3.0 * N[(b * N[(b + N[(b + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * t$95$3 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.5625 * N[(N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(6.328125 * N[(-0.16666666666666666 * N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(a * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
t_1 := b \cdot t\_0\\
t_2 := \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\\
t_3 := \sqrt{t\_2}\\
\mathbf{if}\;b \leq 0.056:\\
\;\;\;\;\frac{\left(b \cdot b\right) \cdot t\_1 - t\_2 \cdot \left(t\_2 \cdot t\_2\right)}{\left(a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + t\_3\right), c \cdot \left(a \cdot -3\right)\right)\right)\right) \cdot \mathsf{fma}\left(t\_2, t\_3, t\_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{t\_1}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_0 \cdot \left(a \cdot t\_0\right)}\right)\right) + c \cdot -0.5}{b}\\


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

    1. Initial program 88.9%

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

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

      \[\leadsto \frac{\color{blue}{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}}{-3} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}{-3}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)}}}{-3} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{b \cdot \left(b \cdot b\right) - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{-3 \cdot \left(a \cdot \mathsf{fma}\left(b, b, \mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}, \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)\right)\right)}} \]
      4. lower-/.f64N/A

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
    4. Applied rewrites92.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
    5. Applied rewrites92.9%

      \[\leadsto \frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right) \cdot 6.328125}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot a\right)}\right)\right) + c \cdot -0.5}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) - \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right) \cdot \mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}{\left(a \cdot \left(-3 \cdot \mathsf{fma}\left(b, b + \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}\right), c \cdot \left(a \cdot -3\right)\right)\right)\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right), \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}, b \cdot \left(b \cdot b\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(a \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 92.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ t_1 := b \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot t\_1}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_1 \cdot \left(a \cdot t\_1\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b))) (t_1 (* b (* b b))))
   (if (<= b 0.056)
     (/ (- (* b b) t_0) (* (* a -3.0) (+ b (sqrt t_0))))
     (/
      (+
       (fma
        -0.5625
        (/ (* a (* a (* c (* c c)))) (* b t_1))
        (fma
         a
         (/ (* (* c c) -0.375) (* b b))
         (/
          (*
           6.328125
           (*
            -0.16666666666666666
            (* (* c c) (* (* c c) (* a (* a (* a a)))))))
          (* t_1 (* a t_1)))))
       (* c -0.5))
      b))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double t_1 = b * (b * b);
	double tmp;
	if (b <= 0.056) {
		tmp = ((b * b) - t_0) / ((a * -3.0) * (b + sqrt(t_0)));
	} else {
		tmp = (fma(-0.5625, ((a * (a * (c * (c * c)))) / (b * t_1)), fma(a, (((c * c) * -0.375) / (b * b)), ((6.328125 * (-0.16666666666666666 * ((c * c) * ((c * c) * (a * (a * (a * a))))))) / (t_1 * (a * t_1))))) + (c * -0.5)) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	t_1 = Float64(b * Float64(b * b))
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(b * b) - t_0) / Float64(Float64(a * -3.0) * Float64(b + sqrt(t_0))));
	else
		tmp = Float64(Float64(fma(-0.5625, Float64(Float64(a * Float64(a * Float64(c * Float64(c * c)))) / Float64(b * t_1)), fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * b)), Float64(Float64(6.328125 * Float64(-0.16666666666666666 * Float64(Float64(c * c) * Float64(Float64(c * c) * Float64(a * Float64(a * Float64(a * a))))))) / Float64(t_1 * Float64(a * t_1))))) + Float64(c * -0.5)) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(a * -3.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.5625 * N[(N[(a * N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(6.328125 * N[(-0.16666666666666666 * N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(a * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot t\_1}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{t\_1 \cdot \left(a \cdot t\_1\right)}\right)\right) + c \cdot -0.5}{b}\\


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

    1. Initial program 88.9%

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
    4. Applied rewrites92.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
    5. Applied rewrites92.9%

      \[\leadsto \frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right) \cdot 6.328125}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot a\right)}\right)\right) + c \cdot -0.5}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{6.328125 \cdot \left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(a \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)}\right)\right) + c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 92.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ t_1 := \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, -0.5625 \cdot \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{t\_1}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot t\_1\right)}\right)\right)\right)}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b))) (t_1 (* (* b b) (* b b))))
   (if (<= b 0.056)
     (/ (- (* b b) t_0) (* (* a -3.0) (+ b (sqrt t_0))))
     (/
      (fma
       c
       -0.5
       (fma
        a
        (* -0.5625 (/ (* a (* c (* c c))) t_1))
        (fma
         a
         (/ (* (* c c) -0.375) (* b b))
         (/
          (* (* (* c c) (* (* c c) (* a (* a (* a a))))) -1.0546875)
          (* a (* (* b b) t_1))))))
      b))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double t_1 = (b * b) * (b * b);
	double tmp;
	if (b <= 0.056) {
		tmp = ((b * b) - t_0) / ((a * -3.0) * (b + sqrt(t_0)));
	} else {
		tmp = fma(c, -0.5, fma(a, (-0.5625 * ((a * (c * (c * c))) / t_1)), fma(a, (((c * c) * -0.375) / (b * b)), ((((c * c) * ((c * c) * (a * (a * (a * a))))) * -1.0546875) / (a * ((b * b) * t_1)))))) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	t_1 = Float64(Float64(b * b) * Float64(b * b))
	tmp = 0.0
	if (b <= 0.056)
		tmp = Float64(Float64(Float64(b * b) - t_0) / Float64(Float64(a * -3.0) * Float64(b + sqrt(t_0))));
	else
		tmp = Float64(fma(c, -0.5, fma(a, Float64(-0.5625 * Float64(Float64(a * Float64(c * Float64(c * c))) / t_1)), fma(a, Float64(Float64(Float64(c * c) * -0.375) / Float64(b * b)), Float64(Float64(Float64(Float64(c * c) * Float64(Float64(c * c) * Float64(a * Float64(a * Float64(a * a))))) * -1.0546875) / Float64(a * Float64(Float64(b * b) * t_1)))))) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 0.056], N[(N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(a * -3.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5 + N[(a * N[(-0.5625 * N[(N[(a * N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(N[(c * c), $MachinePrecision] * -0.375), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -1.0546875), $MachinePrecision] / N[(a * N[(N[(b * b), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, -0.5625 \cdot \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{t\_1}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot t\_1\right)}\right)\right)\right)}{b}\\


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

    1. Initial program 88.9%

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

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

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

    if 0.0560000000000000012 < b

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
    4. Applied rewrites92.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
    5. Applied rewrites92.9%

      \[\leadsto \frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(-0.16666666666666666 \cdot \left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right)\right) \cdot 6.328125}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot a\right)}\right)\right) + c \cdot -0.5}{b} \]
    6. Applied rewrites92.9%

      \[\leadsto \frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} \cdot -0.5625, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right)}\right)\right)\right)}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.056:\\ \;\;\;\;\frac{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, -0.5, \mathsf{fma}\left(a, -0.5625 \cdot \frac{a \cdot \left(c \cdot \left(c \cdot c\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, \frac{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\right)\right) \cdot -1.0546875}{a \cdot \left(\left(b \cdot b\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right)}\right)\right)\right)}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 90.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;b \leq 0.112:\\ \;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(c, \mathsf{fma}\left(c \cdot -3, \frac{a \cdot a}{b \cdot \left(b \cdot b\right)} \cdot -0.375, \frac{a}{b} \cdot 1.5\right), b \cdot -2\right)}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b))))
   (if (<= b 0.112)
     (/ (- (* b b) t_0) (* (* a -3.0) (+ b (sqrt t_0))))
     (/
      1.0
      (/
       (fma
        c
        (fma (* c -3.0) (* (/ (* a a) (* b (* b b))) -0.375) (* (/ a b) 1.5))
        (* b -2.0))
       c)))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double tmp;
	if (b <= 0.112) {
		tmp = ((b * b) - t_0) / ((a * -3.0) * (b + sqrt(t_0)));
	} else {
		tmp = 1.0 / (fma(c, fma((c * -3.0), (((a * a) / (b * (b * b))) * -0.375), ((a / b) * 1.5)), (b * -2.0)) / c);
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	tmp = 0.0
	if (b <= 0.112)
		tmp = Float64(Float64(Float64(b * b) - t_0) / Float64(Float64(a * -3.0) * Float64(b + sqrt(t_0))));
	else
		tmp = Float64(1.0 / Float64(fma(c, fma(Float64(c * -3.0), Float64(Float64(Float64(a * a) / Float64(b * Float64(b * b))) * -0.375), Float64(Float64(a / b) * 1.5)), Float64(b * -2.0)) / c));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 0.112], N[(N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(a * -3.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(c * N[(N[(c * -3.0), $MachinePrecision] * N[(N[(N[(a * a), $MachinePrecision] / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] + N[(b * -2.0), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
\mathbf{if}\;b \leq 0.112:\\
\;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\

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


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

    1. Initial program 87.3%

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

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

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

    if 0.112000000000000002 < b

    1. Initial program 52.5%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in c around 0

      \[\leadsto \frac{1}{\color{blue}{\frac{-2 \cdot b + c \cdot \left(-3 \cdot \left(c \cdot \left(\frac{-3}{4} \cdot \frac{{a}^{2}}{{b}^{3}} + \frac{3}{8} \cdot \frac{{a}^{2}}{{b}^{3}}\right)\right) + \frac{3}{2} \cdot \frac{a}{b}\right)}{c}}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.112:\\ \;\;\;\;\frac{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(c, \mathsf{fma}\left(c \cdot -3, \frac{a \cdot a}{b \cdot \left(b \cdot b\right)} \cdot -0.375, \frac{a}{b} \cdot 1.5\right), b \cdot -2\right)}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 90.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;b \leq 0.112:\\ \;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot -3, \frac{c}{b \cdot \left(b \cdot b\right)} \cdot -0.375, \frac{1.5}{b}\right), \frac{b \cdot -2}{c}\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b))))
   (if (<= b 0.112)
     (/ (- (* b b) t_0) (* (* a -3.0) (+ b (sqrt t_0))))
     (/
      1.0
      (fma
       a
       (fma (* a -3.0) (* (/ c (* b (* b b))) -0.375) (/ 1.5 b))
       (/ (* b -2.0) c))))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double tmp;
	if (b <= 0.112) {
		tmp = ((b * b) - t_0) / ((a * -3.0) * (b + sqrt(t_0)));
	} else {
		tmp = 1.0 / fma(a, fma((a * -3.0), ((c / (b * (b * b))) * -0.375), (1.5 / b)), ((b * -2.0) / c));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	tmp = 0.0
	if (b <= 0.112)
		tmp = Float64(Float64(Float64(b * b) - t_0) / Float64(Float64(a * -3.0) * Float64(b + sqrt(t_0))));
	else
		tmp = Float64(1.0 / fma(a, fma(Float64(a * -3.0), Float64(Float64(c / Float64(b * Float64(b * b))) * -0.375), Float64(1.5 / b)), Float64(Float64(b * -2.0) / c)));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 0.112], N[(N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(a * -3.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(N[(a * -3.0), $MachinePrecision] * N[(N[(c / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision] + N[(1.5 / b), $MachinePrecision]), $MachinePrecision] + N[(N[(b * -2.0), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
\mathbf{if}\;b \leq 0.112:\\
\;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\

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


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

    1. Initial program 87.3%

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

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

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

    if 0.112000000000000002 < b

    1. Initial program 52.5%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + a \cdot \left(-3 \cdot \left(a \cdot \left(\frac{-3}{4} \cdot \frac{c}{{b}^{3}} + \frac{3}{8} \cdot \frac{c}{{b}^{3}}\right)\right) + \frac{3}{2} \cdot \frac{1}{b}\right)}} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{\color{blue}{a \cdot \left(-3 \cdot \left(a \cdot \left(\frac{-3}{4} \cdot \frac{c}{{b}^{3}} + \frac{3}{8} \cdot \frac{c}{{b}^{3}}\right)\right) + \frac{3}{2} \cdot \frac{1}{b}\right) + -2 \cdot \frac{b}{c}}} \]
      2. lower-fma.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.112:\\ \;\;\;\;\frac{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot -3, \frac{c}{b \cdot \left(b \cdot b\right)} \cdot -0.375, \frac{1.5}{b}\right), \frac{b \cdot -2}{c}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 85.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;b \leq 214:\\ \;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma a (* c -3.0) (* b b))))
   (if (<= b 214.0)
     (/ (- (* b b) t_0) (* (* a -3.0) (+ b (sqrt t_0))))
     (/ 1.0 (fma -2.0 (/ b c) (* (/ a b) 1.5))))))
double code(double a, double b, double c) {
	double t_0 = fma(a, (c * -3.0), (b * b));
	double tmp;
	if (b <= 214.0) {
		tmp = ((b * b) - t_0) / ((a * -3.0) * (b + sqrt(t_0)));
	} else {
		tmp = 1.0 / fma(-2.0, (b / c), ((a / b) * 1.5));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(a, Float64(c * -3.0), Float64(b * b))
	tmp = 0.0
	if (b <= 214.0)
		tmp = Float64(Float64(Float64(b * b) - t_0) / Float64(Float64(a * -3.0) * Float64(b + sqrt(t_0))));
	else
		tmp = Float64(1.0 / fma(-2.0, Float64(b / c), Float64(Float64(a / b) * 1.5)));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 214.0], N[(N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(a * -3.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
\mathbf{if}\;b \leq 214:\\
\;\;\;\;\frac{b \cdot b - t\_0}{\left(a \cdot -3\right) \cdot \left(b + \sqrt{t\_0}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\


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

    1. Initial program 79.3%

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

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

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

    if 214 < b

    1. Initial program 44.2%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \frac{3}{2} \cdot \frac{a}{b}}} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{3}{2} \cdot \frac{a}{b}\right)}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \color{blue}{\frac{b}{c}}, \frac{3}{2} \cdot \frac{a}{b}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{3}{2} \cdot \frac{a}{b}}\right)} \]
      4. lower-/.f6491.0

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \color{blue}{\frac{a}{b}}\right)} \]
    7. Applied rewrites91.0%

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

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

Alternative 13: 85.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 61:\\ \;\;\;\;\frac{-1}{\frac{a}{0.3333333333333333 \cdot \left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 61.0)
   (/
    -1.0
    (/ a (* 0.3333333333333333 (- b (sqrt (fma a (* c -3.0) (* b b)))))))
   (/ 1.0 (fma -2.0 (/ b c) (* (/ a b) 1.5)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 61.0) {
		tmp = -1.0 / (a / (0.3333333333333333 * (b - sqrt(fma(a, (c * -3.0), (b * b))))));
	} else {
		tmp = 1.0 / fma(-2.0, (b / c), ((a / b) * 1.5));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 61.0)
		tmp = Float64(-1.0 / Float64(a / Float64(0.3333333333333333 * Float64(b - sqrt(fma(a, Float64(c * -3.0), Float64(b * b)))))));
	else
		tmp = Float64(1.0 / fma(-2.0, Float64(b / c), Float64(Float64(a / b) * 1.5)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 61.0], N[(-1.0 / N[(a / N[(0.3333333333333333 * N[(b - N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\


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

    1. Initial program 80.0%

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

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

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

    if 61 < b

    1. Initial program 46.1%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \frac{3}{2} \cdot \frac{a}{b}}} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{3}{2} \cdot \frac{a}{b}\right)}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \color{blue}{\frac{b}{c}}, \frac{3}{2} \cdot \frac{a}{b}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{3}{2} \cdot \frac{a}{b}}\right)} \]
      4. lower-/.f6490.1

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \color{blue}{\frac{a}{b}}\right)} \]
    7. Applied rewrites90.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 61:\\ \;\;\;\;\frac{-1}{\frac{a}{0.3333333333333333 \cdot \left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 85.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 61:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 61.0)
   (* 0.3333333333333333 (/ (- (sqrt (fma a (* c -3.0) (* b b))) b) a))
   (/ 1.0 (fma -2.0 (/ b c) (* (/ a b) 1.5)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 61.0) {
		tmp = 0.3333333333333333 * ((sqrt(fma(a, (c * -3.0), (b * b))) - b) / a);
	} else {
		tmp = 1.0 / fma(-2.0, (b / c), ((a / b) * 1.5));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 61.0)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(fma(a, Float64(c * -3.0), Float64(b * b))) - b) / a));
	else
		tmp = Float64(1.0 / fma(-2.0, Float64(b / c), Float64(Float64(a / b) * 1.5)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 61.0], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\


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

    1. Initial program 80.0%

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

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

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

    if 61 < b

    1. Initial program 46.1%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \frac{3}{2} \cdot \frac{a}{b}}} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{3}{2} \cdot \frac{a}{b}\right)}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \color{blue}{\frac{b}{c}}, \frac{3}{2} \cdot \frac{a}{b}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{3}{2} \cdot \frac{a}{b}}\right)} \]
      4. lower-/.f6490.1

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \color{blue}{\frac{a}{b}}\right)} \]
    7. Applied rewrites90.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 61:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 85.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 61:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 61.0)
   (* (/ -0.3333333333333333 a) (- b (sqrt (fma a (* c -3.0) (* b b)))))
   (/ 1.0 (fma -2.0 (/ b c) (* (/ a b) 1.5)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 61.0) {
		tmp = (-0.3333333333333333 / a) * (b - sqrt(fma(a, (c * -3.0), (b * b))));
	} else {
		tmp = 1.0 / fma(-2.0, (b / c), ((a / b) * 1.5));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 61.0)
		tmp = Float64(Float64(-0.3333333333333333 / a) * Float64(b - sqrt(fma(a, Float64(c * -3.0), Float64(b * b)))));
	else
		tmp = Float64(1.0 / fma(-2.0, Float64(b / c), Float64(Float64(a / b) * 1.5)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 61.0], N[(N[(-0.3333333333333333 / a), $MachinePrecision] * N[(b - N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\


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

    1. Initial program 80.0%

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

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

    if 61 < b

    1. Initial program 46.1%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
    5. Taylor expanded in a around 0

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \frac{3}{2} \cdot \frac{a}{b}}} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{3}{2} \cdot \frac{a}{b}\right)}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \color{blue}{\frac{b}{c}}, \frac{3}{2} \cdot \frac{a}{b}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{3}{2} \cdot \frac{a}{b}}\right)} \]
      4. lower-/.f6490.1

        \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \color{blue}{\frac{a}{b}}\right)} \]
    7. Applied rewrites90.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 61:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 82.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 1.0 (fma -2.0 (/ b c) (* (/ a b) 1.5))))
double code(double a, double b, double c) {
	return 1.0 / fma(-2.0, (b / c), ((a / b) * 1.5));
}
function code(a, b, c)
	return Float64(1.0 / fma(-2.0, Float64(b / c), Float64(Float64(a / b) * 1.5)))
end
code[a_, b_, c_] := N[(1.0 / N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)}
\end{array}
Derivation
  1. Initial program 56.1%

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 3}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}} \]
  5. Taylor expanded in a around 0

    \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \frac{3}{2} \cdot \frac{a}{b}}} \]
  6. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{3}{2} \cdot \frac{a}{b}\right)}} \]
    2. lower-/.f64N/A

      \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \color{blue}{\frac{b}{c}}, \frac{3}{2} \cdot \frac{a}{b}\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{3}{2} \cdot \frac{a}{b}}\right)} \]
    4. lower-/.f6481.8

      \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \color{blue}{\frac{a}{b}}\right)} \]
  7. Applied rewrites81.8%

    \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, 1.5 \cdot \frac{a}{b}\right)}} \]
  8. Final simplification81.8%

    \[\leadsto \frac{1}{\mathsf{fma}\left(-2, \frac{b}{c}, \frac{a}{b} \cdot 1.5\right)} \]
  9. Add Preprocessing

Alternative 17: 81.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{c \cdot \mathsf{fma}\left(-0.375, a \cdot \frac{c}{b \cdot b}, -0.5\right)}{b} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (* c (fma -0.375 (* a (/ c (* b b))) -0.5)) b))
double code(double a, double b, double c) {
	return (c * fma(-0.375, (a * (c / (b * b))), -0.5)) / b;
}
function code(a, b, c)
	return Float64(Float64(c * fma(-0.375, Float64(a * Float64(c / Float64(b * b))), -0.5)) / b)
end
code[a_, b_, c_] := N[(N[(c * N[(-0.375 * N[(a * N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}

\\
\frac{c \cdot \mathsf{fma}\left(-0.375, a \cdot \frac{c}{b \cdot b}, -0.5\right)}{b}
\end{array}
Derivation
  1. Initial program 56.1%

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

    \[\leadsto \color{blue}{\frac{\frac{-9}{16} \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\frac{-1}{2} \cdot c + \left(\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{6} \cdot \frac{\frac{81}{64} \cdot \left({a}^{4} \cdot {c}^{4}\right) + \frac{81}{16} \cdot \left({a}^{4} \cdot {c}^{4}\right)}{a \cdot {b}^{6}}\right)\right)}{b}} \]
  4. Applied rewrites90.9%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.5625, \frac{a \cdot \left(a \cdot \left(c \cdot \left(c \cdot c\right)\right)\right)}{{b}^{4}}, \mathsf{fma}\left(-0.16666666666666666, \left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{6}}, \mathsf{fma}\left(a, \frac{\left(c \cdot c\right) \cdot -0.375}{b \cdot b}, c \cdot -0.5\right)\right)\right)}{b}} \]
  5. Taylor expanded in c around 0

    \[\leadsto \frac{c \cdot \left(\frac{-3}{8} \cdot \frac{a \cdot c}{{b}^{2}} - \frac{1}{2}\right)}{b} \]
  6. Step-by-step derivation
    1. Applied rewrites81.1%

      \[\leadsto \frac{c \cdot \mathsf{fma}\left(-0.375, a \cdot \frac{c}{b \cdot b}, -0.5\right)}{b} \]
    2. Add Preprocessing

    Alternative 18: 64.8% accurate, 2.9× 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 56.1%

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}} \]
      2. lower-/.f6464.1

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    6. Add Preprocessing

    Reproduce

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