
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (* i (+ (+ alpha beta) i)))
(t_1 (+ (+ alpha beta) (* 2.0 i)))
(t_2 (* t_1 t_1)))
(/ (/ (* t_0 (+ (* beta alpha) t_0)) t_2) (- t_2 1.0))))
double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0);
}
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
t_0 = i * ((alpha + beta) + i)
t_1 = (alpha + beta) + (2.0d0 * i)
t_2 = t_1 * t_1
code = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0d0)
end function
public static double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0);
}
def code(alpha, beta, i): t_0 = i * ((alpha + beta) + i) t_1 = (alpha + beta) + (2.0 * i) t_2 = t_1 * t_1 return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0)
function code(alpha, beta, i) t_0 = Float64(i * Float64(Float64(alpha + beta) + i)) t_1 = Float64(Float64(alpha + beta) + Float64(2.0 * i)) t_2 = Float64(t_1 * t_1) return Float64(Float64(Float64(t_0 * Float64(Float64(beta * alpha) + t_0)) / t_2) / Float64(t_2 - 1.0)) end
function tmp = code(alpha, beta, i) t_0 = i * ((alpha + beta) + i); t_1 = (alpha + beta) + (2.0 * i); t_2 = t_1 * t_1; tmp = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0); end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(i * N[(N[(alpha + beta), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, N[(N[(N[(t$95$0 * N[(N[(beta * alpha), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$2 - 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := i \cdot \left(\left(\alpha + \beta\right) + i\right)\\
t_1 := \left(\alpha + \beta\right) + 2 \cdot i\\
t_2 := t_1 \cdot t_1\\
\frac{\frac{t_0 \cdot \left(\beta \cdot \alpha + t_0\right)}{t_2}}{t_2 - 1}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (* i (+ (+ alpha beta) i)))
(t_1 (+ (+ alpha beta) (* 2.0 i)))
(t_2 (* t_1 t_1)))
(/ (/ (* t_0 (+ (* beta alpha) t_0)) t_2) (- t_2 1.0))))
double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0);
}
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
t_0 = i * ((alpha + beta) + i)
t_1 = (alpha + beta) + (2.0d0 * i)
t_2 = t_1 * t_1
code = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0d0)
end function
public static double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0);
}
def code(alpha, beta, i): t_0 = i * ((alpha + beta) + i) t_1 = (alpha + beta) + (2.0 * i) t_2 = t_1 * t_1 return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0)
function code(alpha, beta, i) t_0 = Float64(i * Float64(Float64(alpha + beta) + i)) t_1 = Float64(Float64(alpha + beta) + Float64(2.0 * i)) t_2 = Float64(t_1 * t_1) return Float64(Float64(Float64(t_0 * Float64(Float64(beta * alpha) + t_0)) / t_2) / Float64(t_2 - 1.0)) end
function tmp = code(alpha, beta, i) t_0 = i * ((alpha + beta) + i); t_1 = (alpha + beta) + (2.0 * i); t_2 = t_1 * t_1; tmp = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0); end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(i * N[(N[(alpha + beta), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, N[(N[(N[(t$95$0 * N[(N[(beta * alpha), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$2 - 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := i \cdot \left(\left(\alpha + \beta\right) + i\right)\\
t_1 := \left(\alpha + \beta\right) + 2 \cdot i\\
t_2 := t_1 \cdot t_1\\
\frac{\frac{t_0 \cdot \left(\beta \cdot \alpha + t_0\right)}{t_2}}{t_2 - 1}
\end{array}
\end{array}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (* 0.125 (/ beta i))))
(if (<= beta 2.05e+128)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (<= beta 7e+160)
(/ i (/ beta (/ i beta)))
(if (<= beta 1.95e+182)
(- (+ 0.0625 t_0) t_0)
(* (/ i beta) (/ (+ i alpha) beta)))))))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double t_0 = 0.125 * (beta / i);
double tmp;
if (beta <= 2.05e+128) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 7e+160) {
tmp = i / (beta / (i / beta));
} else if (beta <= 1.95e+182) {
tmp = (0.0625 + t_0) - t_0;
} else {
tmp = (i / beta) * ((i + alpha) / beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: t_0
real(8) :: tmp
t_0 = 0.125d0 * (beta / i)
if (beta <= 2.05d+128) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if (beta <= 7d+160) then
tmp = i / (beta / (i / beta))
else if (beta <= 1.95d+182) then
tmp = (0.0625d0 + t_0) - t_0
else
tmp = (i / beta) * ((i + alpha) / beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double t_0 = 0.125 * (beta / i);
double tmp;
if (beta <= 2.05e+128) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 7e+160) {
tmp = i / (beta / (i / beta));
} else if (beta <= 1.95e+182) {
tmp = (0.0625 + t_0) - t_0;
} else {
tmp = (i / beta) * ((i + alpha) / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): t_0 = 0.125 * (beta / i) tmp = 0 if beta <= 2.05e+128: tmp = 0.0625 + (0.015625 / (i * i)) elif beta <= 7e+160: tmp = i / (beta / (i / beta)) elif beta <= 1.95e+182: tmp = (0.0625 + t_0) - t_0 else: tmp = (i / beta) * ((i + alpha) / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) t_0 = Float64(0.125 * Float64(beta / i)) tmp = 0.0 if (beta <= 2.05e+128) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif (beta <= 7e+160) tmp = Float64(i / Float64(beta / Float64(i / beta))); elseif (beta <= 1.95e+182) tmp = Float64(Float64(0.0625 + t_0) - t_0); else tmp = Float64(Float64(i / beta) * Float64(Float64(i + alpha) / beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
t_0 = 0.125 * (beta / i);
tmp = 0.0;
if (beta <= 2.05e+128)
tmp = 0.0625 + (0.015625 / (i * i));
elseif (beta <= 7e+160)
tmp = i / (beta / (i / beta));
elseif (beta <= 1.95e+182)
tmp = (0.0625 + t_0) - t_0;
else
tmp = (i / beta) * ((i + alpha) / beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(0.125 * N[(beta / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[beta, 2.05e+128], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 7e+160], N[(i / N[(beta / N[(i / beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.95e+182], N[(N[(0.0625 + t$95$0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(i / beta), $MachinePrecision] * N[(N[(i + alpha), $MachinePrecision] / beta), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \frac{\beta}{i}\\
\mathbf{if}\;\beta \leq 2.05 \cdot 10^{+128}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 7 \cdot 10^{+160}:\\
\;\;\;\;\frac{i}{\frac{\beta}{\frac{i}{\beta}}}\\
\mathbf{elif}\;\beta \leq 1.95 \cdot 10^{+182}:\\
\;\;\;\;\left(0.0625 + t_0\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i + \alpha}{\beta}\\
\end{array}
\end{array}
if beta < 2.05000000000000006e128Initial program 18.9%
Taylor expanded in i around inf 42.4%
*-commutative42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in i around inf 36.3%
*-commutative36.3%
unpow236.3%
Simplified36.3%
Taylor expanded in i around inf 80.7%
associate-*r/80.7%
metadata-eval80.7%
unpow280.7%
Simplified80.7%
if 2.05000000000000006e128 < beta < 7.00000000000000051e160Initial program 8.5%
associate-/l/0.5%
associate-*l*0.5%
times-frac16.0%
Simplified46.4%
Taylor expanded in beta around inf 47.5%
associate-/l*48.5%
unpow248.5%
Simplified48.5%
Taylor expanded in alpha around 0 48.7%
unpow248.7%
Simplified48.7%
Taylor expanded in beta around 0 48.7%
unpow248.7%
associate-/l*63.5%
Simplified63.5%
if 7.00000000000000051e160 < beta < 1.9499999999999999e182Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 53.2%
Taylor expanded in alpha around 0 52.1%
Taylor expanded in alpha around 0 53.2%
if 1.9499999999999999e182 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified10.3%
Taylor expanded in beta around inf 20.4%
associate-/l*22.1%
unpow222.1%
Simplified22.1%
div-inv22.1%
associate-/l*46.8%
Applied egg-rr46.8%
associate-*r/46.8%
*-rgt-identity46.8%
associate-/r/78.9%
Simplified78.9%
Final simplification78.9%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 4.9e+129)
0.0625
(if (or (<= beta 5.3e+159) (not (<= beta 8.5e+181)))
(* (/ i beta) (/ i beta))
0.0625)))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 4.9e+129) {
tmp = 0.0625;
} else if ((beta <= 5.3e+159) || !(beta <= 8.5e+181)) {
tmp = (i / beta) * (i / beta);
} else {
tmp = 0.0625;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 4.9d+129) then
tmp = 0.0625d0
else if ((beta <= 5.3d+159) .or. (.not. (beta <= 8.5d+181))) then
tmp = (i / beta) * (i / beta)
else
tmp = 0.0625d0
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 4.9e+129) {
tmp = 0.0625;
} else if ((beta <= 5.3e+159) || !(beta <= 8.5e+181)) {
tmp = (i / beta) * (i / beta);
} else {
tmp = 0.0625;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 4.9e+129: tmp = 0.0625 elif (beta <= 5.3e+159) or not (beta <= 8.5e+181): tmp = (i / beta) * (i / beta) else: tmp = 0.0625 return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 4.9e+129) tmp = 0.0625; elseif ((beta <= 5.3e+159) || !(beta <= 8.5e+181)) tmp = Float64(Float64(i / beta) * Float64(i / beta)); else tmp = 0.0625; end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 4.9e+129)
tmp = 0.0625;
elseif ((beta <= 5.3e+159) || ~((beta <= 8.5e+181)))
tmp = (i / beta) * (i / beta);
else
tmp = 0.0625;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_, i_] := If[LessEqual[beta, 4.9e+129], 0.0625, If[Or[LessEqual[beta, 5.3e+159], N[Not[LessEqual[beta, 8.5e+181]], $MachinePrecision]], N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision], 0.0625]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 4.9 \cdot 10^{+129}:\\
\;\;\;\;0.0625\\
\mathbf{elif}\;\beta \leq 5.3 \cdot 10^{+159} \lor \neg \left(\beta \leq 8.5 \cdot 10^{+181}\right):\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if beta < 4.9e129 or 5.2999999999999997e159 < beta < 8.49999999999999966e181Initial program 18.3%
associate-/l/16.7%
associate-*l*16.6%
times-frac25.4%
Simplified44.5%
Taylor expanded in i around inf 79.4%
if 4.9e129 < beta < 5.2999999999999997e159 or 8.49999999999999966e181 < beta Initial program 2.1%
associate-/l/0.1%
associate-*l*0.1%
times-frac4.0%
Simplified19.5%
Taylor expanded in beta around inf 27.5%
associate-/l*29.1%
unpow229.1%
Simplified29.1%
Taylor expanded in alpha around 0 29.1%
unpow229.1%
Simplified29.1%
Taylor expanded in i around 0 27.8%
unpow227.8%
unpow227.8%
times-frac70.0%
Simplified70.0%
Final simplification77.5%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 4.3e+126)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (or (<= beta 1.1e+160) (not (<= beta 8.5e+181)))
(* (/ i beta) (/ i beta))
0.0625)))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 4.3e+126) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if ((beta <= 1.1e+160) || !(beta <= 8.5e+181)) {
tmp = (i / beta) * (i / beta);
} else {
tmp = 0.0625;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 4.3d+126) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if ((beta <= 1.1d+160) .or. (.not. (beta <= 8.5d+181))) then
tmp = (i / beta) * (i / beta)
else
tmp = 0.0625d0
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 4.3e+126) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if ((beta <= 1.1e+160) || !(beta <= 8.5e+181)) {
tmp = (i / beta) * (i / beta);
} else {
tmp = 0.0625;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 4.3e+126: tmp = 0.0625 + (0.015625 / (i * i)) elif (beta <= 1.1e+160) or not (beta <= 8.5e+181): tmp = (i / beta) * (i / beta) else: tmp = 0.0625 return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 4.3e+126) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif ((beta <= 1.1e+160) || !(beta <= 8.5e+181)) tmp = Float64(Float64(i / beta) * Float64(i / beta)); else tmp = 0.0625; end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 4.3e+126)
tmp = 0.0625 + (0.015625 / (i * i));
elseif ((beta <= 1.1e+160) || ~((beta <= 8.5e+181)))
tmp = (i / beta) * (i / beta);
else
tmp = 0.0625;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_, i_] := If[LessEqual[beta, 4.3e+126], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[beta, 1.1e+160], N[Not[LessEqual[beta, 8.5e+181]], $MachinePrecision]], N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision], 0.0625]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 4.3 \cdot 10^{+126}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 1.1 \cdot 10^{+160} \lor \neg \left(\beta \leq 8.5 \cdot 10^{+181}\right):\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if beta < 4.3000000000000002e126Initial program 18.9%
Taylor expanded in i around inf 42.4%
*-commutative42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in i around inf 36.3%
*-commutative36.3%
unpow236.3%
Simplified36.3%
Taylor expanded in i around inf 80.7%
associate-*r/80.7%
metadata-eval80.7%
unpow280.7%
Simplified80.7%
if 4.3000000000000002e126 < beta < 1.09999999999999996e160 or 8.49999999999999966e181 < beta Initial program 2.1%
associate-/l/0.1%
associate-*l*0.1%
times-frac3.9%
Simplified19.2%
Taylor expanded in beta around inf 27.1%
associate-/l*28.6%
unpow228.6%
Simplified28.6%
Taylor expanded in alpha around 0 28.6%
unpow228.6%
Simplified28.6%
Taylor expanded in i around 0 27.4%
unpow227.4%
unpow227.4%
times-frac68.8%
Simplified68.8%
if 1.09999999999999996e160 < beta < 8.49999999999999966e181Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 53.0%
Final simplification77.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 7.8e+127)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (<= beta 4.1e+161)
(/ i (/ beta (/ i beta)))
(if (<= beta 1.25e+182) 0.0625 (* (/ i beta) (/ i beta))))))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 7.8e+127) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 4.1e+161) {
tmp = i / (beta / (i / beta));
} else if (beta <= 1.25e+182) {
tmp = 0.0625;
} else {
tmp = (i / beta) * (i / beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 7.8d+127) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if (beta <= 4.1d+161) then
tmp = i / (beta / (i / beta))
else if (beta <= 1.25d+182) then
tmp = 0.0625d0
else
tmp = (i / beta) * (i / beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 7.8e+127) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 4.1e+161) {
tmp = i / (beta / (i / beta));
} else if (beta <= 1.25e+182) {
tmp = 0.0625;
} else {
tmp = (i / beta) * (i / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 7.8e+127: tmp = 0.0625 + (0.015625 / (i * i)) elif beta <= 4.1e+161: tmp = i / (beta / (i / beta)) elif beta <= 1.25e+182: tmp = 0.0625 else: tmp = (i / beta) * (i / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 7.8e+127) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif (beta <= 4.1e+161) tmp = Float64(i / Float64(beta / Float64(i / beta))); elseif (beta <= 1.25e+182) tmp = 0.0625; else tmp = Float64(Float64(i / beta) * Float64(i / beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 7.8e+127)
tmp = 0.0625 + (0.015625 / (i * i));
elseif (beta <= 4.1e+161)
tmp = i / (beta / (i / beta));
elseif (beta <= 1.25e+182)
tmp = 0.0625;
else
tmp = (i / beta) * (i / beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_, i_] := If[LessEqual[beta, 7.8e+127], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 4.1e+161], N[(i / N[(beta / N[(i / beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.25e+182], 0.0625, N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 7.8 \cdot 10^{+127}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 4.1 \cdot 10^{+161}:\\
\;\;\;\;\frac{i}{\frac{\beta}{\frac{i}{\beta}}}\\
\mathbf{elif}\;\beta \leq 1.25 \cdot 10^{+182}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\end{array}
\end{array}
if beta < 7.79999999999999962e127Initial program 18.9%
Taylor expanded in i around inf 42.4%
*-commutative42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in i around inf 36.3%
*-commutative36.3%
unpow236.3%
Simplified36.3%
Taylor expanded in i around inf 80.7%
associate-*r/80.7%
metadata-eval80.7%
unpow280.7%
Simplified80.7%
if 7.79999999999999962e127 < beta < 4.1000000000000001e161Initial program 8.5%
associate-/l/0.5%
associate-*l*0.5%
times-frac16.0%
Simplified46.4%
Taylor expanded in beta around inf 47.5%
associate-/l*48.5%
unpow248.5%
Simplified48.5%
Taylor expanded in alpha around 0 48.7%
unpow248.7%
Simplified48.7%
Taylor expanded in beta around 0 48.7%
unpow248.7%
associate-/l*63.5%
Simplified63.5%
if 4.1000000000000001e161 < beta < 1.24999999999999993e182Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 53.0%
if 1.24999999999999993e182 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified10.3%
Taylor expanded in beta around inf 20.4%
associate-/l*22.1%
unpow222.1%
Simplified22.1%
Taylor expanded in alpha around 0 22.1%
unpow222.1%
Simplified22.1%
Taylor expanded in i around 0 20.5%
unpow220.5%
unpow220.5%
times-frac70.6%
Simplified70.6%
Final simplification77.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta i) :precision binary64 (if (<= beta 8e+129) (+ 0.0625 (/ 0.015625 (* i i))) (* (/ i beta) (/ (+ i alpha) beta))))
assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 8e+129) {
tmp = 0.0625 + (0.015625 / (i * i));
} else {
tmp = (i / beta) * ((i + alpha) / beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 8d+129) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else
tmp = (i / beta) * ((i + alpha) / beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 8e+129) {
tmp = 0.0625 + (0.015625 / (i * i));
} else {
tmp = (i / beta) * ((i + alpha) / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 8e+129: tmp = 0.0625 + (0.015625 / (i * i)) else: tmp = (i / beta) * ((i + alpha) / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 8e+129) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); else tmp = Float64(Float64(i / beta) * Float64(Float64(i + alpha) / beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 8e+129)
tmp = 0.0625 + (0.015625 / (i * i));
else
tmp = (i / beta) * ((i + alpha) / beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_, i_] := If[LessEqual[beta, 8e+129], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i / beta), $MachinePrecision] * N[(N[(i + alpha), $MachinePrecision] / beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 8 \cdot 10^{+129}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i + \alpha}{\beta}\\
\end{array}
\end{array}
if beta < 8e129Initial program 18.8%
Taylor expanded in i around inf 42.2%
*-commutative42.2%
unpow242.2%
Simplified42.2%
Taylor expanded in i around inf 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in i around inf 80.3%
associate-*r/80.3%
metadata-eval80.3%
unpow280.3%
Simplified80.3%
if 8e129 < beta Initial program 1.9%
associate-/l/0.1%
associate-*l*0.1%
times-frac3.6%
Simplified17.5%
Taylor expanded in beta around inf 24.8%
associate-/l*26.5%
unpow226.5%
Simplified26.5%
div-inv26.5%
associate-/l*48.0%
Applied egg-rr48.0%
associate-*r/48.0%
*-rgt-identity48.0%
associate-/r/70.1%
Simplified70.1%
Final simplification78.0%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta i) :precision binary64 (if (<= beta 7.8e+202) 0.0625 (* (/ i beta) (/ alpha beta))))
assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 7.8e+202) {
tmp = 0.0625;
} else {
tmp = (i / beta) * (alpha / beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 7.8d+202) then
tmp = 0.0625d0
else
tmp = (i / beta) * (alpha / beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 7.8e+202) {
tmp = 0.0625;
} else {
tmp = (i / beta) * (alpha / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 7.8e+202: tmp = 0.0625 else: tmp = (i / beta) * (alpha / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 7.8e+202) tmp = 0.0625; else tmp = Float64(Float64(i / beta) * Float64(alpha / beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 7.8e+202)
tmp = 0.0625;
else
tmp = (i / beta) * (alpha / beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_, i_] := If[LessEqual[beta, 7.8e+202], 0.0625, N[(N[(i / beta), $MachinePrecision] * N[(alpha / beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 7.8 \cdot 10^{+202}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{\alpha}{\beta}\\
\end{array}
\end{array}
if beta < 7.79999999999999967e202Initial program 17.0%
associate-/l/15.1%
associate-*l*15.0%
times-frac23.8%
Simplified42.9%
Taylor expanded in i around inf 73.9%
if 7.79999999999999967e202 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified13.3%
Taylor expanded in beta around inf 26.1%
associate-/l*28.1%
unpow228.1%
Simplified28.1%
*-un-lft-identity28.1%
associate-/l*44.9%
Applied egg-rr44.9%
*-lft-identity44.9%
associate-/r/44.9%
Simplified44.9%
Taylor expanded in i around 0 27.3%
*-commutative27.3%
unpow227.3%
times-frac39.9%
Simplified39.9%
Final simplification69.9%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta i) :precision binary64 0.0625)
assert(alpha < beta);
double code(double alpha, double beta, double i) {
return 0.0625;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta, i)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
code = 0.0625d0
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
return 0.0625;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): return 0.0625
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) return 0.0625 end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta, i)
tmp = 0.0625;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_, i_] := 0.0625
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
0.0625
\end{array}
Initial program 15.0%
associate-/l/13.3%
associate-*l*13.2%
times-frac21.0%
Simplified39.4%
Taylor expanded in i around inf 66.9%
Final simplification66.9%
herbie shell --seed 2023287
(FPCore (alpha beta i)
:name "Octave 3.8, jcobi/4"
:precision binary64
:pre (and (and (> alpha -1.0) (> beta -1.0)) (> i 1.0))
(/ (/ (* (* i (+ (+ alpha beta) i)) (+ (* beta alpha) (* i (+ (+ alpha beta) i)))) (* (+ (+ alpha beta) (* 2.0 i)) (+ (+ alpha beta) (* 2.0 i)))) (- (* (+ (+ alpha beta) (* 2.0 i)) (+ (+ alpha beta) (* 2.0 i))) 1.0)))