
(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 5e+154)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (<= beta 2.95e+196)
(* (/ i beta) (/ i beta))
(if (<= beta 6.2e+206)
0.0625
(/ (* (/ i beta) (- (- i) alpha)) (- beta))))))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 5e+154) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 2.95e+196) {
tmp = (i / beta) * (i / beta);
} else if (beta <= 6.2e+206) {
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 <= 5d+154) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if (beta <= 2.95d+196) then
tmp = (i / beta) * (i / beta)
else if (beta <= 6.2d+206) 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 <= 5e+154) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 2.95e+196) {
tmp = (i / beta) * (i / beta);
} else if (beta <= 6.2e+206) {
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 <= 5e+154: tmp = 0.0625 + (0.015625 / (i * i)) elif beta <= 2.95e+196: tmp = (i / beta) * (i / beta) elif beta <= 6.2e+206: 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 <= 5e+154) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif (beta <= 2.95e+196) tmp = Float64(Float64(i / beta) * Float64(i / beta)); elseif (beta <= 6.2e+206) tmp = 0.0625; else tmp = Float64(Float64(Float64(i / beta) * Float64(Float64(-i) - alpha)) / Float64(-beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 5e+154)
tmp = 0.0625 + (0.015625 / (i * i));
elseif (beta <= 2.95e+196)
tmp = (i / beta) * (i / beta);
elseif (beta <= 6.2e+206)
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, 5e+154], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 2.95e+196], N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 6.2e+206], 0.0625, N[(N[(N[(i / beta), $MachinePrecision] * N[((-i) - alpha), $MachinePrecision]), $MachinePrecision] / (-beta)), $MachinePrecision]]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 5 \cdot 10^{+154}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 2.95 \cdot 10^{+196}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{elif}\;\beta \leq 6.2 \cdot 10^{+206}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{\beta} \cdot \left(\left(-i\right) - \alpha\right)}{-\beta}\\
\end{array}
\end{array}
if beta < 5.00000000000000004e154Initial program 23.6%
Taylor expanded in i around inf 41.4%
*-commutative41.4%
unpow241.4%
Simplified41.4%
Taylor expanded in i around inf 38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in i around inf 76.5%
associate-*r/76.5%
metadata-eval76.5%
unpow276.5%
Simplified76.5%
if 5.00000000000000004e154 < beta < 2.9499999999999999e196Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified2.2%
Taylor expanded in beta around inf 9.3%
*-commutative9.3%
associate-/l*18.0%
+-commutative18.0%
unpow218.0%
Simplified18.0%
associate-/r/18.0%
+-commutative18.0%
Applied egg-rr18.0%
clear-num18.0%
inv-pow18.0%
add-sqr-sqrt18.0%
sqrt-unprod2.2%
sqr-neg2.2%
mul-1-neg2.2%
mul-1-neg2.2%
sqrt-unprod0.0%
add-sqr-sqrt18.0%
associate-/l*2.8%
add-sqr-sqrt0.0%
sqrt-unprod30.7%
mul-1-neg30.7%
mul-1-neg30.7%
sqr-neg30.7%
sqrt-unprod38.9%
add-sqr-sqrt38.9%
Applied egg-rr38.9%
unpow-138.9%
associate-/r/42.0%
Simplified42.0%
Taylor expanded in i around inf 16.4%
unpow216.4%
associate-/r*43.0%
unpow243.0%
associate-*l/50.7%
associate-*r/51.0%
Simplified51.0%
if 2.9499999999999999e196 < beta < 6.19999999999999981e206Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 64.8%
if 6.19999999999999981e206 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified5.0%
Taylor expanded in beta around inf 30.7%
*-commutative30.7%
associate-/l*33.3%
+-commutative33.3%
unpow233.3%
Simplified33.3%
associate-/r/33.3%
+-commutative33.3%
Applied egg-rr33.3%
add-sqr-sqrt33.3%
pow233.3%
associate-*l/30.7%
sqrt-div30.7%
sqrt-prod40.0%
add-sqr-sqrt40.0%
Applied egg-rr40.0%
unpow240.0%
clear-num40.0%
frac-2neg40.0%
frac-times32.2%
*-un-lft-identity32.2%
*-commutative32.2%
*-commutative32.2%
Applied egg-rr32.2%
*-commutative32.2%
associate-*r/30.7%
associate-/l*30.7%
*-commutative30.7%
*-commutative30.7%
associate-/r*40.0%
distribute-rgt-neg-out40.0%
rem-square-sqrt40.0%
distribute-rgt-neg-in40.0%
*-commutative40.0%
associate-*r/78.2%
distribute-lft-neg-out78.2%
distribute-rgt-neg-in78.2%
distribute-neg-frac78.2%
Simplified78.2%
Final simplification75.1%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 5.6e+154)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (<= beta 2.95e+196)
(* (/ i beta) (/ i beta))
(if (<= beta 3.7e+207)
0.0625
(/ 1.0 (* (/ beta i) (/ beta (+ i alpha))))))))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 5.6e+154) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 2.95e+196) {
tmp = (i / beta) * (i / beta);
} else if (beta <= 3.7e+207) {
tmp = 0.0625;
} else {
tmp = 1.0 / ((beta / i) * (beta / (i + alpha)));
}
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 <= 5.6d+154) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if (beta <= 2.95d+196) then
tmp = (i / beta) * (i / beta)
else if (beta <= 3.7d+207) then
tmp = 0.0625d0
else
tmp = 1.0d0 / ((beta / i) * (beta / (i + alpha)))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 5.6e+154) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if (beta <= 2.95e+196) {
tmp = (i / beta) * (i / beta);
} else if (beta <= 3.7e+207) {
tmp = 0.0625;
} else {
tmp = 1.0 / ((beta / i) * (beta / (i + alpha)));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta, i): tmp = 0 if beta <= 5.6e+154: tmp = 0.0625 + (0.015625 / (i * i)) elif beta <= 2.95e+196: tmp = (i / beta) * (i / beta) elif beta <= 3.7e+207: tmp = 0.0625 else: tmp = 1.0 / ((beta / i) * (beta / (i + alpha))) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta, i) tmp = 0.0 if (beta <= 5.6e+154) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif (beta <= 2.95e+196) tmp = Float64(Float64(i / beta) * Float64(i / beta)); elseif (beta <= 3.7e+207) tmp = 0.0625; else tmp = Float64(1.0 / Float64(Float64(beta / i) * Float64(beta / Float64(i + alpha)))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta, i)
tmp = 0.0;
if (beta <= 5.6e+154)
tmp = 0.0625 + (0.015625 / (i * i));
elseif (beta <= 2.95e+196)
tmp = (i / beta) * (i / beta);
elseif (beta <= 3.7e+207)
tmp = 0.0625;
else
tmp = 1.0 / ((beta / i) * (beta / (i + alpha)));
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, 5.6e+154], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 2.95e+196], N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 3.7e+207], 0.0625, N[(1.0 / N[(N[(beta / i), $MachinePrecision] * N[(beta / N[(i + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 5.6 \cdot 10^{+154}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 2.95 \cdot 10^{+196}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{elif}\;\beta \leq 3.7 \cdot 10^{+207}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\beta}{i} \cdot \frac{\beta}{i + \alpha}}\\
\end{array}
\end{array}
if beta < 5.5999999999999998e154Initial program 23.6%
Taylor expanded in i around inf 41.4%
*-commutative41.4%
unpow241.4%
Simplified41.4%
Taylor expanded in i around inf 38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in i around inf 76.5%
associate-*r/76.5%
metadata-eval76.5%
unpow276.5%
Simplified76.5%
if 5.5999999999999998e154 < beta < 2.9499999999999999e196Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified2.2%
Taylor expanded in beta around inf 9.3%
*-commutative9.3%
associate-/l*18.0%
+-commutative18.0%
unpow218.0%
Simplified18.0%
associate-/r/18.0%
+-commutative18.0%
Applied egg-rr18.0%
clear-num18.0%
inv-pow18.0%
add-sqr-sqrt18.0%
sqrt-unprod2.2%
sqr-neg2.2%
mul-1-neg2.2%
mul-1-neg2.2%
sqrt-unprod0.0%
add-sqr-sqrt18.0%
associate-/l*2.8%
add-sqr-sqrt0.0%
sqrt-unprod30.7%
mul-1-neg30.7%
mul-1-neg30.7%
sqr-neg30.7%
sqrt-unprod38.9%
add-sqr-sqrt38.9%
Applied egg-rr38.9%
unpow-138.9%
associate-/r/42.0%
Simplified42.0%
Taylor expanded in i around inf 16.4%
unpow216.4%
associate-/r*43.0%
unpow243.0%
associate-*l/50.7%
associate-*r/51.0%
Simplified51.0%
if 2.9499999999999999e196 < beta < 3.7e207Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 64.8%
if 3.7e207 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified5.0%
Taylor expanded in beta around inf 30.7%
*-commutative30.7%
associate-/l*33.3%
+-commutative33.3%
unpow233.3%
Simplified33.3%
associate-/r/33.3%
+-commutative33.3%
Applied egg-rr33.3%
add-sqr-sqrt33.3%
pow233.3%
associate-*l/30.7%
sqrt-div30.7%
sqrt-prod40.0%
add-sqr-sqrt40.0%
Applied egg-rr40.0%
unpow240.0%
clear-num40.0%
clear-num39.9%
frac-times35.8%
metadata-eval35.8%
times-frac30.7%
add-sqr-sqrt30.7%
*-commutative30.7%
frac-times73.9%
Applied egg-rr73.9%
Final simplification74.7%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 5.1e+154)
0.0625
(if (or (<= beta 2.9e+196) (not (<= beta 3.1e+206)))
(* (/ i beta) (/ i beta))
0.0625)))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 5.1e+154) {
tmp = 0.0625;
} else if ((beta <= 2.9e+196) || !(beta <= 3.1e+206)) {
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 <= 5.1d+154) then
tmp = 0.0625d0
else if ((beta <= 2.9d+196) .or. (.not. (beta <= 3.1d+206))) 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 <= 5.1e+154) {
tmp = 0.0625;
} else if ((beta <= 2.9e+196) || !(beta <= 3.1e+206)) {
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 <= 5.1e+154: tmp = 0.0625 elif (beta <= 2.9e+196) or not (beta <= 3.1e+206): 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 <= 5.1e+154) tmp = 0.0625; elseif ((beta <= 2.9e+196) || !(beta <= 3.1e+206)) 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 <= 5.1e+154)
tmp = 0.0625;
elseif ((beta <= 2.9e+196) || ~((beta <= 3.1e+206)))
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, 5.1e+154], 0.0625, If[Or[LessEqual[beta, 2.9e+196], N[Not[LessEqual[beta, 3.1e+206]], $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 5.1 \cdot 10^{+154}:\\
\;\;\;\;0.0625\\
\mathbf{elif}\;\beta \leq 2.9 \cdot 10^{+196} \lor \neg \left(\beta \leq 3.1 \cdot 10^{+206}\right):\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if beta < 5.0999999999999999e154 or 2.9e196 < beta < 3.09999999999999991e206Initial program 23.2%
associate-/l/20.9%
associate-*l*20.8%
times-frac30.3%
Simplified45.4%
Taylor expanded in i around inf 76.0%
if 5.0999999999999999e154 < beta < 2.9e196 or 3.09999999999999991e206 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified4.0%
Taylor expanded in beta around inf 23.2%
*-commutative23.2%
associate-/l*28.0%
+-commutative28.0%
unpow228.0%
Simplified28.0%
associate-/r/28.0%
+-commutative28.0%
Applied egg-rr28.0%
clear-num28.0%
inv-pow28.0%
add-sqr-sqrt28.0%
sqrt-unprod20.7%
sqr-neg20.7%
mul-1-neg20.7%
mul-1-neg20.7%
sqrt-unprod0.0%
add-sqr-sqrt28.0%
associate-/l*22.3%
add-sqr-sqrt0.0%
sqrt-unprod31.7%
mul-1-neg31.7%
mul-1-neg31.7%
sqr-neg31.7%
sqrt-unprod40.5%
add-sqr-sqrt40.5%
Applied egg-rr40.5%
unpow-140.5%
associate-/r/44.5%
Simplified44.5%
Taylor expanded in i around inf 25.7%
unpow225.7%
associate-/r*40.0%
unpow240.0%
associate-*l/65.3%
associate-*r/65.4%
Simplified65.4%
Final simplification74.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta i)
:precision binary64
(if (<= beta 5.5e+154)
(+ 0.0625 (/ 0.015625 (* i i)))
(if (or (<= beta 2.95e+196) (not (<= beta 1.1e+207)))
(* (/ i beta) (/ i beta))
0.0625)))assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 5.5e+154) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if ((beta <= 2.95e+196) || !(beta <= 1.1e+207)) {
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 <= 5.5d+154) then
tmp = 0.0625d0 + (0.015625d0 / (i * i))
else if ((beta <= 2.95d+196) .or. (.not. (beta <= 1.1d+207))) 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 <= 5.5e+154) {
tmp = 0.0625 + (0.015625 / (i * i));
} else if ((beta <= 2.95e+196) || !(beta <= 1.1e+207)) {
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 <= 5.5e+154: tmp = 0.0625 + (0.015625 / (i * i)) elif (beta <= 2.95e+196) or not (beta <= 1.1e+207): 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 <= 5.5e+154) tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i))); elseif ((beta <= 2.95e+196) || !(beta <= 1.1e+207)) 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 <= 5.5e+154)
tmp = 0.0625 + (0.015625 / (i * i));
elseif ((beta <= 2.95e+196) || ~((beta <= 1.1e+207)))
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, 5.5e+154], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[beta, 2.95e+196], N[Not[LessEqual[beta, 1.1e+207]], $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 5.5 \cdot 10^{+154}:\\
\;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\
\mathbf{elif}\;\beta \leq 2.95 \cdot 10^{+196} \lor \neg \left(\beta \leq 1.1 \cdot 10^{+207}\right):\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if beta < 5.5000000000000006e154Initial program 23.6%
Taylor expanded in i around inf 41.4%
*-commutative41.4%
unpow241.4%
Simplified41.4%
Taylor expanded in i around inf 38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in i around inf 76.5%
associate-*r/76.5%
metadata-eval76.5%
unpow276.5%
Simplified76.5%
if 5.5000000000000006e154 < beta < 2.9499999999999999e196 or 1.10000000000000004e207 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified4.0%
Taylor expanded in beta around inf 23.2%
*-commutative23.2%
associate-/l*28.0%
+-commutative28.0%
unpow228.0%
Simplified28.0%
associate-/r/28.0%
+-commutative28.0%
Applied egg-rr28.0%
clear-num28.0%
inv-pow28.0%
add-sqr-sqrt28.0%
sqrt-unprod20.7%
sqr-neg20.7%
mul-1-neg20.7%
mul-1-neg20.7%
sqrt-unprod0.0%
add-sqr-sqrt28.0%
associate-/l*22.3%
add-sqr-sqrt0.0%
sqrt-unprod31.7%
mul-1-neg31.7%
mul-1-neg31.7%
sqr-neg31.7%
sqrt-unprod40.5%
add-sqr-sqrt40.5%
Applied egg-rr40.5%
unpow-140.5%
associate-/r/44.5%
Simplified44.5%
Taylor expanded in i around inf 25.7%
unpow225.7%
associate-/r*40.0%
unpow240.0%
associate-*l/65.3%
associate-*r/65.4%
Simplified65.4%
if 2.9499999999999999e196 < beta < 1.10000000000000004e207Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in i around inf 64.8%
Final simplification74.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta i) :precision binary64 (if (<= beta 1.6e+215) 0.0625 (* (/ i beta) (/ alpha beta))))
assert(alpha < beta);
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+215) {
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.6d+215) 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.6e+215) {
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.6e+215: 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.6e+215) 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.6e+215)
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.6e+215], 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.6 \cdot 10^{+215}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{\alpha}{\beta}\\
\end{array}
\end{array}
if beta < 1.5999999999999999e215Initial program 21.7%
associate-/l/19.5%
associate-*l*19.5%
times-frac28.3%
Simplified42.6%
Taylor expanded in i around inf 74.3%
if 1.5999999999999999e215 < beta Initial program 0.0%
associate-/l/0.0%
associate-*l*0.0%
times-frac0.0%
Simplified5.2%
Taylor expanded in beta around inf 31.9%
*-commutative31.9%
associate-/l*34.5%
+-commutative34.5%
unpow234.5%
Simplified34.5%
Taylor expanded in alpha around inf 33.4%
unpow233.4%
Simplified33.4%
times-frac40.6%
Applied egg-rr40.6%
Final simplification71.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.6%
associate-/l/17.6%
associate-*l*17.6%
times-frac25.6%
Simplified38.9%
Taylor expanded in i around inf 68.5%
Final simplification68.5%
herbie shell --seed 2023268
(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)))