
(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.72e+72)
(/ 1.0 (* (/ -1.5 b) a))
(if (<= b 1.3e-104)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.72e+72) {
tmp = 1.0 / ((-1.5 / b) * a);
} else if (b <= 1.3e-104) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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.72d+72)) then
tmp = 1.0d0 / (((-1.5d0) / b) * a)
else if (b <= 1.3d-104) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.72e+72) {
tmp = 1.0 / ((-1.5 / b) * a);
} else if (b <= 1.3e-104) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.72e+72: tmp = 1.0 / ((-1.5 / b) * a) elif b <= 1.3e-104: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.72e+72) tmp = Float64(1.0 / Float64(Float64(-1.5 / b) * a)); elseif (b <= 1.3e-104) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.72e+72) tmp = 1.0 / ((-1.5 / b) * a); elseif (b <= 1.3e-104) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.72e+72], N[(1.0 / N[(N[(-1.5 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e-104], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.72 \cdot 10^{+72}:\\
\;\;\;\;\frac{1}{\frac{-1.5}{b} \cdot a}\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-104}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.71999999999999993e72Initial program 53.9%
/-rgt-identity53.9%
metadata-eval53.9%
associate-/r/53.9%
metadata-eval53.9%
metadata-eval53.9%
times-frac53.9%
*-commutative53.9%
times-frac53.8%
*-commutative53.8%
associate-/r*53.7%
associate-*l/53.8%
Simplified53.8%
clear-num53.8%
inv-pow53.8%
*-commutative53.8%
fma-udef53.8%
associate-*r*53.8%
add-sqr-sqrt33.4%
hypot-def50.4%
Applied egg-rr50.4%
unpow-150.4%
*-commutative50.4%
associate-*r*50.4%
*-commutative50.4%
associate-*l*50.4%
Simplified50.4%
Taylor expanded in b around -inf 90.5%
associate-*r/90.5%
associate-/l*90.6%
Simplified90.6%
associate-/r/90.6%
Applied egg-rr90.6%
if -1.71999999999999993e72 < b < 1.30000000000000001e-104Initial program 72.4%
if 1.30000000000000001e-104 < b Initial program 14.4%
Taylor expanded in b around inf 88.4%
associate-*r/88.4%
Applied egg-rr88.4%
Final simplification82.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.7e+40)
(/ (* b -2.0) (* a 3.0))
(if (<= b 3.6e-106)
(* -0.3333333333333333 (/ (- b (sqrt (- (* b b) (* 3.0 (* a c))))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.7e+40) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 3.6e-106) {
tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (a * c))))) / a);
} else {
tmp = (c * -0.5) / 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.7d+40)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else if (b <= 3.6d-106) then
tmp = (-0.3333333333333333d0) * ((b - sqrt(((b * b) - (3.0d0 * (a * c))))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.7e+40) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 3.6e-106) {
tmp = -0.3333333333333333 * ((b - Math.sqrt(((b * b) - (3.0 * (a * c))))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.7e+40: tmp = (b * -2.0) / (a * 3.0) elif b <= 3.6e-106: tmp = -0.3333333333333333 * ((b - math.sqrt(((b * b) - (3.0 * (a * c))))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.7e+40) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); elseif (b <= 3.6e-106) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c))))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.7e+40) tmp = (b * -2.0) / (a * 3.0); elseif (b <= 3.6e-106) tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (a * c))))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.7e+40], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.6e-106], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+40}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-106}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.7e40Initial program 60.6%
Taylor expanded in b around -inf 90.6%
*-commutative90.6%
Simplified90.6%
if -3.7e40 < b < 3.60000000000000013e-106Initial program 70.4%
/-rgt-identity70.4%
metadata-eval70.4%
associate-/l*70.4%
associate-*r/70.3%
*-commutative70.3%
associate-*l/70.4%
associate-*r/70.4%
metadata-eval70.4%
metadata-eval70.4%
times-frac70.4%
neg-mul-170.4%
distribute-rgt-neg-in70.4%
times-frac70.2%
metadata-eval70.2%
neg-mul-170.2%
Simplified70.1%
fma-udef70.1%
associate-*r*70.2%
*-commutative70.2%
metadata-eval70.2%
cancel-sign-sub-inv70.2%
Applied egg-rr70.2%
if 3.60000000000000013e-106 < b Initial program 14.4%
Taylor expanded in b around inf 88.4%
associate-*r/88.4%
Applied egg-rr88.4%
Final simplification81.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.75e+72)
(/ 1.0 (* (/ -1.5 b) a))
(if (<= b 1.2e-104)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.75e+72) {
tmp = 1.0 / ((-1.5 / b) * a);
} else if (b <= 1.2e-104) {
tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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.75d+72)) then
tmp = 1.0d0 / (((-1.5d0) / b) * a)
else if (b <= 1.2d-104) then
tmp = (sqrt(((b * b) + (a * (c * (-3.0d0))))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.75e+72) {
tmp = 1.0 / ((-1.5 / b) * a);
} else if (b <= 1.2e-104) {
tmp = (Math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.75e+72: tmp = 1.0 / ((-1.5 / b) * a) elif b <= 1.2e-104: tmp = (math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.75e+72) tmp = Float64(1.0 / Float64(Float64(-1.5 / b) * a)); elseif (b <= 1.2e-104) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.75e+72) tmp = 1.0 / ((-1.5 / b) * a); elseif (b <= 1.2e-104) tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.75e+72], N[(1.0 / N[(N[(-1.5 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.2e-104], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.75 \cdot 10^{+72}:\\
\;\;\;\;\frac{1}{\frac{-1.5}{b} \cdot a}\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-104}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.75000000000000005e72Initial program 53.9%
/-rgt-identity53.9%
metadata-eval53.9%
associate-/r/53.9%
metadata-eval53.9%
metadata-eval53.9%
times-frac53.9%
*-commutative53.9%
times-frac53.8%
*-commutative53.8%
associate-/r*53.7%
associate-*l/53.8%
Simplified53.8%
clear-num53.8%
inv-pow53.8%
*-commutative53.8%
fma-udef53.8%
associate-*r*53.8%
add-sqr-sqrt33.4%
hypot-def50.4%
Applied egg-rr50.4%
unpow-150.4%
*-commutative50.4%
associate-*r*50.4%
*-commutative50.4%
associate-*l*50.4%
Simplified50.4%
Taylor expanded in b around -inf 90.5%
associate-*r/90.5%
associate-/l*90.6%
Simplified90.6%
associate-/r/90.6%
Applied egg-rr90.6%
if -1.75000000000000005e72 < b < 1.2e-104Initial program 72.4%
associate-*r*72.4%
cancel-sign-sub-inv72.4%
metadata-eval72.4%
*-commutative72.4%
associate-*r*72.4%
Applied egg-rr72.4%
if 1.2e-104 < b Initial program 14.4%
Taylor expanded in b around inf 88.4%
associate-*r/88.4%
Applied egg-rr88.4%
Final simplification81.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.75e+72)
(/ 1.0 (* (/ -1.5 b) a))
(if (<= b 5.6e-107)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.75e+72) {
tmp = 1.0 / ((-1.5 / b) * a);
} else if (b <= 5.6e-107) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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.75d+72)) then
tmp = 1.0d0 / (((-1.5d0) / b) * a)
else if (b <= 5.6d-107) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.75e+72) {
tmp = 1.0 / ((-1.5 / b) * a);
} else if (b <= 5.6e-107) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.75e+72: tmp = 1.0 / ((-1.5 / b) * a) elif b <= 5.6e-107: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.75e+72) tmp = Float64(1.0 / Float64(Float64(-1.5 / b) * a)); elseif (b <= 5.6e-107) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.75e+72) tmp = 1.0 / ((-1.5 / b) * a); elseif (b <= 5.6e-107) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.75e+72], N[(1.0 / N[(N[(-1.5 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-107], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.75 \cdot 10^{+72}:\\
\;\;\;\;\frac{1}{\frac{-1.5}{b} \cdot a}\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.75000000000000005e72Initial program 53.9%
/-rgt-identity53.9%
metadata-eval53.9%
associate-/r/53.9%
metadata-eval53.9%
metadata-eval53.9%
times-frac53.9%
*-commutative53.9%
times-frac53.8%
*-commutative53.8%
associate-/r*53.7%
associate-*l/53.8%
Simplified53.8%
clear-num53.8%
inv-pow53.8%
*-commutative53.8%
fma-udef53.8%
associate-*r*53.8%
add-sqr-sqrt33.4%
hypot-def50.4%
Applied egg-rr50.4%
unpow-150.4%
*-commutative50.4%
associate-*r*50.4%
*-commutative50.4%
associate-*l*50.4%
Simplified50.4%
Taylor expanded in b around -inf 90.5%
associate-*r/90.5%
associate-/l*90.6%
Simplified90.6%
associate-/r/90.6%
Applied egg-rr90.6%
if -1.75000000000000005e72 < b < 5.5999999999999998e-107Initial program 72.4%
neg-sub072.4%
associate-+l-72.4%
sub0-neg72.4%
neg-mul-172.4%
associate-*r/72.4%
metadata-eval72.4%
metadata-eval72.4%
times-frac72.4%
*-commutative72.4%
times-frac72.3%
associate-*l/72.4%
Simplified72.4%
if 5.5999999999999998e-107 < b Initial program 14.4%
Taylor expanded in b around inf 88.4%
associate-*r/88.4%
Applied egg-rr88.4%
Final simplification81.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-99)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 1.05e-104)
(* -0.3333333333333333 (/ (- b (sqrt (* (* a c) -3.0))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-99) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.05e-104) {
tmp = -0.3333333333333333 * ((b - sqrt(((a * c) * -3.0))) / a);
} else {
tmp = (c * -0.5) / 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 <= (-2.3d-99)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 1.05d-104) then
tmp = (-0.3333333333333333d0) * ((b - sqrt(((a * c) * (-3.0d0)))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-99) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.05e-104) {
tmp = -0.3333333333333333 * ((b - Math.sqrt(((a * c) * -3.0))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.3e-99: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 1.05e-104: tmp = -0.3333333333333333 * ((b - math.sqrt(((a * c) * -3.0))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-99) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.05e-104) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(Float64(a * c) * -3.0))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.3e-99) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 1.05e-104) tmp = -0.3333333333333333 * ((b - sqrt(((a * c) * -3.0))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-99], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-104], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-99}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-104}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{\left(a \cdot c\right) \cdot -3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-99Initial program 66.3%
Taylor expanded in b around -inf 80.9%
if -2.2999999999999998e-99 < b < 1.04999999999999999e-104Initial program 67.0%
/-rgt-identity67.0%
metadata-eval67.0%
associate-/l*67.0%
associate-*r/66.9%
*-commutative66.9%
associate-*l/67.0%
associate-*r/67.0%
metadata-eval67.0%
metadata-eval67.0%
times-frac67.0%
neg-mul-167.0%
distribute-rgt-neg-in67.0%
times-frac66.9%
metadata-eval66.9%
neg-mul-166.9%
Simplified66.8%
fma-udef66.8%
associate-*r*66.9%
*-commutative66.9%
metadata-eval66.9%
cancel-sign-sub-inv66.9%
Applied egg-rr66.9%
Taylor expanded in b around 0 64.9%
if 1.04999999999999999e-104 < b Initial program 14.4%
Taylor expanded in b around inf 88.4%
associate-*r/88.4%
Applied egg-rr88.4%
Final simplification79.3%
(FPCore (a b c)
:precision binary64
(if (<= b -9.2e-100)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 1.75e-105)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -9.2e-100) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.75e-105) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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 <= (-9.2d-100)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 1.75d-105) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -9.2e-100) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.75e-105) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -9.2e-100: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 1.75e-105: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -9.2e-100) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.75e-105) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -9.2e-100) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 1.75e-105) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -9.2e-100], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.75e-105], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.2 \cdot 10^{-100}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-105}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.19999999999999978e-100Initial program 66.3%
Taylor expanded in b around -inf 80.9%
if -9.19999999999999978e-100 < b < 1.75e-105Initial program 67.0%
Taylor expanded in b around 0 64.9%
expm1-log1p-u62.8%
expm1-udef32.2%
neg-mul-132.2%
fma-def32.2%
*-commutative32.2%
associate-*r*32.2%
Applied egg-rr32.2%
expm1-def62.9%
expm1-log1p65.0%
fma-udef65.0%
neg-mul-165.0%
+-commutative65.0%
unsub-neg65.0%
Simplified65.0%
if 1.75e-105 < b Initial program 14.4%
Taylor expanded in b around inf 88.4%
associate-*r/88.4%
Applied egg-rr88.4%
Final simplification79.3%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / 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-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 67.9%
Taylor expanded in b around -inf 66.2%
if -9.999999999999969e-311 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
associate-*r/66.2%
Applied egg-rr66.2%
Final simplification66.2%
(FPCore (a b c) :precision binary64 (if (<= b 1.42e-307) (/ 1.0 (* (/ -1.5 b) a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.42e-307) {
tmp = 1.0 / ((-1.5 / b) * a);
} else {
tmp = (c * -0.5) / 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.42d-307) then
tmp = 1.0d0 / (((-1.5d0) / b) * a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.42e-307) {
tmp = 1.0 / ((-1.5 / b) * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.42e-307: tmp = 1.0 / ((-1.5 / b) * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.42e-307) tmp = Float64(1.0 / Float64(Float64(-1.5 / b) * a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.42e-307) tmp = 1.0 / ((-1.5 / b) * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.42e-307], N[(1.0 / N[(N[(-1.5 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.42 \cdot 10^{-307}:\\
\;\;\;\;\frac{1}{\frac{-1.5}{b} \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.42000000000000001e-307Initial program 67.9%
/-rgt-identity67.9%
metadata-eval67.9%
associate-/r/67.9%
metadata-eval67.9%
metadata-eval67.9%
times-frac67.9%
*-commutative67.9%
times-frac67.9%
*-commutative67.9%
associate-/r*67.7%
associate-*l/67.8%
Simplified67.8%
clear-num67.8%
inv-pow67.8%
*-commutative67.8%
fma-udef67.8%
associate-*r*67.8%
add-sqr-sqrt51.1%
hypot-def59.5%
Applied egg-rr59.5%
unpow-159.5%
*-commutative59.5%
associate-*r*59.5%
*-commutative59.5%
associate-*l*59.5%
Simplified59.5%
Taylor expanded in b around -inf 65.8%
associate-*r/65.8%
associate-/l*65.8%
Simplified65.8%
associate-/r/65.8%
Applied egg-rr65.8%
if 1.42000000000000001e-307 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
associate-*r/66.2%
Applied egg-rr66.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ 1.0 (/ -1.5 (/ b a))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = 1.0 / (-1.5 / (b / a));
} else {
tmp = (c * -0.5) / 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-310)) then
tmp = 1.0d0 / ((-1.5d0) / (b / a))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = 1.0 / (-1.5 / (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = 1.0 / (-1.5 / (b / a)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(1.0 / Float64(-1.5 / Float64(b / a))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = 1.0 / (-1.5 / (b / a)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(1.0 / N[(-1.5 / N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{-1.5}{\frac{b}{a}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 67.9%
/-rgt-identity67.9%
metadata-eval67.9%
associate-/r/67.9%
metadata-eval67.9%
metadata-eval67.9%
times-frac67.9%
*-commutative67.9%
times-frac67.9%
*-commutative67.9%
associate-/r*67.7%
associate-*l/67.8%
Simplified67.8%
clear-num67.8%
inv-pow67.8%
*-commutative67.8%
fma-udef67.8%
associate-*r*67.8%
add-sqr-sqrt51.1%
hypot-def59.5%
Applied egg-rr59.5%
unpow-159.5%
*-commutative59.5%
associate-*r*59.5%
*-commutative59.5%
associate-*l*59.5%
Simplified59.5%
Taylor expanded in b around -inf 65.8%
associate-*r/65.8%
associate-/l*65.8%
Simplified65.8%
if -9.999999999999969e-311 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
associate-*r/66.2%
Applied egg-rr66.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
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 <= (-1d-310)) 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 <= -1e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) 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 <= -1e-310) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], 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 -1 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 67.9%
Taylor expanded in b around -inf 65.7%
*-commutative65.7%
Simplified65.7%
if -9.999999999999969e-311 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ b (/ a -0.6666666666666666)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = b / (a / -0.6666666666666666);
} 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-310)) then
tmp = b / (a / (-0.6666666666666666d0))
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-310) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = b / (a / -0.6666666666666666) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(b / Float64(a / -0.6666666666666666)); 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-310) tmp = b / (a / -0.6666666666666666); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 67.9%
Taylor expanded in b around -inf 65.7%
*-commutative65.7%
Simplified65.7%
Taylor expanded in b around 0 65.7%
*-commutative65.7%
associate-*l/65.7%
associate-/l*65.7%
Simplified65.7%
if -9.999999999999969e-311 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b 1e-309) (/ b (/ a -0.6666666666666666)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1e-309) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / 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-309) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1e-309) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1e-309: tmp = b / (a / -0.6666666666666666) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1e-309) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1e-309) tmp = b / (a / -0.6666666666666666); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1e-309], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 10^{-309}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.000000000000002e-309Initial program 67.9%
Taylor expanded in b around -inf 65.7%
*-commutative65.7%
Simplified65.7%
Taylor expanded in b around 0 65.7%
*-commutative65.7%
associate-*l/65.7%
associate-/l*65.7%
Simplified65.7%
if 1.000000000000002e-309 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
associate-*r/66.2%
Applied egg-rr66.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / 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-310)) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 67.9%
Taylor expanded in b around -inf 65.7%
*-commutative65.7%
Simplified65.7%
associate-*l/65.7%
Applied egg-rr65.7%
if -9.999999999999969e-311 < b Initial program 30.0%
Taylor expanded in b around inf 66.2%
associate-*r/66.2%
Applied egg-rr66.2%
Final simplification66.0%
(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 47.1%
Taylor expanded in b around inf 37.5%
Final simplification37.5%
(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 47.1%
Taylor expanded in b around inf 25.5%
unpow225.5%
Simplified25.5%
Taylor expanded in b around 0 13.4%
Final simplification13.4%
herbie shell --seed 2023240
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))