
(FPCore (alpha beta) :precision binary64 (/ (+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0) 2.0))
double code(double alpha, double beta) {
return (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = (((beta - alpha) / ((alpha + beta) + 2.0d0)) + 1.0d0) / 2.0d0
end function
public static double code(double alpha, double beta) {
return (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0;
}
def code(alpha, beta): return (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0
function code(alpha, beta) return Float64(Float64(Float64(Float64(beta - alpha) / Float64(Float64(alpha + beta) + 2.0)) + 1.0) / 2.0) end
function tmp = code(alpha, beta) tmp = (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0; end
code[alpha_, beta_] := N[(N[(N[(N[(beta - alpha), $MachinePrecision] / N[(N[(alpha + beta), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2} + 1}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (alpha beta) :precision binary64 (/ (+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0) 2.0))
double code(double alpha, double beta) {
return (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = (((beta - alpha) / ((alpha + beta) + 2.0d0)) + 1.0d0) / 2.0d0
end function
public static double code(double alpha, double beta) {
return (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0;
}
def code(alpha, beta): return (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0
function code(alpha, beta) return Float64(Float64(Float64(Float64(beta - alpha) / Float64(Float64(alpha + beta) + 2.0)) + 1.0) / 2.0) end
function tmp = code(alpha, beta) tmp = (((beta - alpha) / ((alpha + beta) + 2.0)) + 1.0) / 2.0; end
code[alpha_, beta_] := N[(N[(N[(N[(beta - alpha), $MachinePrecision] / N[(N[(alpha + beta), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2} + 1}{2}
\end{array}
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (/ (- beta alpha) (+ (+ beta alpha) 2.0))))
(if (<= t_0 -0.998)
(/
(fma
(/ (- (- -2.0 beta) beta) alpha)
(/ (+ beta 2.0) alpha)
(/ (+ beta (+ beta 2.0)) alpha))
2.0)
(/ (+ t_0 1.0) 2.0))))
double code(double alpha, double beta) {
double t_0 = (beta - alpha) / ((beta + alpha) + 2.0);
double tmp;
if (t_0 <= -0.998) {
tmp = fma((((-2.0 - beta) - beta) / alpha), ((beta + 2.0) / alpha), ((beta + (beta + 2.0)) / alpha)) / 2.0;
} else {
tmp = (t_0 + 1.0) / 2.0;
}
return tmp;
}
function code(alpha, beta) t_0 = Float64(Float64(beta - alpha) / Float64(Float64(beta + alpha) + 2.0)) tmp = 0.0 if (t_0 <= -0.998) tmp = Float64(fma(Float64(Float64(Float64(-2.0 - beta) - beta) / alpha), Float64(Float64(beta + 2.0) / alpha), Float64(Float64(beta + Float64(beta + 2.0)) / alpha)) / 2.0); else tmp = Float64(Float64(t_0 + 1.0) / 2.0); end return tmp end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta - alpha), $MachinePrecision] / N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.998], N[(N[(N[(N[(N[(-2.0 - beta), $MachinePrecision] - beta), $MachinePrecision] / alpha), $MachinePrecision] * N[(N[(beta + 2.0), $MachinePrecision] / alpha), $MachinePrecision] + N[(N[(beta + N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] / alpha), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\beta - \alpha}{\left(\beta + \alpha\right) + 2}\\
\mathbf{if}\;t_0 \leq -0.998:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(-2 - \beta\right) - \beta}{\alpha}, \frac{\beta + 2}{\alpha}, \frac{\beta + \left(\beta + 2\right)}{\alpha}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 + 1}{2}\\
\end{array}
\end{array}
if (/.f64 (-.f64 beta alpha) (+.f64 (+.f64 alpha beta) 2)) < -0.998Initial program 8.0%
+-commutative8.0%
Simplified8.0%
Taylor expanded in alpha around -inf 94.2%
Simplified99.8%
if -0.998 < (/.f64 (-.f64 beta alpha) (+.f64 (+.f64 alpha beta) 2)) Initial program 99.9%
Final simplification99.9%
(FPCore (alpha beta) :precision binary64 (if (<= (/ (- beta alpha) (+ (+ beta alpha) 2.0)) -0.99999995) (/ (* 2.0 (+ (/ beta alpha) (/ 1.0 alpha))) 2.0) (/ (fma (/ 1.0 (+ beta (+ alpha 2.0))) (- beta alpha) 1.0) 2.0)))
double code(double alpha, double beta) {
double tmp;
if (((beta - alpha) / ((beta + alpha) + 2.0)) <= -0.99999995) {
tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0;
} else {
tmp = fma((1.0 / (beta + (alpha + 2.0))), (beta - alpha), 1.0) / 2.0;
}
return tmp;
}
function code(alpha, beta) tmp = 0.0 if (Float64(Float64(beta - alpha) / Float64(Float64(beta + alpha) + 2.0)) <= -0.99999995) tmp = Float64(Float64(2.0 * Float64(Float64(beta / alpha) + Float64(1.0 / alpha))) / 2.0); else tmp = Float64(fma(Float64(1.0 / Float64(beta + Float64(alpha + 2.0))), Float64(beta - alpha), 1.0) / 2.0); end return tmp end
code[alpha_, beta_] := If[LessEqual[N[(N[(beta - alpha), $MachinePrecision] / N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], -0.99999995], N[(N[(2.0 * N[(N[(beta / alpha), $MachinePrecision] + N[(1.0 / alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 / N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(beta - alpha), $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\beta - \alpha}{\left(\beta + \alpha\right) + 2} \leq -0.99999995:\\
\;\;\;\;\frac{2 \cdot \left(\frac{\beta}{\alpha} + \frac{1}{\alpha}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{1}{\beta + \left(\alpha + 2\right)}, \beta - \alpha, 1\right)}{2}\\
\end{array}
\end{array}
if (/.f64 (-.f64 beta alpha) (+.f64 (+.f64 alpha beta) 2)) < -0.999999949999999971Initial program 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in alpha around -inf 99.0%
associate-*r/99.0%
sub-neg99.0%
mul-1-neg99.0%
distribute-lft-in99.0%
neg-mul-199.0%
mul-1-neg99.0%
remove-double-neg99.0%
neg-mul-199.0%
mul-1-neg99.0%
remove-double-neg99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in beta around 0 99.0%
distribute-lft-out99.0%
Applied egg-rr99.0%
if -0.999999949999999971 < (/.f64 (-.f64 beta alpha) (+.f64 (+.f64 alpha beta) 2)) Initial program 99.7%
+-commutative99.7%
Simplified99.7%
clear-num99.8%
associate-/r/99.7%
fma-def99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (/ (- beta alpha) (+ (+ beta alpha) 2.0))))
(if (<= t_0 -0.99999995)
(/ (* 2.0 (+ (/ beta alpha) (/ 1.0 alpha))) 2.0)
(/ (+ t_0 1.0) 2.0))))
double code(double alpha, double beta) {
double t_0 = (beta - alpha) / ((beta + alpha) + 2.0);
double tmp;
if (t_0 <= -0.99999995) {
tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0;
} else {
tmp = (t_0 + 1.0) / 2.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: tmp
t_0 = (beta - alpha) / ((beta + alpha) + 2.0d0)
if (t_0 <= (-0.99999995d0)) then
tmp = (2.0d0 * ((beta / alpha) + (1.0d0 / alpha))) / 2.0d0
else
tmp = (t_0 + 1.0d0) / 2.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double t_0 = (beta - alpha) / ((beta + alpha) + 2.0);
double tmp;
if (t_0 <= -0.99999995) {
tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0;
} else {
tmp = (t_0 + 1.0) / 2.0;
}
return tmp;
}
def code(alpha, beta): t_0 = (beta - alpha) / ((beta + alpha) + 2.0) tmp = 0 if t_0 <= -0.99999995: tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0 else: tmp = (t_0 + 1.0) / 2.0 return tmp
function code(alpha, beta) t_0 = Float64(Float64(beta - alpha) / Float64(Float64(beta + alpha) + 2.0)) tmp = 0.0 if (t_0 <= -0.99999995) tmp = Float64(Float64(2.0 * Float64(Float64(beta / alpha) + Float64(1.0 / alpha))) / 2.0); else tmp = Float64(Float64(t_0 + 1.0) / 2.0); end return tmp end
function tmp_2 = code(alpha, beta) t_0 = (beta - alpha) / ((beta + alpha) + 2.0); tmp = 0.0; if (t_0 <= -0.99999995) tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0; else tmp = (t_0 + 1.0) / 2.0; end tmp_2 = tmp; end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta - alpha), $MachinePrecision] / N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.99999995], N[(N[(2.0 * N[(N[(beta / alpha), $MachinePrecision] + N[(1.0 / alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\beta - \alpha}{\left(\beta + \alpha\right) + 2}\\
\mathbf{if}\;t_0 \leq -0.99999995:\\
\;\;\;\;\frac{2 \cdot \left(\frac{\beta}{\alpha} + \frac{1}{\alpha}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 + 1}{2}\\
\end{array}
\end{array}
if (/.f64 (-.f64 beta alpha) (+.f64 (+.f64 alpha beta) 2)) < -0.999999949999999971Initial program 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in alpha around -inf 99.0%
associate-*r/99.0%
sub-neg99.0%
mul-1-neg99.0%
distribute-lft-in99.0%
neg-mul-199.0%
mul-1-neg99.0%
remove-double-neg99.0%
neg-mul-199.0%
mul-1-neg99.0%
remove-double-neg99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in beta around 0 99.0%
distribute-lft-out99.0%
Applied egg-rr99.0%
if -0.999999949999999971 < (/.f64 (-.f64 beta alpha) (+.f64 (+.f64 alpha beta) 2)) Initial program 99.7%
Final simplification99.5%
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (* beta 0.5)) 2.0)) (t_1 (/ (/ 2.0 alpha) 2.0)))
(if (<= beta -9.8e-101)
t_0
(if (<= beta -1.6e-123)
t_1
(if (<= beta -5.2e-194)
(/ (+ 1.0 (* alpha -0.5)) 2.0)
(if (<= beta -8.5e-213) t_1 (if (<= beta 2.0) t_0 1.0)))))))
double code(double alpha, double beta) {
double t_0 = (1.0 + (beta * 0.5)) / 2.0;
double t_1 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -9.8e-101) {
tmp = t_0;
} else if (beta <= -1.6e-123) {
tmp = t_1;
} else if (beta <= -5.2e-194) {
tmp = (1.0 + (alpha * -0.5)) / 2.0;
} else if (beta <= -8.5e-213) {
tmp = t_1;
} else if (beta <= 2.0) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (1.0d0 + (beta * 0.5d0)) / 2.0d0
t_1 = (2.0d0 / alpha) / 2.0d0
if (beta <= (-9.8d-101)) then
tmp = t_0
else if (beta <= (-1.6d-123)) then
tmp = t_1
else if (beta <= (-5.2d-194)) then
tmp = (1.0d0 + (alpha * (-0.5d0))) / 2.0d0
else if (beta <= (-8.5d-213)) then
tmp = t_1
else if (beta <= 2.0d0) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double t_0 = (1.0 + (beta * 0.5)) / 2.0;
double t_1 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -9.8e-101) {
tmp = t_0;
} else if (beta <= -1.6e-123) {
tmp = t_1;
} else if (beta <= -5.2e-194) {
tmp = (1.0 + (alpha * -0.5)) / 2.0;
} else if (beta <= -8.5e-213) {
tmp = t_1;
} else if (beta <= 2.0) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(alpha, beta): t_0 = (1.0 + (beta * 0.5)) / 2.0 t_1 = (2.0 / alpha) / 2.0 tmp = 0 if beta <= -9.8e-101: tmp = t_0 elif beta <= -1.6e-123: tmp = t_1 elif beta <= -5.2e-194: tmp = (1.0 + (alpha * -0.5)) / 2.0 elif beta <= -8.5e-213: tmp = t_1 elif beta <= 2.0: tmp = t_0 else: tmp = 1.0 return tmp
function code(alpha, beta) t_0 = Float64(Float64(1.0 + Float64(beta * 0.5)) / 2.0) t_1 = Float64(Float64(2.0 / alpha) / 2.0) tmp = 0.0 if (beta <= -9.8e-101) tmp = t_0; elseif (beta <= -1.6e-123) tmp = t_1; elseif (beta <= -5.2e-194) tmp = Float64(Float64(1.0 + Float64(alpha * -0.5)) / 2.0); elseif (beta <= -8.5e-213) tmp = t_1; elseif (beta <= 2.0) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(alpha, beta) t_0 = (1.0 + (beta * 0.5)) / 2.0; t_1 = (2.0 / alpha) / 2.0; tmp = 0.0; if (beta <= -9.8e-101) tmp = t_0; elseif (beta <= -1.6e-123) tmp = t_1; elseif (beta <= -5.2e-194) tmp = (1.0 + (alpha * -0.5)) / 2.0; elseif (beta <= -8.5e-213) tmp = t_1; elseif (beta <= 2.0) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(1.0 + N[(beta * 0.5), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / alpha), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[beta, -9.8e-101], t$95$0, If[LessEqual[beta, -1.6e-123], t$95$1, If[LessEqual[beta, -5.2e-194], N[(N[(1.0 + N[(alpha * -0.5), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[beta, -8.5e-213], t$95$1, If[LessEqual[beta, 2.0], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + \beta \cdot 0.5}{2}\\
t_1 := \frac{\frac{2}{\alpha}}{2}\\
\mathbf{if}\;\beta \leq -9.8 \cdot 10^{-101}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\beta \leq -1.6 \cdot 10^{-123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\beta \leq -5.2 \cdot 10^{-194}:\\
\;\;\;\;\frac{1 + \alpha \cdot -0.5}{2}\\
\mathbf{elif}\;\beta \leq -8.5 \cdot 10^{-213}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\beta \leq 2:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if beta < -9.8000000000000001e-101 or -8.49999999999999994e-213 < beta < 2Initial program 70.9%
+-commutative70.9%
Simplified70.9%
Taylor expanded in alpha around 0 68.9%
Taylor expanded in beta around 0 68.0%
*-commutative68.0%
Simplified68.0%
if -9.8000000000000001e-101 < beta < -1.59999999999999989e-123 or -5.20000000000000003e-194 < beta < -8.49999999999999994e-213Initial program 21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in alpha around -inf 84.0%
associate-*r/84.0%
sub-neg84.0%
mul-1-neg84.0%
distribute-lft-in84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in beta around 0 84.0%
if -1.59999999999999989e-123 < beta < -5.20000000000000003e-194Initial program 77.8%
+-commutative77.8%
Simplified77.8%
add-log-exp77.7%
associate-+l+77.7%
Applied egg-rr77.7%
Taylor expanded in beta around 0 77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in alpha around 0 76.8%
*-commutative76.8%
Simplified76.8%
if 2 < beta Initial program 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in beta around inf 87.6%
Final simplification76.3%
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (* beta 0.5)) 2.0)) (t_1 (/ (/ 2.0 alpha) 2.0)))
(if (<= beta -3e-100)
t_0
(if (<= beta -7.4e-124)
t_1
(if (<= beta -5.8e-194)
(/ (+ 1.0 (* alpha -0.5)) 2.0)
(if (<= beta -1.95e-207)
t_1
(if (<= beta 2.0) t_0 (/ (- 2.0 (/ 2.0 beta)) 2.0))))))))
double code(double alpha, double beta) {
double t_0 = (1.0 + (beta * 0.5)) / 2.0;
double t_1 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -3e-100) {
tmp = t_0;
} else if (beta <= -7.4e-124) {
tmp = t_1;
} else if (beta <= -5.8e-194) {
tmp = (1.0 + (alpha * -0.5)) / 2.0;
} else if (beta <= -1.95e-207) {
tmp = t_1;
} else if (beta <= 2.0) {
tmp = t_0;
} else {
tmp = (2.0 - (2.0 / beta)) / 2.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (1.0d0 + (beta * 0.5d0)) / 2.0d0
t_1 = (2.0d0 / alpha) / 2.0d0
if (beta <= (-3d-100)) then
tmp = t_0
else if (beta <= (-7.4d-124)) then
tmp = t_1
else if (beta <= (-5.8d-194)) then
tmp = (1.0d0 + (alpha * (-0.5d0))) / 2.0d0
else if (beta <= (-1.95d-207)) then
tmp = t_1
else if (beta <= 2.0d0) then
tmp = t_0
else
tmp = (2.0d0 - (2.0d0 / beta)) / 2.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double t_0 = (1.0 + (beta * 0.5)) / 2.0;
double t_1 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -3e-100) {
tmp = t_0;
} else if (beta <= -7.4e-124) {
tmp = t_1;
} else if (beta <= -5.8e-194) {
tmp = (1.0 + (alpha * -0.5)) / 2.0;
} else if (beta <= -1.95e-207) {
tmp = t_1;
} else if (beta <= 2.0) {
tmp = t_0;
} else {
tmp = (2.0 - (2.0 / beta)) / 2.0;
}
return tmp;
}
def code(alpha, beta): t_0 = (1.0 + (beta * 0.5)) / 2.0 t_1 = (2.0 / alpha) / 2.0 tmp = 0 if beta <= -3e-100: tmp = t_0 elif beta <= -7.4e-124: tmp = t_1 elif beta <= -5.8e-194: tmp = (1.0 + (alpha * -0.5)) / 2.0 elif beta <= -1.95e-207: tmp = t_1 elif beta <= 2.0: tmp = t_0 else: tmp = (2.0 - (2.0 / beta)) / 2.0 return tmp
function code(alpha, beta) t_0 = Float64(Float64(1.0 + Float64(beta * 0.5)) / 2.0) t_1 = Float64(Float64(2.0 / alpha) / 2.0) tmp = 0.0 if (beta <= -3e-100) tmp = t_0; elseif (beta <= -7.4e-124) tmp = t_1; elseif (beta <= -5.8e-194) tmp = Float64(Float64(1.0 + Float64(alpha * -0.5)) / 2.0); elseif (beta <= -1.95e-207) tmp = t_1; elseif (beta <= 2.0) tmp = t_0; else tmp = Float64(Float64(2.0 - Float64(2.0 / beta)) / 2.0); end return tmp end
function tmp_2 = code(alpha, beta) t_0 = (1.0 + (beta * 0.5)) / 2.0; t_1 = (2.0 / alpha) / 2.0; tmp = 0.0; if (beta <= -3e-100) tmp = t_0; elseif (beta <= -7.4e-124) tmp = t_1; elseif (beta <= -5.8e-194) tmp = (1.0 + (alpha * -0.5)) / 2.0; elseif (beta <= -1.95e-207) tmp = t_1; elseif (beta <= 2.0) tmp = t_0; else tmp = (2.0 - (2.0 / beta)) / 2.0; end tmp_2 = tmp; end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(1.0 + N[(beta * 0.5), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / alpha), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[beta, -3e-100], t$95$0, If[LessEqual[beta, -7.4e-124], t$95$1, If[LessEqual[beta, -5.8e-194], N[(N[(1.0 + N[(alpha * -0.5), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[beta, -1.95e-207], t$95$1, If[LessEqual[beta, 2.0], t$95$0, N[(N[(2.0 - N[(2.0 / beta), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + \beta \cdot 0.5}{2}\\
t_1 := \frac{\frac{2}{\alpha}}{2}\\
\mathbf{if}\;\beta \leq -3 \cdot 10^{-100}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\beta \leq -7.4 \cdot 10^{-124}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\beta \leq -5.8 \cdot 10^{-194}:\\
\;\;\;\;\frac{1 + \alpha \cdot -0.5}{2}\\
\mathbf{elif}\;\beta \leq -1.95 \cdot 10^{-207}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\beta \leq 2:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 - \frac{2}{\beta}}{2}\\
\end{array}
\end{array}
if beta < -3.0000000000000001e-100 or -1.9500000000000001e-207 < beta < 2Initial program 70.9%
+-commutative70.9%
Simplified70.9%
Taylor expanded in alpha around 0 68.9%
Taylor expanded in beta around 0 68.0%
*-commutative68.0%
Simplified68.0%
if -3.0000000000000001e-100 < beta < -7.3999999999999998e-124 or -5.7999999999999994e-194 < beta < -1.9500000000000001e-207Initial program 21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in alpha around -inf 84.0%
associate-*r/84.0%
sub-neg84.0%
mul-1-neg84.0%
distribute-lft-in84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in beta around 0 84.0%
if -7.3999999999999998e-124 < beta < -5.7999999999999994e-194Initial program 77.8%
+-commutative77.8%
Simplified77.8%
add-log-exp77.7%
associate-+l+77.7%
Applied egg-rr77.7%
Taylor expanded in beta around 0 77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in alpha around 0 76.8%
*-commutative76.8%
Simplified76.8%
if 2 < beta Initial program 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in alpha around 0 89.2%
Taylor expanded in beta around inf 88.6%
associate-*r/88.6%
metadata-eval88.6%
Simplified88.6%
Final simplification76.6%
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (/ (/ 2.0 alpha) 2.0)))
(if (<= beta -1.2e-100)
0.5
(if (<= beta -1.14e-123)
t_0
(if (<= beta -1.95e-192)
0.5
(if (<= beta -1.95e-207) t_0 (if (<= beta 2.1) 0.5 1.0)))))))
double code(double alpha, double beta) {
double t_0 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -1.2e-100) {
tmp = 0.5;
} else if (beta <= -1.14e-123) {
tmp = t_0;
} else if (beta <= -1.95e-192) {
tmp = 0.5;
} else if (beta <= -1.95e-207) {
tmp = t_0;
} else if (beta <= 2.1) {
tmp = 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: tmp
t_0 = (2.0d0 / alpha) / 2.0d0
if (beta <= (-1.2d-100)) then
tmp = 0.5d0
else if (beta <= (-1.14d-123)) then
tmp = t_0
else if (beta <= (-1.95d-192)) then
tmp = 0.5d0
else if (beta <= (-1.95d-207)) then
tmp = t_0
else if (beta <= 2.1d0) then
tmp = 0.5d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double t_0 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -1.2e-100) {
tmp = 0.5;
} else if (beta <= -1.14e-123) {
tmp = t_0;
} else if (beta <= -1.95e-192) {
tmp = 0.5;
} else if (beta <= -1.95e-207) {
tmp = t_0;
} else if (beta <= 2.1) {
tmp = 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
def code(alpha, beta): t_0 = (2.0 / alpha) / 2.0 tmp = 0 if beta <= -1.2e-100: tmp = 0.5 elif beta <= -1.14e-123: tmp = t_0 elif beta <= -1.95e-192: tmp = 0.5 elif beta <= -1.95e-207: tmp = t_0 elif beta <= 2.1: tmp = 0.5 else: tmp = 1.0 return tmp
function code(alpha, beta) t_0 = Float64(Float64(2.0 / alpha) / 2.0) tmp = 0.0 if (beta <= -1.2e-100) tmp = 0.5; elseif (beta <= -1.14e-123) tmp = t_0; elseif (beta <= -1.95e-192) tmp = 0.5; elseif (beta <= -1.95e-207) tmp = t_0; elseif (beta <= 2.1) tmp = 0.5; else tmp = 1.0; end return tmp end
function tmp_2 = code(alpha, beta) t_0 = (2.0 / alpha) / 2.0; tmp = 0.0; if (beta <= -1.2e-100) tmp = 0.5; elseif (beta <= -1.14e-123) tmp = t_0; elseif (beta <= -1.95e-192) tmp = 0.5; elseif (beta <= -1.95e-207) tmp = t_0; elseif (beta <= 2.1) tmp = 0.5; else tmp = 1.0; end tmp_2 = tmp; end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(2.0 / alpha), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[beta, -1.2e-100], 0.5, If[LessEqual[beta, -1.14e-123], t$95$0, If[LessEqual[beta, -1.95e-192], 0.5, If[LessEqual[beta, -1.95e-207], t$95$0, If[LessEqual[beta, 2.1], 0.5, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{\alpha}}{2}\\
\mathbf{if}\;\beta \leq -1.2 \cdot 10^{-100}:\\
\;\;\;\;0.5\\
\mathbf{elif}\;\beta \leq -1.14 \cdot 10^{-123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\beta \leq -1.95 \cdot 10^{-192}:\\
\;\;\;\;0.5\\
\mathbf{elif}\;\beta \leq -1.95 \cdot 10^{-207}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\beta \leq 2.1:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if beta < -1.2000000000000001e-100 or -1.13999999999999995e-123 < beta < -1.9500000000000001e-192 or -1.9500000000000001e-207 < beta < 2.10000000000000009Initial program 71.6%
+-commutative71.6%
Simplified71.6%
add-log-exp71.6%
associate-+l+71.6%
Applied egg-rr71.6%
Taylor expanded in beta around 0 70.0%
+-commutative70.0%
Simplified70.0%
Taylor expanded in alpha around 0 68.1%
if -1.2000000000000001e-100 < beta < -1.13999999999999995e-123 or -1.9500000000000001e-192 < beta < -1.9500000000000001e-207Initial program 21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in alpha around -inf 84.0%
associate-*r/84.0%
sub-neg84.0%
mul-1-neg84.0%
distribute-lft-in84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in beta around 0 84.0%
if 2.10000000000000009 < beta Initial program 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in beta around inf 87.6%
Final simplification75.7%
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (/ (/ 2.0 alpha) 2.0)))
(if (<= beta -9e-101)
0.5
(if (<= beta -1.75e-123)
t_0
(if (<= beta -2.25e-192)
(/ (+ 1.0 (* alpha -0.5)) 2.0)
(if (<= beta -9.2e-208) t_0 (if (<= beta 2.0) 0.5 1.0)))))))
double code(double alpha, double beta) {
double t_0 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -9e-101) {
tmp = 0.5;
} else if (beta <= -1.75e-123) {
tmp = t_0;
} else if (beta <= -2.25e-192) {
tmp = (1.0 + (alpha * -0.5)) / 2.0;
} else if (beta <= -9.2e-208) {
tmp = t_0;
} else if (beta <= 2.0) {
tmp = 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: tmp
t_0 = (2.0d0 / alpha) / 2.0d0
if (beta <= (-9d-101)) then
tmp = 0.5d0
else if (beta <= (-1.75d-123)) then
tmp = t_0
else if (beta <= (-2.25d-192)) then
tmp = (1.0d0 + (alpha * (-0.5d0))) / 2.0d0
else if (beta <= (-9.2d-208)) then
tmp = t_0
else if (beta <= 2.0d0) then
tmp = 0.5d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double t_0 = (2.0 / alpha) / 2.0;
double tmp;
if (beta <= -9e-101) {
tmp = 0.5;
} else if (beta <= -1.75e-123) {
tmp = t_0;
} else if (beta <= -2.25e-192) {
tmp = (1.0 + (alpha * -0.5)) / 2.0;
} else if (beta <= -9.2e-208) {
tmp = t_0;
} else if (beta <= 2.0) {
tmp = 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
def code(alpha, beta): t_0 = (2.0 / alpha) / 2.0 tmp = 0 if beta <= -9e-101: tmp = 0.5 elif beta <= -1.75e-123: tmp = t_0 elif beta <= -2.25e-192: tmp = (1.0 + (alpha * -0.5)) / 2.0 elif beta <= -9.2e-208: tmp = t_0 elif beta <= 2.0: tmp = 0.5 else: tmp = 1.0 return tmp
function code(alpha, beta) t_0 = Float64(Float64(2.0 / alpha) / 2.0) tmp = 0.0 if (beta <= -9e-101) tmp = 0.5; elseif (beta <= -1.75e-123) tmp = t_0; elseif (beta <= -2.25e-192) tmp = Float64(Float64(1.0 + Float64(alpha * -0.5)) / 2.0); elseif (beta <= -9.2e-208) tmp = t_0; elseif (beta <= 2.0) tmp = 0.5; else tmp = 1.0; end return tmp end
function tmp_2 = code(alpha, beta) t_0 = (2.0 / alpha) / 2.0; tmp = 0.0; if (beta <= -9e-101) tmp = 0.5; elseif (beta <= -1.75e-123) tmp = t_0; elseif (beta <= -2.25e-192) tmp = (1.0 + (alpha * -0.5)) / 2.0; elseif (beta <= -9.2e-208) tmp = t_0; elseif (beta <= 2.0) tmp = 0.5; else tmp = 1.0; end tmp_2 = tmp; end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(2.0 / alpha), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[beta, -9e-101], 0.5, If[LessEqual[beta, -1.75e-123], t$95$0, If[LessEqual[beta, -2.25e-192], N[(N[(1.0 + N[(alpha * -0.5), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[beta, -9.2e-208], t$95$0, If[LessEqual[beta, 2.0], 0.5, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{\alpha}}{2}\\
\mathbf{if}\;\beta \leq -9 \cdot 10^{-101}:\\
\;\;\;\;0.5\\
\mathbf{elif}\;\beta \leq -1.75 \cdot 10^{-123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\beta \leq -2.25 \cdot 10^{-192}:\\
\;\;\;\;\frac{1 + \alpha \cdot -0.5}{2}\\
\mathbf{elif}\;\beta \leq -9.2 \cdot 10^{-208}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\beta \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if beta < -8.9999999999999997e-101 or -9.19999999999999986e-208 < beta < 2Initial program 70.9%
+-commutative70.9%
Simplified70.9%
add-log-exp70.8%
associate-+l+70.8%
Applied egg-rr70.8%
Taylor expanded in beta around 0 69.0%
+-commutative69.0%
Simplified69.0%
Taylor expanded in alpha around 0 67.1%
if -8.9999999999999997e-101 < beta < -1.7499999999999999e-123 or -2.25000000000000012e-192 < beta < -9.19999999999999986e-208Initial program 21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in alpha around -inf 84.0%
associate-*r/84.0%
sub-neg84.0%
mul-1-neg84.0%
distribute-lft-in84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
neg-mul-184.0%
mul-1-neg84.0%
remove-double-neg84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in beta around 0 84.0%
if -1.7499999999999999e-123 < beta < -2.25000000000000012e-192Initial program 77.8%
+-commutative77.8%
Simplified77.8%
add-log-exp77.7%
associate-+l+77.7%
Applied egg-rr77.7%
Taylor expanded in beta around 0 77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in alpha around 0 76.8%
*-commutative76.8%
Simplified76.8%
if 2 < beta Initial program 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in beta around inf 87.6%
Final simplification75.8%
(FPCore (alpha beta) :precision binary64 (if (<= alpha 950.0) (/ (+ 1.0 (/ beta (+ beta 2.0))) 2.0) (/ (* 2.0 (+ (/ beta alpha) (/ 1.0 alpha))) 2.0)))
double code(double alpha, double beta) {
double tmp;
if (alpha <= 950.0) {
tmp = (1.0 + (beta / (beta + 2.0))) / 2.0;
} else {
tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (alpha <= 950.0d0) then
tmp = (1.0d0 + (beta / (beta + 2.0d0))) / 2.0d0
else
tmp = (2.0d0 * ((beta / alpha) + (1.0d0 / alpha))) / 2.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double tmp;
if (alpha <= 950.0) {
tmp = (1.0 + (beta / (beta + 2.0))) / 2.0;
} else {
tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0;
}
return tmp;
}
def code(alpha, beta): tmp = 0 if alpha <= 950.0: tmp = (1.0 + (beta / (beta + 2.0))) / 2.0 else: tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0 return tmp
function code(alpha, beta) tmp = 0.0 if (alpha <= 950.0) tmp = Float64(Float64(1.0 + Float64(beta / Float64(beta + 2.0))) / 2.0); else tmp = Float64(Float64(2.0 * Float64(Float64(beta / alpha) + Float64(1.0 / alpha))) / 2.0); end return tmp end
function tmp_2 = code(alpha, beta) tmp = 0.0; if (alpha <= 950.0) tmp = (1.0 + (beta / (beta + 2.0))) / 2.0; else tmp = (2.0 * ((beta / alpha) + (1.0 / alpha))) / 2.0; end tmp_2 = tmp; end
code[alpha_, beta_] := If[LessEqual[alpha, 950.0], N[(N[(1.0 + N[(beta / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(N[(beta / alpha), $MachinePrecision] + N[(1.0 / alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\alpha \leq 950:\\
\;\;\;\;\frac{1 + \frac{\beta}{\beta + 2}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(\frac{\beta}{\alpha} + \frac{1}{\alpha}\right)}{2}\\
\end{array}
\end{array}
if alpha < 950Initial program 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in alpha around 0 98.9%
if 950 < alpha Initial program 24.8%
+-commutative24.8%
Simplified24.8%
Taylor expanded in alpha around -inf 81.7%
associate-*r/81.7%
sub-neg81.7%
mul-1-neg81.7%
distribute-lft-in81.7%
neg-mul-181.7%
mul-1-neg81.7%
remove-double-neg81.7%
neg-mul-181.7%
mul-1-neg81.7%
remove-double-neg81.7%
+-commutative81.7%
Simplified81.7%
Taylor expanded in beta around 0 81.7%
distribute-lft-out81.7%
Applied egg-rr81.7%
Final simplification93.1%
(FPCore (alpha beta) :precision binary64 (if (<= alpha 950.0) (/ (+ 1.0 (/ beta (+ beta 2.0))) 2.0) (/ (/ 2.0 alpha) 2.0)))
double code(double alpha, double beta) {
double tmp;
if (alpha <= 950.0) {
tmp = (1.0 + (beta / (beta + 2.0))) / 2.0;
} else {
tmp = (2.0 / alpha) / 2.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (alpha <= 950.0d0) then
tmp = (1.0d0 + (beta / (beta + 2.0d0))) / 2.0d0
else
tmp = (2.0d0 / alpha) / 2.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double tmp;
if (alpha <= 950.0) {
tmp = (1.0 + (beta / (beta + 2.0))) / 2.0;
} else {
tmp = (2.0 / alpha) / 2.0;
}
return tmp;
}
def code(alpha, beta): tmp = 0 if alpha <= 950.0: tmp = (1.0 + (beta / (beta + 2.0))) / 2.0 else: tmp = (2.0 / alpha) / 2.0 return tmp
function code(alpha, beta) tmp = 0.0 if (alpha <= 950.0) tmp = Float64(Float64(1.0 + Float64(beta / Float64(beta + 2.0))) / 2.0); else tmp = Float64(Float64(2.0 / alpha) / 2.0); end return tmp end
function tmp_2 = code(alpha, beta) tmp = 0.0; if (alpha <= 950.0) tmp = (1.0 + (beta / (beta + 2.0))) / 2.0; else tmp = (2.0 / alpha) / 2.0; end tmp_2 = tmp; end
code[alpha_, beta_] := If[LessEqual[alpha, 950.0], N[(N[(1.0 + N[(beta / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 / alpha), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\alpha \leq 950:\\
\;\;\;\;\frac{1 + \frac{\beta}{\beta + 2}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{\alpha}}{2}\\
\end{array}
\end{array}
if alpha < 950Initial program 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in alpha around 0 98.9%
if 950 < alpha Initial program 24.8%
+-commutative24.8%
Simplified24.8%
Taylor expanded in alpha around -inf 81.7%
associate-*r/81.7%
sub-neg81.7%
mul-1-neg81.7%
distribute-lft-in81.7%
neg-mul-181.7%
mul-1-neg81.7%
remove-double-neg81.7%
neg-mul-181.7%
mul-1-neg81.7%
remove-double-neg81.7%
+-commutative81.7%
Simplified81.7%
Taylor expanded in beta around 0 70.5%
Final simplification89.2%
(FPCore (alpha beta) :precision binary64 (if (<= alpha 900.0) (/ (+ 1.0 (/ beta (+ beta 2.0))) 2.0) (/ (/ (+ beta (+ beta 2.0)) alpha) 2.0)))
double code(double alpha, double beta) {
double tmp;
if (alpha <= 900.0) {
tmp = (1.0 + (beta / (beta + 2.0))) / 2.0;
} else {
tmp = ((beta + (beta + 2.0)) / alpha) / 2.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (alpha <= 900.0d0) then
tmp = (1.0d0 + (beta / (beta + 2.0d0))) / 2.0d0
else
tmp = ((beta + (beta + 2.0d0)) / alpha) / 2.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double tmp;
if (alpha <= 900.0) {
tmp = (1.0 + (beta / (beta + 2.0))) / 2.0;
} else {
tmp = ((beta + (beta + 2.0)) / alpha) / 2.0;
}
return tmp;
}
def code(alpha, beta): tmp = 0 if alpha <= 900.0: tmp = (1.0 + (beta / (beta + 2.0))) / 2.0 else: tmp = ((beta + (beta + 2.0)) / alpha) / 2.0 return tmp
function code(alpha, beta) tmp = 0.0 if (alpha <= 900.0) tmp = Float64(Float64(1.0 + Float64(beta / Float64(beta + 2.0))) / 2.0); else tmp = Float64(Float64(Float64(beta + Float64(beta + 2.0)) / alpha) / 2.0); end return tmp end
function tmp_2 = code(alpha, beta) tmp = 0.0; if (alpha <= 900.0) tmp = (1.0 + (beta / (beta + 2.0))) / 2.0; else tmp = ((beta + (beta + 2.0)) / alpha) / 2.0; end tmp_2 = tmp; end
code[alpha_, beta_] := If[LessEqual[alpha, 900.0], N[(N[(1.0 + N[(beta / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(beta + N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] / alpha), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\alpha \leq 900:\\
\;\;\;\;\frac{1 + \frac{\beta}{\beta + 2}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\beta + \left(\beta + 2\right)}{\alpha}}{2}\\
\end{array}
\end{array}
if alpha < 900Initial program 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in alpha around 0 98.9%
if 900 < alpha Initial program 24.8%
+-commutative24.8%
Simplified24.8%
Taylor expanded in alpha around -inf 81.7%
associate-*r/81.7%
sub-neg81.7%
mul-1-neg81.7%
distribute-lft-in81.7%
neg-mul-181.7%
mul-1-neg81.7%
remove-double-neg81.7%
neg-mul-181.7%
mul-1-neg81.7%
remove-double-neg81.7%
+-commutative81.7%
Simplified81.7%
Final simplification93.1%
(FPCore (alpha beta) :precision binary64 (if (<= beta 2.0) 0.5 1.0))
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.0) {
tmp = 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.0d0) then
tmp = 0.5d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.0) {
tmp = 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
def code(alpha, beta): tmp = 0 if beta <= 2.0: tmp = 0.5 else: tmp = 1.0 return tmp
function code(alpha, beta) tmp = 0.0 if (beta <= 2.0) tmp = 0.5; else tmp = 1.0; end return tmp end
function tmp_2 = code(alpha, beta) tmp = 0.0; if (beta <= 2.0) tmp = 0.5; else tmp = 1.0; end tmp_2 = tmp; end
code[alpha_, beta_] := If[LessEqual[beta, 2.0], 0.5, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if beta < 2Initial program 66.6%
+-commutative66.6%
Simplified66.6%
add-log-exp66.5%
associate-+l+66.5%
Applied egg-rr66.5%
Taylor expanded in beta around 0 65.1%
+-commutative65.1%
Simplified65.1%
Taylor expanded in alpha around 0 63.0%
if 2 < beta Initial program 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in beta around inf 87.6%
Final simplification71.3%
(FPCore (alpha beta) :precision binary64 0.5)
double code(double alpha, double beta) {
return 0.5;
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = 0.5d0
end function
public static double code(double alpha, double beta) {
return 0.5;
}
def code(alpha, beta): return 0.5
function code(alpha, beta) return 0.5 end
function tmp = code(alpha, beta) tmp = 0.5; end
code[alpha_, beta_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 74.4%
+-commutative74.4%
Simplified74.4%
add-log-exp74.4%
associate-+l+74.4%
Applied egg-rr74.4%
Taylor expanded in beta around 0 48.0%
+-commutative48.0%
Simplified48.0%
Taylor expanded in alpha around 0 47.7%
Final simplification47.7%
herbie shell --seed 2023188
(FPCore (alpha beta)
:name "Octave 3.8, jcobi/1"
:precision binary64
:pre (and (> alpha -1.0) (> beta -1.0))
(/ (+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0) 2.0))