\[\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)\]
Math FPCore C Julia Wolfram TeX \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\]
↓
\[\begin{array}{l}
t_0 := \sqrt[3]{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)}}\\
\frac{\frac{\frac{-3 \cdot \left(c \cdot a\right)}{{t_0}^{2}}}{t_0}}{a \cdot 3}
\end{array}
\]
(FPCore (a b c)
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a))) ↓
(FPCore (a b c)
:precision binary64
(let* ((t_0 (cbrt (+ b (sqrt (fma b b (* c (* -3.0 a))))))))
(/ (/ (/ (* -3.0 (* c a)) (pow t_0 2.0)) t_0) (* a 3.0)))) double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
↓
double code(double a, double b, double c) {
double t_0 = cbrt((b + sqrt(fma(b, b, (c * (-3.0 * a))))));
return (((-3.0 * (c * a)) / pow(t_0, 2.0)) / t_0) / (a * 3.0);
}
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 code(a, b, c)
t_0 = cbrt(Float64(b + sqrt(fma(b, b, Float64(c * Float64(-3.0 * a))))))
return Float64(Float64(Float64(Float64(-3.0 * Float64(c * a)) / (t_0 ^ 2.0)) / t_0) / Float64(a * 3.0))
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]
↓
code[a_, b_, c_] := Block[{t$95$0 = N[Power[N[(b + N[Sqrt[N[(b * b + N[(c * N[(-3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(N[(N[(-3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
↓
\begin{array}{l}
t_0 := \sqrt[3]{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)}}\\
\frac{\frac{\frac{-3 \cdot \left(c \cdot a\right)}{{t_0}^{2}}}{t_0}}{a \cdot 3}
\end{array}
Alternatives Alternative 1 Error 6.4 Cost 41028
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(a, -3 \cdot c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1:\\
\;\;\;\;\frac{e^{\log \left(\frac{b \cdot b - t_0}{b + \sqrt{t_0}}\right)}}{a} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\\
\end{array}
\]
Alternative 2 Error 6.4 Cost 40964
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(a, -3 \cdot c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1:\\
\;\;\;\;\frac{b \cdot b - t_0}{a} \cdot \frac{-0.3333333333333333}{b + \sqrt{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\\
\end{array}
\]
Alternative 3 Error 9.0 Cost 28228
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(a, -3 \cdot c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.00395:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b \cdot b - t_0}{a \cdot \left(b + \sqrt{t_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right)\\
\end{array}
\]
Alternative 4 Error 9.0 Cost 28228
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(a, -3 \cdot c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.00395:\\
\;\;\;\;\frac{b \cdot b - t_0}{a} \cdot \frac{-0.3333333333333333}{b + \sqrt{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right)\\
\end{array}
\]
Alternative 5 Error 9.2 Cost 21124
\[\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.00395:\\
\;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right)\\
\end{array}
\]
Alternative 6 Error 14.8 Cost 21060
\[\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1.65 \cdot 10^{-6}:\\
\;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{\mathsf{fma}\left(a, -3 \cdot c, b \cdot b\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\]
Alternative 7 Error 14.7 Cost 21060
\[\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1.65 \cdot 10^{-6}:\\
\;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\]
Alternative 8 Error 14.8 Cost 14788
\[\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1.65 \cdot 10^{-6}:\\
\;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{b \cdot b + a \cdot \left(-3 \cdot c\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\]
Alternative 9 Error 22.5 Cost 320
\[-0.5 \cdot \frac{c}{b}
\]