
(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 6 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
(if (<= beta 1.9e+148)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (<= beta 3.3e+177)
(* (/ i beta) (/ i beta))
(if (<= beta 6e+182) 0.0625 (* (/ i beta) (/ (+ i alpha) beta))))))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.9e+148) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 3.3e+177) {
tmp = (i / beta) * (i / beta);
} else if (beta <= 6e+182) {
tmp = 0.0625;
} 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 <= 1.9d+148) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if (beta <= 3.3d+177) then
tmp = (i / beta) * (i / beta)
else if (beta <= 6d+182) then
tmp = 0.0625d0
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 <= 1.9e+148) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 3.3e+177) {
tmp = (i / beta) * (i / beta);
} else if (beta <= 6e+182) {
tmp = 0.0625;
} else {
tmp = (i / beta) * ((i + alpha) / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 1.9e+148: tmp = 0.0625 + (0.015625 / (i * i)) elif beta <= 3.3e+177: tmp = (i / beta) * (i / beta) elif beta <= 6e+182: tmp = 0.0625 else: tmp = (i / beta) * ((i + alpha) / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 1.9e+148) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif (beta <= 3.3e+177) tmp = Float64(Float64(i / beta) * Float64(i / beta)); elseif (beta <= 6e+182) tmp = 0.0625; 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 <= 1.9e+148)
tmp = 0.0625 + (0.015625 / (i * i));
elseif (beta <= 3.3e+177)
tmp = (i / beta) * (i / beta);
elseif (beta <= 6e+182)
tmp = 0.0625;
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, 1.9e+148], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 3.3e+177], N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 6e+182], 0.0625, 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 1.9 \cdot 10^{+148}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 3.3 \cdot 10^{+177}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{elif}\;\beta \leq 6 \cdot 10^{+182}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i + \alpha}{\beta}\\
\end{array}
\end{array}
if beta < 1.8999999999999999e148Initial program 24.1%
Taylor expanded in i around inf 45.2%
*-commutative45.2%
unpow245.2%
Simplified45.2%
Taylor expanded in i around inf 41.9%
*-commutative41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in i around inf 80.6%
associate-*r/80.6%
metadata-eval80.6%
unpow280.6%
Simplified80.6%
if 1.8999999999999999e148 < beta < 3.3000000000000001e177Initial program 9.8%
associate-/l/1.1%
associate-*l*1.1%
times-frac9.8%
Simplified37.2%
Taylor expanded in beta around inf 31.3%
associate-/l*32.2%
unpow232.2%
+-commutative32.2%
Simplified32.2%
div-inv32.2%
Applied egg-rr32.2%
associate-*l*58.0%
Simplified58.0%
Taylor expanded in i around inf 31.3%
unpow231.3%
unpow231.3%
times-frac58.0%
Simplified58.0%
if 3.3000000000000001e177 < beta < 6.0000000000000004e182Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 100.0%
if 6.0000000000000004e182 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified5.4%
Applied egg-rr0.0%
Taylor expanded in alpha around 0 0.0%
Taylor expanded in beta around inf 26.7%
unpow226.7%
times-frac80.0%
+-commutative80.0%
Simplified80.0%
Final simplification79.7%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 6.8e+148)
0.0625
(if (or (<= beta 1.7e+177) (not (<= beta 5.5e+183)))
(* (/ i beta) (/ i beta))
0.0625)))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 6.8e+148) {
tmp = 0.0625;
} else if ((beta <= 1.7e+177) || !(beta <= 5.5e+183)) {
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 <= 6.8d+148) then
tmp = 0.0625d0
else if ((beta <= 1.7d+177) .or. (.not. (beta <= 5.5d+183))) 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 <= 6.8e+148) {
tmp = 0.0625;
} else if ((beta <= 1.7e+177) || !(beta <= 5.5e+183)) {
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 <= 6.8e+148: tmp = 0.0625 elif (beta <= 1.7e+177) or not (beta <= 5.5e+183): 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 <= 6.8e+148) tmp = 0.0625; elseif ((beta <= 1.7e+177) || !(beta <= 5.5e+183)) 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 <= 6.8e+148)
tmp = 0.0625;
elseif ((beta <= 1.7e+177) || ~((beta <= 5.5e+183)))
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, 6.8e+148], 0.0625, If[Or[LessEqual[beta, 1.7e+177], N[Not[LessEqual[beta, 5.5e+183]], $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 6.8 \cdot 10^{+148}:\\
\;\;\;\;0.0625\\
\mathbf{elif}\;\beta \leq 1.7 \cdot 10^{+177} \lor \neg \left(\beta \leq 5.5 \cdot 10^{+183}\right):\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if beta < 6.8000000000000006e148 or 1.6999999999999999e177 < beta < 5.5e183Initial program 23.8%
associate-/l/21.8%
associate-*l*21.7%
times-frac30.7%
Simplified48.2%
Taylor expanded in i around inf 80.0%
if 6.8000000000000006e148 < beta < 1.6999999999999999e177 or 5.5e183 < beta Initial program 2.2%
associate-/l/0.3%
associate-*l*0.3%
times-frac2.2%
Simplified12.5%
Taylor expanded in beta around inf 27.7%
associate-/l*29.5%
unpow229.5%
+-commutative29.5%
Simplified29.5%
div-inv29.5%
Applied egg-rr29.5%
associate-*l*57.4%
Simplified57.4%
Taylor expanded in i around inf 27.9%
unpow227.9%
unpow227.9%
times-frac71.5%
Simplified71.5%
Final simplification78.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 1.28e+148)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (or (<= beta 1.5e+178) (not (<= beta 4.5e+182)))
(* (/ i beta) (/ i beta))
0.0625)))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.28e+148) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if ((beta <= 1.5e+178) || !(beta <= 4.5e+182)) {
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 <= 1.28d+148) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if ((beta <= 1.5d+178) .or. (.not. (beta <= 4.5d+182))) 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 <= 1.28e+148) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if ((beta <= 1.5e+178) || !(beta <= 4.5e+182)) {
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 <= 1.28e+148: tmp = 0.0625 + (0.015625 / (i * i)) elif (beta <= 1.5e+178) or not (beta <= 4.5e+182): 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 <= 1.28e+148) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif ((beta <= 1.5e+178) || !(beta <= 4.5e+182)) 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 <= 1.28e+148)
tmp = 0.0625 + (0.015625 / (i * i));
elseif ((beta <= 1.5e+178) || ~((beta <= 4.5e+182)))
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, 1.28e+148], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[beta, 1.5e+178], N[Not[LessEqual[beta, 4.5e+182]], $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 1.28 \cdot 10^{+148}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 1.5 \cdot 10^{+178} \lor \neg \left(\beta \leq 4.5 \cdot 10^{+182}\right):\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if beta < 1.27999999999999992e148Initial program 24.1%
Taylor expanded in i around inf 45.2%
*-commutative45.2%
unpow245.2%
Simplified45.2%
Taylor expanded in i around inf 41.9%
*-commutative41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in i around inf 80.6%
associate-*r/80.6%
metadata-eval80.6%
unpow280.6%
Simplified80.6%
if 1.27999999999999992e148 < beta < 1.50000000000000008e178 or 4.50000000000000029e182 < beta Initial program 2.2%
associate-/l/0.3%
associate-*l*0.3%
times-frac2.2%
Simplified12.5%
Taylor expanded in beta around inf 27.7%
associate-/l*29.5%
unpow229.5%
+-commutative29.5%
Simplified29.5%
div-inv29.5%
Applied egg-rr29.5%
associate-*l*57.4%
Simplified57.4%
Taylor expanded in i around inf 27.9%
unpow227.9%
unpow227.9%
times-frac71.5%
Simplified71.5%
if 1.50000000000000008e178 < beta < 4.50000000000000029e182Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 100.0%
Final simplification79.0%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta i) :precision binary64 (if (<= beta 1.12e+223) 0.0625 (* (/ i beta) (/ alpha beta))))
assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.12e+223) {
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 <= 1.12d+223) 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 <= 1.12e+223) {
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 <= 1.12e+223: 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 <= 1.12e+223) 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 <= 1.12e+223)
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, 1.12e+223], 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 1.12 \cdot 10^{+223}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{\alpha}{\beta}\\
\end{array}
\end{array}
if beta < 1.1200000000000001e223Initial program 22.0%
associate-/l/19.7%
associate-*l*19.7%
times-frac28.2%
Simplified45.4%
Taylor expanded in i around inf 75.9%
if 1.1200000000000001e223 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified7.4%
Taylor expanded in beta around inf 37.1%
associate-/l*38.9%
unpow238.9%
+-commutative38.9%
Simplified38.9%
div-inv38.9%
Applied egg-rr38.9%
associate-*l*57.3%
Simplified57.3%
Taylor expanded in i around 0 38.7%
unpow238.7%
times-frac45.8%
Simplified45.8%
Final simplification72.7%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta i) :precision binary64 (if (<= beta 2.65e+222) 0.0625 (/ 0.0 i)))
assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 2.65e+222) {
tmp = 0.0625;
} else {
tmp = 0.0 / i;
}
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 <= 2.65d+222) then
tmp = 0.0625d0
else
tmp = 0.0d0 / i
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 2.65e+222) {
tmp = 0.0625;
} else {
tmp = 0.0 / i;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 2.65e+222: tmp = 0.0625 else: tmp = 0.0 / i return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 2.65e+222) tmp = 0.0625; else tmp = Float64(0.0 / i); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 2.65e+222)
tmp = 0.0625;
else
tmp = 0.0 / i;
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, 2.65e+222], 0.0625, N[(0.0 / i), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.65 \cdot 10^{+222}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{i}\\
\end{array}
\end{array}
if beta < 2.64999999999999996e222Initial program 22.0%
associate-/l/19.7%
associate-*l*19.7%
times-frac28.2%
Simplified45.4%
Taylor expanded in i around inf 75.9%
if 2.64999999999999996e222 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified7.4%
Taylor expanded in i around inf 49.6%
add-cbrt-cube49.6%
Applied egg-rr14.7%
associate-*l*14.7%
Simplified14.7%
Taylor expanded in i around 0 38.9%
distribute-rgt-out38.9%
metadata-eval38.9%
mul0-rgt38.9%
Simplified38.9%
Final simplification72.0%
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 19.7%
associate-/l/17.7%
associate-*l*17.6%
times-frac25.3%
Simplified41.4%
Taylor expanded in i around inf 69.5%
Final simplification69.5%
herbie shell --seed 2023275
(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)))