
(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 17 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 -1e+151)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 2.05e-47)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+151) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.05e-47) {
tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * 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 (b <= (-1d+151)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 2.05d-47) then
tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * 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 (b <= -1e+151) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.05e-47) {
tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+151: tmp = (b * -2.0) / (3.0 * a) elif b <= 2.05e-47: tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+151) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 2.05e-47) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e+151) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 2.05e-47) tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+151], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.05e-47], 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[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+151}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.00000000000000002e151Initial program 39.7%
sqr-neg39.7%
sqr-neg39.7%
associate-*l*39.7%
Simplified39.7%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
if -1.00000000000000002e151 < b < 2.05000000000000001e-47Initial program 88.7%
if 2.05000000000000001e-47 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification89.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.6e+140)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 8.5e-47)
(* (- (sqrt (- (* b b) (* a (* 3.0 c)))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.6e+140) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 8.5e-47) {
tmp = (sqrt(((b * b) - (a * (3.0 * c)))) - b) * (0.3333333333333333 / 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 (b <= (-3.6d+140)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 8.5d-47) then
tmp = (sqrt(((b * b) - (a * (3.0d0 * c)))) - b) * (0.3333333333333333d0 / 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 (b <= -3.6e+140) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 8.5e-47) {
tmp = (Math.sqrt(((b * b) - (a * (3.0 * c)))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.6e+140: tmp = (b * -2.0) / (3.0 * a) elif b <= 8.5e-47: tmp = (math.sqrt(((b * b) - (a * (3.0 * c)))) - b) * (0.3333333333333333 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.6e+140) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 8.5e-47) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(3.0 * c)))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.6e+140) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 8.5e-47) tmp = (sqrt(((b * b) - (a * (3.0 * c)))) - b) * (0.3333333333333333 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.6e+140], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.5e-47], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{+140}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-47}:\\
\;\;\;\;\left(\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.6e140Initial program 42.7%
sqr-neg42.7%
sqr-neg42.7%
associate-*l*42.7%
Simplified42.7%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
if -3.6e140 < b < 8.4999999999999999e-47Initial program 88.5%
neg-sub088.5%
sqr-neg88.5%
associate-+l-88.5%
sub0-neg88.5%
neg-mul-188.5%
Simplified88.4%
associate-*r*88.4%
metadata-eval88.4%
distribute-rgt-neg-in88.4%
*-commutative88.4%
fma-neg88.4%
associate-*r*88.4%
*-commutative88.4%
associate-*l*88.4%
Applied egg-rr88.4%
*-commutative88.4%
Simplified88.4%
div-inv88.2%
clear-num88.3%
Applied egg-rr88.3%
if 8.4999999999999999e-47 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification88.8%
(FPCore (a b c)
:precision binary64
(if (<= b -7e+108)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 4.3e-47)
(* (/ (- (sqrt (- (* b b) (* a (* 3.0 c)))) b) a) 0.3333333333333333)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e+108) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 4.3e-47) {
tmp = ((sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-7d+108)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 4.3d-47) then
tmp = ((sqrt(((b * b) - (a * (3.0d0 * c)))) - b) / a) * 0.3333333333333333d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7e+108) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 4.3e-47) {
tmp = ((Math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7e+108: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 4.3e-47: tmp = ((math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7e+108) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 4.3e-47) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(3.0 * c)))) - b) / a) * 0.3333333333333333); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7e+108) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 4.3e-47) tmp = ((sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7e+108], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.3e-47], N[(N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{+108}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 4.3 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.0000000000000005e108Initial program 51.2%
sqr-neg51.2%
sqr-neg51.2%
associate-*l*51.2%
Simplified51.2%
Taylor expanded in b around -inf 99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -7.0000000000000005e108 < b < 4.2999999999999998e-47Initial program 87.9%
neg-sub087.9%
sqr-neg87.9%
associate-+l-87.9%
sub0-neg87.9%
neg-mul-187.9%
Simplified87.7%
associate-*r*87.7%
metadata-eval87.7%
distribute-rgt-neg-in87.7%
*-commutative87.7%
fma-neg87.7%
associate-*r*87.7%
*-commutative87.7%
associate-*l*87.7%
Applied egg-rr87.7%
*-commutative87.7%
Simplified87.7%
associate-/r/87.8%
Applied egg-rr87.8%
if 4.2999999999999998e-47 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.95e+105)
(/ (+ (* b -2.0) (fabs (* (/ a b) (* c 1.5)))) (* 3.0 a))
(if (<= b 1.75e-47)
(* (/ (- (sqrt (- (* b b) (* a (* 3.0 c)))) b) a) 0.3333333333333333)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.95e+105) {
tmp = ((b * -2.0) + fabs(((a / b) * (c * 1.5)))) / (3.0 * a);
} else if (b <= 1.75e-47) {
tmp = ((sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.95d+105)) then
tmp = ((b * (-2.0d0)) + abs(((a / b) * (c * 1.5d0)))) / (3.0d0 * a)
else if (b <= 1.75d-47) then
tmp = ((sqrt(((b * b) - (a * (3.0d0 * c)))) - b) / a) * 0.3333333333333333d0
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.95e+105) {
tmp = ((b * -2.0) + Math.abs(((a / b) * (c * 1.5)))) / (3.0 * a);
} else if (b <= 1.75e-47) {
tmp = ((Math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.95e+105: tmp = ((b * -2.0) + math.fabs(((a / b) * (c * 1.5)))) / (3.0 * a) elif b <= 1.75e-47: tmp = ((math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.95e+105) tmp = Float64(Float64(Float64(b * -2.0) + abs(Float64(Float64(a / b) * Float64(c * 1.5)))) / Float64(3.0 * a)); elseif (b <= 1.75e-47) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(3.0 * c)))) - b) / a) * 0.3333333333333333); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.95e+105) tmp = ((b * -2.0) + abs(((a / b) * (c * 1.5)))) / (3.0 * a); elseif (b <= 1.75e-47) tmp = ((sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.95e+105], N[(N[(N[(b * -2.0), $MachinePrecision] + N[Abs[N[(N[(a / b), $MachinePrecision] * N[(c * 1.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.75e-47], N[(N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.95 \cdot 10^{+105}:\\
\;\;\;\;\frac{b \cdot -2 + \left|\frac{a}{b} \cdot \left(c \cdot 1.5\right)\right|}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.94999999999999989e105Initial program 52.2%
sqr-neg52.2%
sqr-neg52.2%
associate-*l*52.2%
Simplified52.2%
Taylor expanded in b around -inf 95.7%
add-sqr-sqrt68.6%
sqrt-unprod95.9%
pow295.9%
*-commutative95.9%
associate-/l*99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-/l*95.9%
unpow295.9%
rem-sqrt-square95.9%
associate-/l*99.8%
*-commutative99.8%
associate-/r/99.8%
associate-*l*99.8%
Simplified99.8%
if -1.94999999999999989e105 < b < 1.7499999999999999e-47Initial program 87.8%
neg-sub087.8%
sqr-neg87.8%
associate-+l-87.8%
sub0-neg87.8%
neg-mul-187.8%
Simplified87.6%
associate-*r*87.6%
metadata-eval87.6%
distribute-rgt-neg-in87.6%
*-commutative87.6%
fma-neg87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l*87.6%
Applied egg-rr87.6%
*-commutative87.6%
Simplified87.6%
associate-/r/87.7%
Applied egg-rr87.7%
if 1.7499999999999999e-47 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+154)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 2.4e-46)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+154) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.4e-46) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * 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 (b <= (-2d+154)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 2.4d-46) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (3.0d0 * 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 (b <= -2e+154) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.4e-46) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e+154: tmp = (b * -2.0) / (3.0 * a) elif b <= 2.4e-46: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e+154) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 2.4e-46) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e+154) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 2.4e-46) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e+154], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-46], 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[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+154}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-46}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.00000000000000007e154Initial program 39.7%
sqr-neg39.7%
sqr-neg39.7%
associate-*l*39.7%
Simplified39.7%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
if -2.00000000000000007e154 < b < 2.40000000000000013e-46Initial program 88.7%
sqr-neg88.7%
sqr-neg88.7%
associate-*l*88.7%
Simplified88.7%
if 2.40000000000000013e-46 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -0.5)
(/ (- (- (* (/ a b) (* c 1.5)) b) b) (/ a 0.3333333333333333))
(if (<= b 1.12e-46)
(* (/ 0.3333333333333333 a) (- (sqrt (* a (* c -3.0))) b))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.5) {
tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333);
} else if (b <= 1.12e-46) {
tmp = (0.3333333333333333 / a) * (sqrt((a * (c * -3.0))) - b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-0.5d0)) then
tmp = ((((a / b) * (c * 1.5d0)) - b) - b) / (a / 0.3333333333333333d0)
else if (b <= 1.12d-46) then
tmp = (0.3333333333333333d0 / a) * (sqrt((a * (c * (-3.0d0)))) - b)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -0.5) {
tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333);
} else if (b <= 1.12e-46) {
tmp = (0.3333333333333333 / a) * (Math.sqrt((a * (c * -3.0))) - b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.5: tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333) elif b <= 1.12e-46: tmp = (0.3333333333333333 / a) * (math.sqrt((a * (c * -3.0))) - b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.5) tmp = Float64(Float64(Float64(Float64(Float64(a / b) * Float64(c * 1.5)) - b) - b) / Float64(a / 0.3333333333333333)); elseif (b <= 1.12e-46) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(a * Float64(c * -3.0))) - b)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -0.5) tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333); elseif (b <= 1.12e-46) tmp = (0.3333333333333333 / a) * (sqrt((a * (c * -3.0))) - b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.5], N[(N[(N[(N[(N[(a / b), $MachinePrecision] * N[(c * 1.5), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.12e-46], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.5:\\
\;\;\;\;\frac{\left(\frac{a}{b} \cdot \left(c \cdot 1.5\right) - b\right) - b}{\frac{a}{0.3333333333333333}}\\
\mathbf{elif}\;b \leq 1.12 \cdot 10^{-46}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -0.5Initial program 66.7%
neg-sub066.7%
sqr-neg66.7%
associate-+l-66.7%
sub0-neg66.7%
neg-mul-166.7%
Simplified66.6%
associate-*r*66.6%
metadata-eval66.6%
distribute-rgt-neg-in66.6%
*-commutative66.6%
fma-neg66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*l*66.6%
Applied egg-rr66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in b around -inf 93.0%
neg-mul-193.0%
+-commutative93.0%
unsub-neg93.0%
associate-/l*95.7%
*-commutative95.7%
associate-/r/95.7%
associate-*l*95.7%
Simplified95.7%
if -0.5 < b < 1.11999999999999997e-46Initial program 85.6%
neg-sub085.6%
sqr-neg85.6%
associate-+l-85.6%
sub0-neg85.6%
neg-mul-185.6%
Simplified85.4%
associate-*r*85.4%
metadata-eval85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
fma-neg85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
Applied egg-rr85.4%
*-commutative85.4%
Simplified85.4%
div-inv85.3%
clear-num85.3%
Applied egg-rr85.3%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
associate-*r*71.3%
Simplified71.3%
if 1.11999999999999997e-46 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -3.4)
(/ (- (- (* (/ a b) (* c 1.5)) b) b) (/ a 0.3333333333333333))
(if (<= b 3.8e-46)
(* 0.3333333333333333 (/ (- (sqrt (* (* a c) -3.0)) b) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.4) {
tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333);
} else if (b <= 3.8e-46) {
tmp = 0.3333333333333333 * ((sqrt(((a * c) * -3.0)) - b) / 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 (b <= (-3.4d0)) then
tmp = ((((a / b) * (c * 1.5d0)) - b) - b) / (a / 0.3333333333333333d0)
else if (b <= 3.8d-46) then
tmp = 0.3333333333333333d0 * ((sqrt(((a * c) * (-3.0d0))) - b) / 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 (b <= -3.4) {
tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333);
} else if (b <= 3.8e-46) {
tmp = 0.3333333333333333 * ((Math.sqrt(((a * c) * -3.0)) - b) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.4: tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333) elif b <= 3.8e-46: tmp = 0.3333333333333333 * ((math.sqrt(((a * c) * -3.0)) - b) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.4) tmp = Float64(Float64(Float64(Float64(Float64(a / b) * Float64(c * 1.5)) - b) - b) / Float64(a / 0.3333333333333333)); elseif (b <= 3.8e-46) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.4) tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333); elseif (b <= 3.8e-46) tmp = 0.3333333333333333 * ((sqrt(((a * c) * -3.0)) - b) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.4], N[(N[(N[(N[(N[(a / b), $MachinePrecision] * N[(c * 1.5), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-46], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.4:\\
\;\;\;\;\frac{\left(\frac{a}{b} \cdot \left(c \cdot 1.5\right) - b\right) - b}{\frac{a}{0.3333333333333333}}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-46}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.39999999999999991Initial program 66.7%
neg-sub066.7%
sqr-neg66.7%
associate-+l-66.7%
sub0-neg66.7%
neg-mul-166.7%
Simplified66.6%
associate-*r*66.6%
metadata-eval66.6%
distribute-rgt-neg-in66.6%
*-commutative66.6%
fma-neg66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*l*66.6%
Applied egg-rr66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in b around -inf 93.0%
neg-mul-193.0%
+-commutative93.0%
unsub-neg93.0%
associate-/l*95.7%
*-commutative95.7%
associate-/r/95.7%
associate-*l*95.7%
Simplified95.7%
if -3.39999999999999991 < b < 3.7999999999999997e-46Initial program 85.6%
neg-sub085.6%
sqr-neg85.6%
associate-+l-85.6%
sub0-neg85.6%
neg-mul-185.6%
Simplified85.4%
associate-*r*85.4%
metadata-eval85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
fma-neg85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
Applied egg-rr85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in b around 0 71.4%
associate-/r/71.4%
Applied egg-rr71.4%
if 3.7999999999999997e-46 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -0.15)
(/ (- (- (* (/ a b) (* c 1.5)) b) b) (/ a 0.3333333333333333))
(if (<= b 8.5e-47)
(* 0.3333333333333333 (/ (- (sqrt (* a (* c -3.0))) b) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.15) {
tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333);
} else if (b <= 8.5e-47) {
tmp = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - b) / 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 (b <= (-0.15d0)) then
tmp = ((((a / b) * (c * 1.5d0)) - b) - b) / (a / 0.3333333333333333d0)
else if (b <= 8.5d-47) then
tmp = 0.3333333333333333d0 * ((sqrt((a * (c * (-3.0d0)))) - b) / 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 (b <= -0.15) {
tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333);
} else if (b <= 8.5e-47) {
tmp = 0.3333333333333333 * ((Math.sqrt((a * (c * -3.0))) - b) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.15: tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333) elif b <= 8.5e-47: tmp = 0.3333333333333333 * ((math.sqrt((a * (c * -3.0))) - b) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.15) tmp = Float64(Float64(Float64(Float64(Float64(a / b) * Float64(c * 1.5)) - b) - b) / Float64(a / 0.3333333333333333)); elseif (b <= 8.5e-47) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -0.15) tmp = ((((a / b) * (c * 1.5)) - b) - b) / (a / 0.3333333333333333); elseif (b <= 8.5e-47) tmp = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - b) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.15], N[(N[(N[(N[(N[(a / b), $MachinePrecision] * N[(c * 1.5), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.5e-47], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.15:\\
\;\;\;\;\frac{\left(\frac{a}{b} \cdot \left(c \cdot 1.5\right) - b\right) - b}{\frac{a}{0.3333333333333333}}\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-47}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -0.149999999999999994Initial program 66.7%
neg-sub066.7%
sqr-neg66.7%
associate-+l-66.7%
sub0-neg66.7%
neg-mul-166.7%
Simplified66.6%
associate-*r*66.6%
metadata-eval66.6%
distribute-rgt-neg-in66.6%
*-commutative66.6%
fma-neg66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*l*66.6%
Applied egg-rr66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in b around -inf 93.0%
neg-mul-193.0%
+-commutative93.0%
unsub-neg93.0%
associate-/l*95.7%
*-commutative95.7%
associate-/r/95.7%
associate-*l*95.7%
Simplified95.7%
if -0.149999999999999994 < b < 8.4999999999999999e-47Initial program 85.6%
neg-sub085.6%
sqr-neg85.6%
associate-+l-85.6%
sub0-neg85.6%
neg-mul-185.6%
Simplified85.4%
associate-*r*85.4%
metadata-eval85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
fma-neg85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
Applied egg-rr85.4%
*-commutative85.4%
Simplified85.4%
associate-/r/85.6%
Applied egg-rr85.6%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
associate-*r*71.3%
Simplified71.5%
if 8.4999999999999999e-47 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 85.0%
Final simplification83.4%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* (/ c b) 0.5) (* -0.6666666666666666 (/ b a))) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / 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 (b <= (-5d-310)) then
tmp = ((c / b) * 0.5d0) + ((-0.6666666666666666d0) * (b / 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 (b <= -5e-310) {
tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(c / b) * 0.5) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5 + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.9%
sqr-neg74.9%
sqr-neg74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in b around -inf 69.6%
if -4.999999999999985e-310 < b Initial program 36.9%
sqr-neg36.9%
sqr-neg36.9%
associate-*l*36.8%
Simplified36.8%
Taylor expanded in b around inf 66.1%
Final simplification67.8%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.9%
sqr-neg74.9%
sqr-neg74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in b around -inf 69.6%
associate-*r/69.7%
Applied egg-rr69.7%
if -4.999999999999985e-310 < b Initial program 36.9%
sqr-neg36.9%
sqr-neg36.9%
associate-*l*36.8%
Simplified36.8%
Taylor expanded in b around inf 66.1%
Final simplification67.8%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (/ 1.0 (* (/ a b) -1.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
tmp = 1.0 / ((a / b) * -1.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 4.2d-277) then
tmp = 1.0d0 / ((a / b) * (-1.5d0))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
tmp = 1.0 / ((a / b) * -1.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = 1.0 / ((a / b) * -1.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) tmp = Float64(1.0 / Float64(Float64(a / b) * -1.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-277) tmp = 1.0 / ((a / b) * -1.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], N[(1.0 / N[(N[(a / b), $MachinePrecision] * -1.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{1}{\frac{a}{b} \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
neg-sub075.3%
sqr-neg75.3%
associate-+l-75.3%
sub0-neg75.3%
neg-mul-175.3%
Simplified75.2%
associate-*r*75.2%
metadata-eval75.2%
distribute-rgt-neg-in75.2%
*-commutative75.2%
fma-neg75.2%
associate-*r*75.2%
*-commutative75.2%
associate-*l*75.2%
Applied egg-rr75.2%
*-commutative75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
div-inv75.2%
metadata-eval75.2%
Applied egg-rr75.2%
unpow-175.2%
*-commutative75.2%
*-lft-identity75.2%
times-frac75.3%
metadata-eval75.3%
sub-neg75.3%
+-commutative75.3%
distribute-rgt-neg-in75.3%
fma-def75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.4%
associate-*r/68.4%
Simplified68.4%
Taylor expanded in a around 0 68.4%
if 4.1999999999999999e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.7%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (/ (* b -2.0) (* 3.0 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
tmp = (b * -2.0) / (3.0 * 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 (b <= 4.2d-277) then
tmp = (b * (-2.0d0)) / (3.0d0 * 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 (b <= 4.2e-277) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = (b * -2.0) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-277) tmp = (b * -2.0) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
sqr-neg75.3%
sqr-neg75.3%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.4%
*-commutative68.4%
Simplified68.4%
if 4.1999999999999999e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.7%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
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 (b <= 4.2d-277) 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 (b <= 4.2e-277) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) 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 (b <= 4.2e-277) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
neg-sub075.3%
sqr-neg75.3%
associate-+l-75.3%
sub0-neg75.3%
neg-mul-175.3%
Simplified75.2%
associate-*r*75.2%
metadata-eval75.2%
distribute-rgt-neg-in75.2%
*-commutative75.2%
fma-neg75.2%
associate-*r*75.2%
*-commutative75.2%
associate-*l*75.2%
Applied egg-rr75.2%
*-commutative75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
div-inv75.2%
metadata-eval75.2%
Applied egg-rr75.2%
unpow-175.2%
*-commutative75.2%
*-lft-identity75.2%
times-frac75.3%
metadata-eval75.3%
sub-neg75.3%
+-commutative75.3%
distribute-rgt-neg-in75.3%
fma-def75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.4%
associate-*r/68.4%
Simplified68.4%
expm1-log1p-u36.6%
expm1-udef26.0%
associate-/r*26.0%
metadata-eval26.0%
*-commutative26.0%
Applied egg-rr26.0%
expm1-def36.6%
expm1-log1p68.2%
associate-/r/68.2%
*-commutative68.2%
*-commutative68.2%
associate-/r*68.2%
metadata-eval68.2%
Simplified68.2%
if 4.1999999999999999e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.6%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
tmp = -0.6666666666666666 * (b / 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 (b <= 4.2d-277) then
tmp = (-0.6666666666666666d0) * (b / 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 (b <= 4.2e-277) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-277) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
sqr-neg75.3%
sqr-neg75.3%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.2%
*-commutative68.2%
Simplified68.2%
if 4.1999999999999999e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.6%
(FPCore (a b c) :precision binary64 (if (<= b 5.2e-277) (/ -0.6666666666666666 (/ a b)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-277) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 5.2d-277) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.2e-277) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.2e-277: tmp = -0.6666666666666666 / (a / b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.2e-277) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.2e-277) tmp = -0.6666666666666666 / (a / b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.2e-277], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 5.2e-277Initial program 75.3%
neg-sub075.3%
sqr-neg75.3%
associate-+l-75.3%
sub0-neg75.3%
neg-mul-175.3%
Simplified75.2%
associate-*r*75.2%
metadata-eval75.2%
distribute-rgt-neg-in75.2%
*-commutative75.2%
fma-neg75.2%
associate-*r*75.2%
*-commutative75.2%
associate-*l*75.2%
Applied egg-rr75.2%
*-commutative75.2%
Simplified75.2%
Taylor expanded in b around -inf 68.2%
associate-*r/68.3%
associate-/l*68.2%
Simplified68.2%
if 5.2e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.6%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
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 (b <= 4.2d-277) 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 (b <= 4.2e-277) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) tmp = Float64(Float64(b * -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 (b <= 4.2e-277) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
neg-sub075.3%
sqr-neg75.3%
associate-+l-75.3%
sub0-neg75.3%
neg-mul-175.3%
Simplified75.2%
associate-*r*75.2%
metadata-eval75.2%
distribute-rgt-neg-in75.2%
*-commutative75.2%
fma-neg75.2%
associate-*r*75.2%
*-commutative75.2%
associate-*l*75.2%
Applied egg-rr75.2%
*-commutative75.2%
Simplified75.2%
clear-num75.2%
inv-pow75.2%
div-inv75.2%
metadata-eval75.2%
Applied egg-rr75.2%
unpow-175.2%
*-commutative75.2%
*-lft-identity75.2%
times-frac75.3%
metadata-eval75.3%
sub-neg75.3%
+-commutative75.3%
distribute-rgt-neg-in75.3%
fma-def75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.2%
associate-*r/68.3%
Simplified68.3%
if 4.1999999999999999e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.6%
(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}
Initial program 55.2%
sqr-neg55.2%
sqr-neg55.2%
associate-*l*55.1%
Simplified55.1%
Taylor expanded in b around inf 35.3%
Final simplification35.3%
herbie shell --seed 2023272
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))