
(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:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (a b c) :precision binary64 (if (<= b -1.7e-53) (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0))))) (* 0.3333333333333333 (/ (- (hypot b (sqrt (* a (* c -3.0)))) b) a))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e-53) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else {
tmp = 0.3333333333333333 * ((hypot(b, sqrt((a * (c * -3.0)))) - b) / a);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e-53) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else {
tmp = 0.3333333333333333 * ((Math.hypot(b, Math.sqrt((a * (c * -3.0)))) - b) / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.7e-53: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) else: tmp = 0.3333333333333333 * ((math.hypot(b, math.sqrt((a * (c * -3.0)))) - b) / a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.7e-53) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); else tmp = Float64(0.3333333333333333 * Float64(Float64(hypot(b, sqrt(Float64(a * Float64(c * -3.0)))) - b) / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.7e-53) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); else tmp = 0.3333333333333333 * ((hypot(b, sqrt((a * (c * -3.0)))) - b) / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.7e-53], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) - b}{a}\\
\end{array}
\end{array}
if b < -1.7e-53Initial program 65.7%
neg-sub065.7%
sqr-neg65.7%
associate-+l-65.7%
sub0-neg65.7%
sub-neg65.7%
distribute-neg-in65.7%
remove-double-neg65.7%
sqr-neg65.7%
associate-*l*65.7%
Simplified65.7%
Taylor expanded in b around -inf 92.9%
if -1.7e-53 < b Initial program 40.8%
neg-sub040.8%
sqr-neg40.8%
associate-+l-40.8%
sub0-neg40.8%
sub-neg40.8%
distribute-neg-in40.8%
remove-double-neg40.8%
sqr-neg40.8%
associate-*l*40.8%
Simplified40.8%
Applied egg-rr45.0%
un-div-inv45.1%
div-sub45.1%
div-sub41.9%
div-inv40.5%
metadata-eval40.5%
div-inv41.8%
metadata-eval41.8%
Applied egg-rr41.8%
Simplified45.0%
Final simplification61.6%
(FPCore (a b c) :precision binary64 (if (<= b -1.7e-53) (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0))))) (/ (- (exp (log (hypot b (sqrt (* a (* c -3.0)))))) b) (* a 3.0))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e-53) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else {
tmp = (exp(log(hypot(b, sqrt((a * (c * -3.0)))))) - b) / (a * 3.0);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e-53) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else {
tmp = (Math.exp(Math.log(Math.hypot(b, Math.sqrt((a * (c * -3.0)))))) - b) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.7e-53: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) else: tmp = (math.exp(math.log(math.hypot(b, math.sqrt((a * (c * -3.0)))))) - b) / (a * 3.0) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.7e-53) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); else tmp = Float64(Float64(exp(log(hypot(b, sqrt(Float64(a * Float64(c * -3.0)))))) - b) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.7e-53) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); else tmp = (exp(log(hypot(b, sqrt((a * (c * -3.0)))))) - b) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.7e-53], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[Log[N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} - b}{a \cdot 3}\\
\end{array}
\end{array}
if b < -1.7e-53Initial program 65.7%
neg-sub065.7%
sqr-neg65.7%
associate-+l-65.7%
sub0-neg65.7%
sub-neg65.7%
distribute-neg-in65.7%
remove-double-neg65.7%
sqr-neg65.7%
associate-*l*65.7%
Simplified65.7%
Taylor expanded in b around -inf 92.9%
if -1.7e-53 < b Initial program 40.8%
neg-sub040.8%
sqr-neg40.8%
associate-+l-40.8%
sub0-neg40.8%
sub-neg40.8%
distribute-neg-in40.8%
remove-double-neg40.8%
sqr-neg40.8%
associate-*l*40.8%
Simplified40.8%
sub-neg40.8%
sub-neg40.8%
*-commutative40.8%
cancel-sign-sub-inv40.8%
distribute-lft-neg-in40.8%
distribute-rgt-neg-in40.8%
metadata-eval40.8%
associate-*r*40.8%
fma-undefine40.8%
add-exp-log34.1%
fma-undefine34.1%
add-sqr-sqrt32.9%
hypot-define33.9%
Applied egg-rr33.9%
Final simplification54.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
(if (<= t_0 1e+273)
t_0
(*
b
(-
(fma
0.16666666666666666
(* c (/ -3.0 (pow b 2.0)))
(/ 0.6666666666666666 a)))))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
double tmp;
if (t_0 <= 1e+273) {
tmp = t_0;
} else {
tmp = b * -fma(0.16666666666666666, (c * (-3.0 / pow(b, 2.0))), (0.6666666666666666 / a));
}
return tmp;
}
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) tmp = 0.0 if (t_0 <= 1e+273) tmp = t_0; else tmp = Float64(b * Float64(-fma(0.16666666666666666, Float64(c * Float64(-3.0 / (b ^ 2.0))), Float64(0.6666666666666666 / a)))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+273], t$95$0, N[(b * (-N[(0.16666666666666666 * N[(c * N[(-3.0 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;t\_0 \leq 10^{+273}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(-\mathsf{fma}\left(0.16666666666666666, c \cdot \frac{-3}{{b}^{2}}, \frac{0.6666666666666666}{a}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 9.99999999999999945e272Initial program 58.1%
if 9.99999999999999945e272 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) Initial program 23.7%
neg-sub023.7%
sqr-neg23.7%
associate-+l-23.7%
sub0-neg23.7%
sub-neg23.7%
distribute-neg-in23.7%
remove-double-neg23.7%
sqr-neg23.7%
associate-*l*23.7%
Simplified23.7%
Applied egg-rr30.0%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
fma-define0.0%
associate-/l*0.0%
unpow20.0%
rem-square-sqrt39.1%
associate-*r/39.1%
metadata-eval39.1%
Simplified39.1%
Final simplification53.3%
(FPCore (a b c) :precision binary64 (if (<= b -2.8e-106) (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0))))) (* 0.3333333333333333 (/ (+ b (hypot b (sqrt (* a (* c -3.0))))) a))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.8e-106) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else {
tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((a * (c * -3.0))))) / a);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.8e-106) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else {
tmp = 0.3333333333333333 * ((b + Math.hypot(b, Math.sqrt((a * (c * -3.0))))) / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.8e-106: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) else: tmp = 0.3333333333333333 * ((b + math.hypot(b, math.sqrt((a * (c * -3.0))))) / a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.8e-106) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); else tmp = Float64(0.3333333333333333 * Float64(Float64(b + hypot(b, sqrt(Float64(a * Float64(c * -3.0))))) / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.8e-106) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); else tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((a * (c * -3.0))))) / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.8e-106], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{-106}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}\\
\end{array}
\end{array}
if b < -2.79999999999999988e-106Initial program 68.1%
neg-sub068.1%
sqr-neg68.1%
associate-+l-68.1%
sub0-neg68.1%
sub-neg68.1%
distribute-neg-in68.1%
remove-double-neg68.1%
sqr-neg68.1%
associate-*l*68.1%
Simplified68.1%
Taylor expanded in b around -inf 90.7%
if -2.79999999999999988e-106 < b Initial program 37.7%
neg-sub037.7%
sqr-neg37.7%
associate-+l-37.7%
sub0-neg37.7%
sub-neg37.7%
distribute-neg-in37.7%
remove-double-neg37.7%
sqr-neg37.7%
associate-*l*37.7%
Simplified37.7%
Applied egg-rr28.5%
*-commutative28.5%
associate-*l/28.5%
associate-*r/28.6%
Simplified28.6%
Final simplification52.6%
(FPCore (a b c) :precision binary64 (if (<= b -1.02e-102) (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0))))) (* 0.3333333333333333 (/ (+ b (hypot b (sqrt (* c (* a -3.0))))) a))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-102) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else {
tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((c * (a * -3.0))))) / a);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-102) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else {
tmp = 0.3333333333333333 * ((b + Math.hypot(b, Math.sqrt((c * (a * -3.0))))) / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.02e-102: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) else: tmp = 0.3333333333333333 * ((b + math.hypot(b, math.sqrt((c * (a * -3.0))))) / a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.02e-102) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); else tmp = Float64(0.3333333333333333 * Float64(Float64(b + hypot(b, sqrt(Float64(c * Float64(a * -3.0))))) / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.02e-102) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); else tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((c * (a * -3.0))))) / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-102], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-102}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}\\
\end{array}
\end{array}
if b < -1.01999999999999996e-102Initial program 68.1%
neg-sub068.1%
sqr-neg68.1%
associate-+l-68.1%
sub0-neg68.1%
sub-neg68.1%
distribute-neg-in68.1%
remove-double-neg68.1%
sqr-neg68.1%
associate-*l*68.1%
Simplified68.1%
Taylor expanded in b around -inf 90.7%
if -1.01999999999999996e-102 < b Initial program 37.7%
neg-sub037.7%
sqr-neg37.7%
associate-+l-37.7%
sub0-neg37.7%
sub-neg37.7%
distribute-neg-in37.7%
remove-double-neg37.7%
sqr-neg37.7%
associate-*l*37.7%
Simplified37.7%
Applied egg-rr28.5%
*-commutative28.5%
associate-*l/28.5%
associate-*r/28.6%
associate-*r*28.6%
*-commutative28.6%
associate-*r*28.6%
Simplified28.6%
Final simplification52.6%
(FPCore (a b c) :precision binary64 (if (<= b -1.06e-104) (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0))))) (* (/ 0.3333333333333333 a) (+ b (hypot b (sqrt (* a (* c -3.0))))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.06e-104) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else {
tmp = (0.3333333333333333 / a) * (b + hypot(b, sqrt((a * (c * -3.0)))));
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.06e-104) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else {
tmp = (0.3333333333333333 / a) * (b + Math.hypot(b, Math.sqrt((a * (c * -3.0)))));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.06e-104: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) else: tmp = (0.3333333333333333 / a) * (b + math.hypot(b, math.sqrt((a * (c * -3.0))))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.06e-104) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); else tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + hypot(b, sqrt(Float64(a * Float64(c * -3.0)))))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.06e-104) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); else tmp = (0.3333333333333333 / a) * (b + hypot(b, sqrt((a * (c * -3.0))))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.06e-104], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.06 \cdot 10^{-104}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)\\
\end{array}
\end{array}
if b < -1.06e-104Initial program 68.1%
neg-sub068.1%
sqr-neg68.1%
associate-+l-68.1%
sub0-neg68.1%
sub-neg68.1%
distribute-neg-in68.1%
remove-double-neg68.1%
sqr-neg68.1%
associate-*l*68.1%
Simplified68.1%
Taylor expanded in b around -inf 90.7%
if -1.06e-104 < b Initial program 37.7%
neg-sub037.7%
sqr-neg37.7%
associate-+l-37.7%
sub0-neg37.7%
sub-neg37.7%
distribute-neg-in37.7%
remove-double-neg37.7%
sqr-neg37.7%
associate-*l*37.7%
Simplified37.7%
Applied egg-rr28.5%
Final simplification52.5%
(FPCore (a b c) :precision binary64 (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (* a 3.0)))
double code(double a, double b, double c) {
return (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / (a * 3.0);
}
function code(a, b, c) return Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0)) end
code[a_, b_, c_] := N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{a \cdot 3}
\end{array}
Initial program 49.5%
/-rgt-identity49.5%
metadata-eval49.5%
Simplified49.5%
Final simplification49.5%
(FPCore (a b c) :precision binary64 (if (<= (* a 3.0) -2e-15) (/ (* -0.5 c) b) (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))))
double code(double a, double b, double c) {
double tmp;
if ((a * 3.0) <= -2e-15) {
tmp = (-0.5 * c) / b;
} else {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((a * 3.0d0) <= (-2d-15)) then
tmp = ((-0.5d0) * c) / b
else
tmp = (sqrt(((b * b) - (3.0d0 * (c * a)))) - b) / (a * 3.0d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if ((a * 3.0) <= -2e-15) {
tmp = (-0.5 * c) / b;
} else {
tmp = (Math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if (a * 3.0) <= -2e-15: tmp = (-0.5 * c) / b else: tmp = (math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0) return tmp
function code(a, b, c) tmp = 0.0 if (Float64(a * 3.0) <= -2e-15) tmp = Float64(Float64(-0.5 * c) / b); else tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if ((a * 3.0) <= -2e-15) tmp = (-0.5 * c) / b; else tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[N[(a * 3.0), $MachinePrecision], -2e-15], N[(N[(-0.5 * c), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 3 \leq -2 \cdot 10^{-15}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\end{array}
\end{array}
if (*.f64 #s(literal 3 binary64) a) < -2.0000000000000002e-15Initial program 28.6%
neg-sub028.6%
sqr-neg28.6%
associate-+l-28.6%
sub0-neg28.6%
sub-neg28.6%
distribute-neg-in28.6%
remove-double-neg28.6%
sqr-neg28.6%
associate-*l*28.5%
Simplified28.5%
Taylor expanded in b around inf 32.5%
*-commutative32.5%
*-commutative32.5%
times-frac32.4%
associate-/l*39.3%
*-un-lft-identity39.3%
times-frac32.4%
/-rgt-identity32.4%
metadata-eval32.4%
Applied egg-rr32.4%
Taylor expanded in a around 0 39.8%
*-commutative39.8%
associate-*l/39.8%
metadata-eval39.8%
rem-square-sqrt0.0%
unpow20.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt39.7%
metadata-eval39.7%
Simplified39.7%
associate-*r/39.8%
Applied egg-rr39.8%
if -2.0000000000000002e-15 < (*.f64 #s(literal 3 binary64) a) Initial program 55.8%
neg-sub055.8%
sqr-neg55.8%
associate-+l-55.8%
sub0-neg55.8%
sub-neg55.8%
distribute-neg-in55.8%
remove-double-neg55.8%
sqr-neg55.8%
associate-*l*55.7%
Simplified55.7%
Final simplification52.1%
(FPCore (a b c) :precision binary64 (if (<= c -3.4e-145) (* -0.5 (/ c b)) (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))))
double code(double a, double b, double c) {
double tmp;
if (c <= -3.4e-145) {
tmp = -0.5 * (c / b);
} else {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (c <= (-3.4d-145)) then
tmp = (-0.5d0) * (c / b)
else
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (c <= -3.4e-145) {
tmp = -0.5 * (c / b);
} else {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
}
return tmp;
}
def code(a, b, c): tmp = 0 if c <= -3.4e-145: tmp = -0.5 * (c / b) else: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) return tmp
function code(a, b, c) tmp = 0.0 if (c <= -3.4e-145) tmp = Float64(-0.5 * Float64(c / b)); else tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (c <= -3.4e-145) tmp = -0.5 * (c / b); else tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[c, -3.4e-145], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.4 \cdot 10^{-145}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\end{array}
\end{array}
if c < -3.3999999999999999e-145Initial program 42.3%
neg-sub042.3%
sqr-neg42.3%
associate-+l-42.3%
sub0-neg42.3%
sub-neg42.3%
distribute-neg-in42.3%
remove-double-neg42.3%
sqr-neg42.3%
associate-*l*42.3%
Simplified42.3%
Taylor expanded in b around inf 39.2%
*-commutative39.2%
Simplified39.2%
if -3.3999999999999999e-145 < c Initial program 53.1%
neg-sub053.1%
sqr-neg53.1%
associate-+l-53.1%
sub0-neg53.1%
sub-neg53.1%
distribute-neg-in53.1%
remove-double-neg53.1%
sqr-neg53.1%
associate-*l*53.1%
Simplified53.1%
Taylor expanded in b around -inf 42.9%
Final simplification41.6%
(FPCore (a b c) :precision binary64 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)))
double code(double a, double b, double c) {
return (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
end function
public static double code(double a, double b, double c) {
return (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
}
def code(a, b, c): return (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)
function code(a, b, c) return Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) end
function tmp = code(a, b, c) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); end
code[a_, b_, c_] := N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}
\end{array}
Initial program 49.5%
Final simplification49.5%
(FPCore (a b c) :precision binary64 (if (<= a 1.25e-241) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (a <= 1.25e-241) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (a <= 1.25d-241) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (a <= 1.25e-241) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if a <= 1.25e-241: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (a <= 1.25e-241) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (a <= 1.25e-241) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[a, 1.25e-241], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.25 \cdot 10^{-241}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if a < 1.25e-241Initial program 48.7%
neg-sub048.7%
sqr-neg48.7%
associate-+l-48.7%
sub0-neg48.7%
sub-neg48.7%
distribute-neg-in48.7%
remove-double-neg48.7%
sqr-neg48.7%
associate-*l*48.6%
Simplified48.6%
Taylor expanded in b around -inf 42.7%
*-commutative42.7%
Simplified42.7%
*-commutative42.7%
clear-num42.7%
un-div-inv43.9%
Applied egg-rr43.9%
associate-/r/43.9%
Simplified43.9%
if 1.25e-241 < a Initial program 50.4%
neg-sub050.4%
sqr-neg50.4%
associate-+l-50.4%
sub0-neg50.4%
sub-neg50.4%
distribute-neg-in50.4%
remove-double-neg50.4%
sqr-neg50.4%
associate-*l*50.4%
Simplified50.4%
Taylor expanded in b around inf 38.2%
*-commutative38.2%
Simplified38.2%
Final simplification41.2%
(FPCore (a b c) :precision binary64 (if (<= a -1.5e-19) (* -0.5 (/ c b)) (/ -0.6666666666666666 (/ a b))))
double code(double a, double b, double c) {
double tmp;
if (a <= -1.5e-19) {
tmp = -0.5 * (c / b);
} else {
tmp = -0.6666666666666666 / (a / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (a <= (-1.5d-19)) then
tmp = (-0.5d0) * (c / b)
else
tmp = (-0.6666666666666666d0) / (a / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (a <= -1.5e-19) {
tmp = -0.5 * (c / b);
} else {
tmp = -0.6666666666666666 / (a / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if a <= -1.5e-19: tmp = -0.5 * (c / b) else: tmp = -0.6666666666666666 / (a / b) return tmp
function code(a, b, c) tmp = 0.0 if (a <= -1.5e-19) tmp = Float64(-0.5 * Float64(c / b)); else tmp = Float64(-0.6666666666666666 / Float64(a / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (a <= -1.5e-19) tmp = -0.5 * (c / b); else tmp = -0.6666666666666666 / (a / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[a, -1.5e-19], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{-19}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\end{array}
\end{array}
if a < -1.49999999999999996e-19Initial program 30.4%
neg-sub030.4%
sqr-neg30.4%
associate-+l-30.4%
sub0-neg30.4%
sub-neg30.4%
distribute-neg-in30.4%
remove-double-neg30.4%
sqr-neg30.4%
associate-*l*30.4%
Simplified30.4%
Taylor expanded in b around inf 39.5%
*-commutative39.5%
Simplified39.5%
if -1.49999999999999996e-19 < a Initial program 55.6%
neg-sub055.6%
sqr-neg55.6%
associate-+l-55.6%
sub0-neg55.6%
sub-neg55.6%
distribute-neg-in55.6%
remove-double-neg55.6%
sqr-neg55.6%
associate-*l*55.6%
Simplified55.6%
Taylor expanded in b around -inf 40.3%
*-commutative40.3%
Simplified40.3%
*-commutative40.3%
clear-num40.3%
un-div-inv41.1%
Applied egg-rr41.1%
Final simplification40.7%
(FPCore (a b c) :precision binary64 (* c (/ -0.5 b)))
double code(double a, double b, double c) {
return c * (-0.5 / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c * ((-0.5d0) / b)
end function
public static double code(double a, double b, double c) {
return c * (-0.5 / b);
}
def code(a, b, c): return c * (-0.5 / b)
function code(a, b, c) return Float64(c * Float64(-0.5 / b)) end
function tmp = code(a, b, c) tmp = c * (-0.5 / b); end
code[a_, b_, c_] := N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \frac{-0.5}{b}
\end{array}
Initial program 49.5%
neg-sub049.5%
sqr-neg49.5%
associate-+l-49.5%
sub0-neg49.5%
sub-neg49.5%
distribute-neg-in49.5%
remove-double-neg49.5%
sqr-neg49.5%
associate-*l*49.5%
Simplified49.5%
Taylor expanded in b around inf 28.1%
*-commutative28.1%
*-commutative28.1%
times-frac28.1%
associate-/l*31.8%
*-un-lft-identity31.8%
times-frac30.9%
/-rgt-identity30.9%
metadata-eval30.9%
Applied egg-rr30.9%
Taylor expanded in a around 0 35.9%
*-commutative35.9%
associate-*l/35.9%
metadata-eval35.9%
rem-square-sqrt0.0%
unpow20.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt35.8%
metadata-eval35.8%
Simplified35.8%
Final simplification35.8%
(FPCore (a b c) :precision binary64 (* b (/ -0.6666666666666666 a)))
double code(double a, double b, double c) {
return b * (-0.6666666666666666 / 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 * ((-0.6666666666666666d0) / a)
end function
public static double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
def code(a, b, c): return b * (-0.6666666666666666 / a)
function code(a, b, c) return Float64(b * Float64(-0.6666666666666666 / a)) end
function tmp = code(a, b, c) tmp = b * (-0.6666666666666666 / a); end
code[a_, b_, c_] := N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Initial program 49.5%
neg-sub049.5%
sqr-neg49.5%
associate-+l-49.5%
sub0-neg49.5%
sub-neg49.5%
distribute-neg-in49.5%
remove-double-neg49.5%
sqr-neg49.5%
associate-*l*49.5%
Simplified49.5%
Taylor expanded in b around -inf 38.0%
*-commutative38.0%
Simplified38.0%
*-commutative38.0%
clear-num38.0%
un-div-inv38.6%
Applied egg-rr38.6%
associate-/r/38.6%
Simplified38.6%
Final simplification38.6%
(FPCore (a b c) :precision binary64 (/ b (* a -1.5)))
double code(double a, double b, double c) {
return b / (a * -1.5);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b / (a * (-1.5d0))
end function
public static double code(double a, double b, double c) {
return b / (a * -1.5);
}
def code(a, b, c): return b / (a * -1.5)
function code(a, b, c) return Float64(b / Float64(a * -1.5)) end
function tmp = code(a, b, c) tmp = b / (a * -1.5); end
code[a_, b_, c_] := N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a \cdot -1.5}
\end{array}
Initial program 49.5%
neg-sub049.5%
sqr-neg49.5%
associate-+l-49.5%
sub0-neg49.5%
sub-neg49.5%
distribute-neg-in49.5%
remove-double-neg49.5%
sqr-neg49.5%
associate-*l*49.5%
Simplified49.5%
Taylor expanded in b around -inf 38.0%
*-commutative38.0%
Simplified38.0%
*-commutative38.0%
clear-num38.0%
un-div-inv38.6%
Applied egg-rr38.6%
associate-/r/38.6%
Simplified38.6%
*-commutative38.6%
clear-num38.6%
un-div-inv38.7%
div-inv38.7%
metadata-eval38.7%
Applied egg-rr38.7%
Final simplification38.7%
herbie shell --seed 2024066
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))