
(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 12 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 -5.2e+25)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 9.2e-41)
(* (- b (hypot b (sqrt (* -3.0 (* a c))))) (/ -0.3333333333333333 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.2e+25) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 9.2e-41) {
tmp = (b - hypot(b, sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.2e+25) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 9.2e-41) {
tmp = (b - Math.hypot(b, Math.sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.2e+25: tmp = (b * -2.0) / (3.0 * a) elif b <= 9.2e-41: tmp = (b - math.hypot(b, math.sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.2e+25) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 9.2e-41) tmp = Float64(Float64(b - hypot(b, sqrt(Float64(-3.0 * Float64(a * c))))) * Float64(-0.3333333333333333 / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.2e+25) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 9.2e-41) tmp = (b - hypot(b, sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.2e+25], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-41], N[(N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.2 \cdot 10^{+25}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{-41}:\\
\;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{-3 \cdot \left(a \cdot c\right)}\right)\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.1999999999999997e25Initial program 56.2%
sqr-neg56.2%
sqr-neg56.2%
associate-*l*56.2%
Simplified56.2%
Taylor expanded in b around -inf 92.9%
*-commutative92.9%
Simplified92.9%
if -5.1999999999999997e25 < b < 9.20000000000000041e-41Initial program 72.1%
sqr-neg72.1%
sqr-neg72.1%
associate-*l*72.1%
Simplified72.1%
frac-2neg72.1%
div-inv72.0%
Applied egg-rr72.0%
Taylor expanded in a around 0 72.0%
fma-undefine72.0%
associate-*l*72.0%
*-commutative72.0%
add-sqr-sqrt70.1%
hypot-define73.2%
*-commutative73.2%
Applied egg-rr73.2%
if 9.20000000000000041e-41 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification84.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1.8e+54)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 2.7e-42)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.8e+54) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 2.7e-42) {
tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.8d+54)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 2.7d-42) then
tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.8e+54) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 2.7e-42) {
tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.8e+54: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 2.7e-42: tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.8e+54) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 2.7e-42) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.8e+54) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 2.7e-42) tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.8e+54], 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], If[LessEqual[b, 2.7e-42], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+54}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.8000000000000001e54Initial program 51.2%
sqr-neg51.2%
sqr-neg51.2%
associate-*l*51.2%
Simplified51.2%
Taylor expanded in b around -inf 95.1%
if -1.8000000000000001e54 < b < 2.69999999999999999e-42Initial program 73.4%
if 2.69999999999999999e-42 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification84.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.8e+54)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 2.7e-37)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.8e+54) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 2.7e-37) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.8d+54)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 2.7d-37) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.8e+54) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 2.7e-37) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.8e+54: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 2.7e-37: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.8e+54) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 2.7e-37) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.8e+54) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 2.7e-37) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.8e+54], 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], If[LessEqual[b, 2.7e-37], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+54}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-37}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.8000000000000001e54Initial program 51.2%
sqr-neg51.2%
sqr-neg51.2%
associate-*l*51.2%
Simplified51.2%
Taylor expanded in b around -inf 95.1%
if -1.8000000000000001e54 < b < 2.70000000000000016e-37Initial program 73.4%
sqr-neg73.4%
sqr-neg73.4%
associate-*l*73.4%
Simplified73.4%
if 2.70000000000000016e-37 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.7e-16)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 4.5e-37)
(/ (- (sqrt (* a (* -3.0 c))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.7e-16) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 4.5e-37) {
tmp = (sqrt((a * (-3.0 * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.7d-16)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 4.5d-37) then
tmp = (sqrt((a * ((-3.0d0) * c))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.7e-16) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 4.5e-37) {
tmp = (Math.sqrt((a * (-3.0 * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.7e-16: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 4.5e-37: tmp = (math.sqrt((a * (-3.0 * c))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.7e-16) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 4.5e-37) tmp = Float64(Float64(sqrt(Float64(a * Float64(-3.0 * c))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.7e-16) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 4.5e-37) tmp = (sqrt((a * (-3.0 * c))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.7e-16], 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], If[LessEqual[b, 4.5e-37], N[(N[(N[Sqrt[N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{-16}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 4.5 \cdot 10^{-37}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-3 \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -3.7e-16Initial program 60.5%
sqr-neg60.5%
sqr-neg60.5%
associate-*l*60.5%
Simplified60.5%
Taylor expanded in b around -inf 87.8%
if -3.7e-16 < b < 4.5000000000000004e-37Initial program 70.3%
sqr-neg70.3%
sqr-neg70.3%
associate-*l*70.2%
Simplified70.2%
Taylor expanded in b around 0 60.9%
*-commutative60.9%
associate-*l*60.9%
*-commutative60.9%
*-commutative60.9%
Simplified60.9%
if 4.5000000000000004e-37 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification78.7%
(FPCore (a b c)
:precision binary64
(if (<= b -9.5e-27)
(* 0.3333333333333333 (- (* (/ c b) 1.5) (* 2.0 (/ b a))))
(if (<= b 4.6e-38)
(/ (- (sqrt (* a (* -3.0 c))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -9.5e-27) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else if (b <= 4.6e-38) {
tmp = (sqrt((a * (-3.0 * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-9.5d-27)) then
tmp = 0.3333333333333333d0 * (((c / b) * 1.5d0) - (2.0d0 * (b / a)))
else if (b <= 4.6d-38) then
tmp = (sqrt((a * ((-3.0d0) * c))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -9.5e-27) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else if (b <= 4.6e-38) {
tmp = (Math.sqrt((a * (-3.0 * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -9.5e-27: tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))) elif b <= 4.6e-38: tmp = (math.sqrt((a * (-3.0 * c))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -9.5e-27) tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(c / b) * 1.5) - Float64(2.0 * Float64(b / a)))); elseif (b <= 4.6e-38) tmp = Float64(Float64(sqrt(Float64(a * Float64(-3.0 * c))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -9.5e-27) tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))); elseif (b <= 4.6e-38) tmp = (sqrt((a * (-3.0 * c))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -9.5e-27], N[(0.3333333333333333 * N[(N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision] - N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.6e-38], N[(N[(N[Sqrt[N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.5 \cdot 10^{-27}:\\
\;\;\;\;0.3333333333333333 \cdot \left(\frac{c}{b} \cdot 1.5 - 2 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{-38}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-3 \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -9.50000000000000037e-27Initial program 59.8%
sqr-neg59.8%
sqr-neg59.8%
associate-*l*59.8%
Simplified59.8%
*-un-lft-identity59.8%
times-frac59.8%
metadata-eval59.8%
add-sqr-sqrt59.7%
sqrt-unprod59.8%
sqr-neg59.8%
sqrt-prod0.0%
add-sqr-sqrt31.6%
fmm-def31.6%
distribute-lft-neg-in31.6%
*-commutative31.6%
associate-*r*31.6%
metadata-eval31.6%
Applied egg-rr31.6%
Taylor expanded in c around 0 0.8%
*-commutative0.8%
frac-2neg0.8%
distribute-frac-neg20.8%
add-sqr-sqrt0.8%
sqrt-unprod0.6%
sqr-neg0.6%
sqrt-unprod0.0%
add-sqr-sqrt85.1%
cancel-sign-sub-inv85.1%
*-commutative85.1%
add-sqr-sqrt47.7%
sqrt-unprod83.4%
swap-sqr83.4%
metadata-eval83.4%
metadata-eval83.4%
swap-sqr83.4%
sqrt-unprod62.2%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
if -9.50000000000000037e-27 < b < 4.60000000000000003e-38Initial program 71.0%
sqr-neg71.0%
sqr-neg71.0%
associate-*l*70.9%
Simplified70.9%
Taylor expanded in b around 0 61.5%
*-commutative61.5%
associate-*l*61.5%
*-commutative61.5%
*-commutative61.5%
Simplified61.5%
if 4.60000000000000003e-38 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification78.7%
(FPCore (a b c)
:precision binary64
(if (<= b -1e-28)
(* 0.3333333333333333 (- (* (/ c b) 1.5) (* 2.0 (/ b a))))
(if (<= b 2.45e-42)
(/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-28) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else if (b <= 2.45e-42) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d-28)) then
tmp = 0.3333333333333333d0 * (((c / b) * 1.5d0) - (2.0d0 * (b / a)))
else if (b <= 2.45d-42) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-28) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else if (b <= 2.45e-42) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-28: tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))) elif b <= 2.45e-42: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-28) tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(c / b) * 1.5) - Float64(2.0 * Float64(b / a)))); elseif (b <= 2.45e-42) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-28) tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))); elseif (b <= 2.45e-42) tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-28], N[(0.3333333333333333 * N[(N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision] - N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.45e-42], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-28}:\\
\;\;\;\;0.3333333333333333 \cdot \left(\frac{c}{b} \cdot 1.5 - 2 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \leq 2.45 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -9.99999999999999971e-29Initial program 59.8%
sqr-neg59.8%
sqr-neg59.8%
associate-*l*59.8%
Simplified59.8%
*-un-lft-identity59.8%
times-frac59.8%
metadata-eval59.8%
add-sqr-sqrt59.7%
sqrt-unprod59.8%
sqr-neg59.8%
sqrt-prod0.0%
add-sqr-sqrt31.6%
fmm-def31.6%
distribute-lft-neg-in31.6%
*-commutative31.6%
associate-*r*31.6%
metadata-eval31.6%
Applied egg-rr31.6%
Taylor expanded in c around 0 0.8%
*-commutative0.8%
frac-2neg0.8%
distribute-frac-neg20.8%
add-sqr-sqrt0.8%
sqrt-unprod0.6%
sqr-neg0.6%
sqrt-unprod0.0%
add-sqr-sqrt85.1%
cancel-sign-sub-inv85.1%
*-commutative85.1%
add-sqr-sqrt47.7%
sqrt-unprod83.4%
swap-sqr83.4%
metadata-eval83.4%
metadata-eval83.4%
swap-sqr83.4%
sqrt-unprod62.2%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
if -9.99999999999999971e-29 < b < 2.45e-42Initial program 71.0%
sqr-neg71.0%
sqr-neg71.0%
associate-*l*70.9%
Simplified70.9%
Taylor expanded in b around 0 61.5%
+-commutative61.5%
unsub-neg61.5%
*-commutative61.5%
Applied egg-rr61.5%
if 2.45e-42 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification78.7%
(FPCore (a b c)
:precision binary64
(if (<= b -1.35e-22)
(* 0.3333333333333333 (- (* (/ c b) 1.5) (* 2.0 (/ b a))))
(if (<= b 1.9e-42)
(* 0.3333333333333333 (/ (- (sqrt (* -3.0 (* a c))) b) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.35e-22) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else if (b <= 1.9e-42) {
tmp = 0.3333333333333333 * ((sqrt((-3.0 * (a * c))) - b) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.35d-22)) then
tmp = 0.3333333333333333d0 * (((c / b) * 1.5d0) - (2.0d0 * (b / a)))
else if (b <= 1.9d-42) then
tmp = 0.3333333333333333d0 * ((sqrt(((-3.0d0) * (a * c))) - b) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.35e-22) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else if (b <= 1.9e-42) {
tmp = 0.3333333333333333 * ((Math.sqrt((-3.0 * (a * c))) - b) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.35e-22: tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))) elif b <= 1.9e-42: tmp = 0.3333333333333333 * ((math.sqrt((-3.0 * (a * c))) - b) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.35e-22) tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(c / b) * 1.5) - Float64(2.0 * Float64(b / a)))); elseif (b <= 1.9e-42) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.35e-22) tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))); elseif (b <= 1.9e-42) tmp = 0.3333333333333333 * ((sqrt((-3.0 * (a * c))) - b) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.35e-22], N[(0.3333333333333333 * N[(N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision] - N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.9e-42], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.35 \cdot 10^{-22}:\\
\;\;\;\;0.3333333333333333 \cdot \left(\frac{c}{b} \cdot 1.5 - 2 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{-42}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.3500000000000001e-22Initial program 59.8%
sqr-neg59.8%
sqr-neg59.8%
associate-*l*59.8%
Simplified59.8%
*-un-lft-identity59.8%
times-frac59.8%
metadata-eval59.8%
add-sqr-sqrt59.7%
sqrt-unprod59.8%
sqr-neg59.8%
sqrt-prod0.0%
add-sqr-sqrt31.6%
fmm-def31.6%
distribute-lft-neg-in31.6%
*-commutative31.6%
associate-*r*31.6%
metadata-eval31.6%
Applied egg-rr31.6%
Taylor expanded in c around 0 0.8%
*-commutative0.8%
frac-2neg0.8%
distribute-frac-neg20.8%
add-sqr-sqrt0.8%
sqrt-unprod0.6%
sqr-neg0.6%
sqrt-unprod0.0%
add-sqr-sqrt85.1%
cancel-sign-sub-inv85.1%
*-commutative85.1%
add-sqr-sqrt47.7%
sqrt-unprod83.4%
swap-sqr83.4%
metadata-eval83.4%
metadata-eval83.4%
swap-sqr83.4%
sqrt-unprod62.2%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
if -1.3500000000000001e-22 < b < 1.90000000000000009e-42Initial program 71.0%
sqr-neg71.0%
sqr-neg71.0%
associate-*l*70.9%
Simplified70.9%
Taylor expanded in b around 0 61.5%
+-commutative61.5%
unsub-neg61.5%
*-commutative61.5%
Applied egg-rr61.5%
*-un-lft-identity61.5%
times-frac61.4%
metadata-eval61.4%
Applied egg-rr61.4%
if 1.90000000000000009e-42 < b Initial program 18.3%
sqr-neg18.3%
sqr-neg18.3%
associate-*l*18.2%
Simplified18.2%
Taylor expanded in b around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification78.6%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (* 0.3333333333333333 (- (* (/ c b) 1.5) (* 2.0 (/ b a)))) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = 0.3333333333333333d0 * (((c / b) * 1.5d0) - (2.0d0 * (b / a)))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a)));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(0.3333333333333333 * Float64(Float64(Float64(c / b) * 1.5) - Float64(2.0 * Float64(b / a)))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = 0.3333333333333333 * (((c / b) * 1.5) - (2.0 * (b / a))); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(0.3333333333333333 * N[(N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision] - N[(2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;0.3333333333333333 \cdot \left(\frac{c}{b} \cdot 1.5 - 2 \cdot \frac{b}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 68.1%
sqr-neg68.1%
sqr-neg68.1%
associate-*l*68.0%
Simplified68.0%
*-un-lft-identity68.0%
times-frac68.0%
metadata-eval68.0%
add-sqr-sqrt67.9%
sqrt-unprod67.4%
sqr-neg67.4%
sqrt-prod0.0%
add-sqr-sqrt43.0%
fmm-def43.0%
distribute-lft-neg-in43.0%
*-commutative43.0%
associate-*r*43.0%
metadata-eval43.0%
Applied egg-rr43.0%
Taylor expanded in c around 0 0.9%
*-commutative0.9%
frac-2neg0.9%
distribute-frac-neg20.9%
add-sqr-sqrt0.9%
sqrt-unprod0.9%
sqr-neg0.9%
sqrt-unprod0.0%
add-sqr-sqrt60.9%
cancel-sign-sub-inv60.9%
*-commutative60.9%
add-sqr-sqrt32.8%
sqrt-unprod60.5%
swap-sqr60.5%
metadata-eval60.5%
metadata-eval60.5%
swap-sqr60.5%
sqrt-unprod43.4%
add-sqr-sqrt63.1%
Applied egg-rr63.1%
if -5.00000000000023e-311 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.5%
Simplified31.5%
Taylor expanded in b around inf 69.0%
*-commutative69.0%
Simplified69.0%
Final simplification65.9%
(FPCore (a b c) :precision binary64 (if (<= b 2.2e-307) (/ (* b -2.0) (* 3.0 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.2e-307) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.2d-307) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.2e-307) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.2e-307: tmp = (b * -2.0) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.2e-307) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.2e-307) tmp = (b * -2.0) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.2e-307], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.2 \cdot 10^{-307}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 2.2e-307Initial program 68.1%
sqr-neg68.1%
sqr-neg68.1%
associate-*l*68.0%
Simplified68.0%
Taylor expanded in b around -inf 62.8%
*-commutative62.8%
Simplified62.8%
if 2.2e-307 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.5%
Simplified31.5%
Taylor expanded in b around inf 69.0%
*-commutative69.0%
Simplified69.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (* b (/ -0.6666666666666666 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 68.1%
sqr-neg68.1%
sqr-neg68.1%
associate-*l*68.0%
Simplified68.0%
Taylor expanded in b around -inf 62.7%
*-commutative62.7%
Simplified62.7%
associate-*l/62.7%
clear-num62.7%
Applied egg-rr62.7%
clear-num62.7%
associate-/l*62.8%
Applied egg-rr62.8%
if -5.00000000000023e-311 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.5%
Simplified31.5%
Taylor expanded in b around inf 69.0%
*-commutative69.0%
Simplified69.0%
(FPCore (a b c) :precision binary64 (if (<= b -6.6e-299) (* b (/ -0.6666666666666666 a)) 0.0))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.6e-299) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6.6d-299)) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.6e-299) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.6e-299: tmp = b * (-0.6666666666666666 / a) else: tmp = 0.0 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.6e-299) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.6e-299) tmp = b * (-0.6666666666666666 / a); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.6e-299], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.6 \cdot 10^{-299}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b < -6.6000000000000004e-299Initial program 67.8%
sqr-neg67.8%
sqr-neg67.8%
associate-*l*67.8%
Simplified67.8%
Taylor expanded in b around -inf 63.1%
*-commutative63.1%
Simplified63.1%
associate-*l/63.2%
clear-num63.1%
Applied egg-rr63.1%
clear-num63.2%
associate-/l*63.2%
Applied egg-rr63.2%
if -6.6000000000000004e-299 < b Initial program 32.0%
sqr-neg32.0%
sqr-neg32.0%
associate-*l*32.0%
Simplified32.0%
Taylor expanded in b around inf 19.2%
Taylor expanded in b around 0 19.2%
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
return 0.0;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b, double c) {
return 0.0;
}
def code(a, b, c): return 0.0
function code(a, b, c) return 0.0 end
function tmp = code(a, b, c) tmp = 0.0; end
code[a_, b_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 50.6%
sqr-neg50.6%
sqr-neg50.6%
associate-*l*50.6%
Simplified50.6%
Taylor expanded in b around inf 10.6%
Taylor expanded in b around 0 10.6%
herbie shell --seed 2024155
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))