
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
Initial program 100.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= mu -1.1e+112)
t_0
(if (<= mu 3e+175)
(+
(/ NaChar (+ 1.0 (exp (/ (+ EAccept (+ Ev Vef)) KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
t_0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (mu <= -1.1e+112) {
tmp = t_0;
} else if (mu <= 3e+175) {
tmp = (NaChar / (1.0 + exp(((EAccept + (Ev + Vef)) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (mu <= (-1.1d+112)) then
tmp = t_0
else if (mu <= 3d+175) then
tmp = (nachar / (1.0d0 + exp(((eaccept + (ev + vef)) / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (mu <= -1.1e+112) {
tmp = t_0;
} else if (mu <= 3e+175) {
tmp = (NaChar / (1.0 + Math.exp(((EAccept + (Ev + Vef)) / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if mu <= -1.1e+112: tmp = t_0 elif mu <= 3e+175: tmp = (NaChar / (1.0 + math.exp(((EAccept + (Ev + Vef)) / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (mu <= -1.1e+112) tmp = t_0; elseif (mu <= 3e+175) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(EAccept + Float64(Ev + Vef)) / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (mu <= -1.1e+112) tmp = t_0; elseif (mu <= 3e+175) tmp = (NaChar / (1.0 + exp(((EAccept + (Ev + Vef)) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[mu, -1.1e+112], t$95$0, If[LessEqual[mu, 3e+175], N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;mu \leq -1.1 \cdot 10^{+112}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;mu \leq 3 \cdot 10^{+175}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept + \left(Ev + Vef\right)}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if mu < -1.1e112 or 3.0000000000000002e175 < mu Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.3
Applied rewrites69.3%
if -1.1e112 < mu < 3.0000000000000002e175Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (/ Vef KbT))))
(t_1
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))))
(if (<= EAccept -1.1e-187)
(+ t_1 (/ NaChar (+ 1.0 (exp (/ Ev KbT)))))
(if (<= EAccept 2.7e-298)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ Ev Vef) mu) KbT)))))
(if (<= EAccept 3.6e-51)
(+
(/ NaChar t_0)
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= EAccept 3.7e+135)
(+
(/ NdChar t_0)
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
(+ t_1 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = 1.0 + exp((Vef / KbT));
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double tmp;
if (EAccept <= -1.1e-187) {
tmp = t_1 + (NaChar / (1.0 + exp((Ev / KbT))));
} else if (EAccept <= 2.7e-298) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT))));
} else if (EAccept <= 3.6e-51) {
tmp = (NaChar / t_0) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (EAccept <= 3.7e+135) {
tmp = (NdChar / t_0) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
} else {
tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + exp((vef / kbt))
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
if (eaccept <= (-1.1d-187)) then
tmp = t_1 + (nachar / (1.0d0 + exp((ev / kbt))))
else if (eaccept <= 2.7d-298) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp((((ev + vef) - mu) / kbt))))
else if (eaccept <= 3.6d-51) then
tmp = (nachar / t_0) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (eaccept <= 3.7d+135) then
tmp = (ndchar / t_0) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
else
tmp = t_1 + (nachar / (1.0d0 + exp((eaccept / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = 1.0 + Math.exp((Vef / KbT));
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double tmp;
if (EAccept <= -1.1e-187) {
tmp = t_1 + (NaChar / (1.0 + Math.exp((Ev / KbT))));
} else if (EAccept <= 2.7e-298) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp((((Ev + Vef) - mu) / KbT))));
} else if (EAccept <= 3.6e-51) {
tmp = (NaChar / t_0) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (EAccept <= 3.7e+135) {
tmp = (NdChar / t_0) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
} else {
tmp = t_1 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = 1.0 + math.exp((Vef / KbT)) t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) tmp = 0 if EAccept <= -1.1e-187: tmp = t_1 + (NaChar / (1.0 + math.exp((Ev / KbT)))) elif EAccept <= 2.7e-298: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp((((Ev + Vef) - mu) / KbT)))) elif EAccept <= 3.6e-51: tmp = (NaChar / t_0) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif EAccept <= 3.7e+135: tmp = (NdChar / t_0) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) else: tmp = t_1 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(1.0 + exp(Float64(Vef / KbT))) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) tmp = 0.0 if (EAccept <= -1.1e-187) tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))); elseif (EAccept <= 2.7e-298) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT))))); elseif (EAccept <= 3.6e-51) tmp = Float64(Float64(NaChar / t_0) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (EAccept <= 3.7e+135) tmp = Float64(Float64(NdChar / t_0) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))); else tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = 1.0 + exp((Vef / KbT)); t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); tmp = 0.0; if (EAccept <= -1.1e-187) tmp = t_1 + (NaChar / (1.0 + exp((Ev / KbT)))); elseif (EAccept <= 2.7e-298) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT)))); elseif (EAccept <= 3.6e-51) tmp = (NaChar / t_0) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (EAccept <= 3.7e+135) tmp = (NdChar / t_0) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); else tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[EAccept, -1.1e-187], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 2.7e-298], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 3.6e-51], N[(N[(NaChar / t$95$0), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 3.7e+135], N[(N[(NdChar / t$95$0), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + e^{\frac{Vef}{KbT}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
\mathbf{if}\;EAccept \leq -1.1 \cdot 10^{-187}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 2.7 \cdot 10^{-298}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(Ev + Vef\right) - mu}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 3.6 \cdot 10^{-51}:\\
\;\;\;\;\frac{NaChar}{t\_0} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 3.7 \cdot 10^{+135}:\\
\;\;\;\;\frac{NdChar}{t\_0} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if EAccept < -1.10000000000000004e-187Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.3
Applied rewrites69.3%
if -1.10000000000000004e-187 < EAccept < 2.7000000000000001e-298Initial program 100.0%
Taylor expanded in EDonor around inf
lower-/.f6468.7
Applied rewrites68.7%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
Taylor expanded in mu around inf
lower-/.f6464.3
Applied rewrites64.3%
if 2.7000000000000001e-298 < EAccept < 3.6e-51Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Vef around inf
lower-/.f6465.7
Applied rewrites65.7%
if 3.6e-51 < EAccept < 3.69999999999999997e135Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6469.9
Applied rewrites69.9%
if 3.69999999999999997e135 < EAccept Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.7
Applied rewrites68.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_1 (+ t_0 (/ NaChar (+ 1.0 (exp (/ Ev KbT)))))))
(if (<= EAccept -1.1e-187)
t_1
(if (<= EAccept 2.7e-298)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ Ev Vef) mu) KbT)))))
(if (<= EAccept 1.6e-62)
(+
(/ NaChar (+ 1.0 (exp (/ Vef KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= EAccept 7.5e+87)
t_1
(+ t_0 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + exp((Ev / KbT))));
double tmp;
if (EAccept <= -1.1e-187) {
tmp = t_1;
} else if (EAccept <= 2.7e-298) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT))));
} else if (EAccept <= 1.6e-62) {
tmp = (NaChar / (1.0 + exp((Vef / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (EAccept <= 7.5e+87) {
tmp = t_1;
} else {
tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = t_0 + (nachar / (1.0d0 + exp((ev / kbt))))
if (eaccept <= (-1.1d-187)) then
tmp = t_1
else if (eaccept <= 2.7d-298) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp((((ev + vef) - mu) / kbt))))
else if (eaccept <= 1.6d-62) then
tmp = (nachar / (1.0d0 + exp((vef / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (eaccept <= 7.5d+87) then
tmp = t_1
else
tmp = t_0 + (nachar / (1.0d0 + exp((eaccept / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + Math.exp((Ev / KbT))));
double tmp;
if (EAccept <= -1.1e-187) {
tmp = t_1;
} else if (EAccept <= 2.7e-298) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp((((Ev + Vef) - mu) / KbT))));
} else if (EAccept <= 1.6e-62) {
tmp = (NaChar / (1.0 + Math.exp((Vef / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (EAccept <= 7.5e+87) {
tmp = t_1;
} else {
tmp = t_0 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = t_0 + (NaChar / (1.0 + math.exp((Ev / KbT)))) tmp = 0 if EAccept <= -1.1e-187: tmp = t_1 elif EAccept <= 2.7e-298: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp((((Ev + Vef) - mu) / KbT)))) elif EAccept <= 1.6e-62: tmp = (NaChar / (1.0 + math.exp((Vef / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif EAccept <= 7.5e+87: tmp = t_1 else: tmp = t_0 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))) tmp = 0.0 if (EAccept <= -1.1e-187) tmp = t_1; elseif (EAccept <= 2.7e-298) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT))))); elseif (EAccept <= 1.6e-62) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (EAccept <= 7.5e+87) tmp = t_1; else tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = t_0 + (NaChar / (1.0 + exp((Ev / KbT)))); tmp = 0.0; if (EAccept <= -1.1e-187) tmp = t_1; elseif (EAccept <= 2.7e-298) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT)))); elseif (EAccept <= 1.6e-62) tmp = (NaChar / (1.0 + exp((Vef / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (EAccept <= 7.5e+87) tmp = t_1; else tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[EAccept, -1.1e-187], t$95$1, If[LessEqual[EAccept, 2.7e-298], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 1.6e-62], N[(N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 7.5e+87], t$95$1, N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := t\_0 + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{if}\;EAccept \leq -1.1 \cdot 10^{-187}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;EAccept \leq 2.7 \cdot 10^{-298}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(Ev + Vef\right) - mu}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 1.6 \cdot 10^{-62}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 7.5 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if EAccept < -1.10000000000000004e-187 or 1.60000000000000011e-62 < EAccept < 7.50000000000000014e87Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.3
Applied rewrites69.3%
if -1.10000000000000004e-187 < EAccept < 2.7000000000000001e-298Initial program 100.0%
Taylor expanded in EDonor around inf
lower-/.f6468.7
Applied rewrites68.7%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
Taylor expanded in mu around inf
lower-/.f6464.3
Applied rewrites64.3%
if 2.7000000000000001e-298 < EAccept < 1.60000000000000011e-62Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Vef around inf
lower-/.f6465.7
Applied rewrites65.7%
if 7.50000000000000014e87 < EAccept Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.7
Applied rewrites68.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NaChar (+ 1.0 (exp (/ Vef KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))))
(if (<= Vef -6e+134)
t_0
(if (<= Vef 5200.0)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
t_0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NaChar / (1.0 + exp((Vef / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
double tmp;
if (Vef <= -6e+134) {
tmp = t_0;
} else if (Vef <= 5200.0) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (nachar / (1.0d0 + exp((vef / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
if (vef <= (-6d+134)) then
tmp = t_0
else if (vef <= 5200.0d0) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NaChar / (1.0 + Math.exp((Vef / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
double tmp;
if (Vef <= -6e+134) {
tmp = t_0;
} else if (Vef <= 5200.0) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar / (1.0 + math.exp((Vef / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) tmp = 0 if Vef <= -6e+134: tmp = t_0 elif Vef <= 5200.0: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))) tmp = 0.0 if (Vef <= -6e+134) tmp = t_0; elseif (Vef <= 5200.0) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NaChar / (1.0 + exp((Vef / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); tmp = 0.0; if (Vef <= -6e+134) tmp = t_0; elseif (Vef <= 5200.0) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[Vef, -6e+134], t$95$0, If[LessEqual[Vef, 5200.0], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{if}\;Vef \leq -6 \cdot 10^{+134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;Vef \leq 5200:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if Vef < -5.99999999999999993e134 or 5200 < Vef Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Vef around inf
lower-/.f6465.7
Applied rewrites65.7%
if -5.99999999999999993e134 < Vef < 5200Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.3
Applied rewrites69.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_1 (+ t_0 (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
(t_2
(+
t_0
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_2 -5e-135)
t_1
(if (<= t_2 2e-45)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_1))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + exp((EAccept / KbT))));
double t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_2 <= -5e-135) {
tmp = t_1;
} else if (t_2 <= 2e-45) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = t_0 + (nachar / (1.0d0 + exp((eaccept / kbt))))
t_2 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_2 <= (-5d-135)) then
tmp = t_1
else if (t_2 <= 2d-45) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
double t_2 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_2 <= -5e-135) {
tmp = t_1;
} else if (t_2 <= 2e-45) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = t_0 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) t_2 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_2 <= -5e-135: tmp = t_1 elif t_2 <= 2e-45: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))) t_2 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -5e-135) tmp = t_1; elseif (t_2 <= 2e-45) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = t_0 + (NaChar / (1.0 + exp((EAccept / KbT)))); t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -5e-135) tmp = t_1; elseif (t_2 <= 2e-45) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-135], t$95$1, If[LessEqual[t$95$2, 2e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := t\_0 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
t_2 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-135 or 1.99999999999999997e-45 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.7
Applied rewrites68.7%
if -5.0000000000000002e-135 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 1.99999999999999997e-45Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(t_1 (+ (/ NaChar (+ 1.0 (exp (/ Vef KbT)))) t_0)))
(if (<= Vef -9.8e+134)
t_1
(if (<= Vef -5.5e-130)
(+ (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) t_0)
(if (<= Vef 6200000.0)
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- Ec EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
t_1)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)));
double t_1 = (NaChar / (1.0 + exp((Vef / KbT)))) + t_0;
double tmp;
if (Vef <= -9.8e+134) {
tmp = t_1;
} else if (Vef <= -5.5e-130) {
tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_0;
} else if (Vef <= 6200000.0) {
tmp = (NdChar / (1.0 + exp((-((Ec - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((EAccept / KbT))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))
t_1 = (nachar / (1.0d0 + exp((vef / kbt)))) + t_0
if (vef <= (-9.8d+134)) then
tmp = t_1
else if (vef <= (-5.5d-130)) then
tmp = (nachar / (1.0d0 + exp((ev / kbt)))) + t_0
else if (vef <= 6200000.0d0) then
tmp = (ndchar / (1.0d0 + exp((-((ec - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((eaccept / kbt))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)));
double t_1 = (NaChar / (1.0 + Math.exp((Vef / KbT)))) + t_0;
double tmp;
if (Vef <= -9.8e+134) {
tmp = t_1;
} else if (Vef <= -5.5e-130) {
tmp = (NaChar / (1.0 + Math.exp((Ev / KbT)))) + t_0;
} else if (Vef <= 6200000.0) {
tmp = (NdChar / (1.0 + Math.exp((-((Ec - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT))) t_1 = (NaChar / (1.0 + math.exp((Vef / KbT)))) + t_0 tmp = 0 if Vef <= -9.8e+134: tmp = t_1 elif Vef <= -5.5e-130: tmp = (NaChar / (1.0 + math.exp((Ev / KbT)))) + t_0 elif Vef <= 6200000.0: tmp = (NdChar / (1.0 + math.exp((-((Ec - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((EAccept / KbT)))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + t_0) tmp = 0.0 if (Vef <= -9.8e+134) tmp = t_1; elseif (Vef <= -5.5e-130) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))) + t_0); elseif (Vef <= 6200000.0) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Ec - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))); t_1 = (NaChar / (1.0 + exp((Vef / KbT)))) + t_0; tmp = 0.0; if (Vef <= -9.8e+134) tmp = t_1; elseif (Vef <= -5.5e-130) tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_0; elseif (Vef <= 6200000.0) tmp = (NdChar / (1.0 + exp((-((Ec - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((EAccept / KbT)))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[Vef, -9.8e+134], t$95$1, If[LessEqual[Vef, -5.5e-130], N[(N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[Vef, 6200000.0], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(Ec - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
t_1 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}} + t\_0\\
\mathbf{if}\;Vef \leq -9.8 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;Vef \leq -5.5 \cdot 10^{-130}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} + t\_0\\
\mathbf{elif}\;Vef \leq 6200000:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-\left(\left(Ec - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if Vef < -9.79999999999999992e134 or 6.2e6 < Vef Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Vef around inf
lower-/.f6465.7
Applied rewrites65.7%
if -9.79999999999999992e134 < Vef < -5.50000000000000007e-130Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Ev around inf
lower-/.f6464.1
Applied rewrites64.1%
if -5.50000000000000007e-130 < Vef < 6.2e6Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.7
Applied rewrites68.7%
Taylor expanded in Vef around 0
lower--.f6463.7
Applied rewrites63.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(t_1 (+ (/ NaChar (+ 1.0 (exp (/ Vef KbT)))) t_0)))
(if (<= Vef -9.8e+134)
t_1
(if (<= Vef -4.2e-167)
(+ (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) t_0)
(if (<= Vef 9.5e-8)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ Ev Vef) mu) KbT)))))
t_1)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)));
double t_1 = (NaChar / (1.0 + exp((Vef / KbT)))) + t_0;
double tmp;
if (Vef <= -9.8e+134) {
tmp = t_1;
} else if (Vef <= -4.2e-167) {
tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_0;
} else if (Vef <= 9.5e-8) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))
t_1 = (nachar / (1.0d0 + exp((vef / kbt)))) + t_0
if (vef <= (-9.8d+134)) then
tmp = t_1
else if (vef <= (-4.2d-167)) then
tmp = (nachar / (1.0d0 + exp((ev / kbt)))) + t_0
else if (vef <= 9.5d-8) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp((((ev + vef) - mu) / kbt))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)));
double t_1 = (NaChar / (1.0 + Math.exp((Vef / KbT)))) + t_0;
double tmp;
if (Vef <= -9.8e+134) {
tmp = t_1;
} else if (Vef <= -4.2e-167) {
tmp = (NaChar / (1.0 + Math.exp((Ev / KbT)))) + t_0;
} else if (Vef <= 9.5e-8) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp((((Ev + Vef) - mu) / KbT))));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT))) t_1 = (NaChar / (1.0 + math.exp((Vef / KbT)))) + t_0 tmp = 0 if Vef <= -9.8e+134: tmp = t_1 elif Vef <= -4.2e-167: tmp = (NaChar / (1.0 + math.exp((Ev / KbT)))) + t_0 elif Vef <= 9.5e-8: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp((((Ev + Vef) - mu) / KbT)))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + t_0) tmp = 0.0 if (Vef <= -9.8e+134) tmp = t_1; elseif (Vef <= -4.2e-167) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))) + t_0); elseif (Vef <= 9.5e-8) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT))))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))); t_1 = (NaChar / (1.0 + exp((Vef / KbT)))) + t_0; tmp = 0.0; if (Vef <= -9.8e+134) tmp = t_1; elseif (Vef <= -4.2e-167) tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_0; elseif (Vef <= 9.5e-8) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT)))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[Vef, -9.8e+134], t$95$1, If[LessEqual[Vef, -4.2e-167], N[(N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[Vef, 9.5e-8], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
t_1 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}} + t\_0\\
\mathbf{if}\;Vef \leq -9.8 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;Vef \leq -4.2 \cdot 10^{-167}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} + t\_0\\
\mathbf{elif}\;Vef \leq 9.5 \cdot 10^{-8}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(Ev + Vef\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if Vef < -9.79999999999999992e134 or 9.50000000000000036e-8 < Vef Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Vef around inf
lower-/.f6465.7
Applied rewrites65.7%
if -9.79999999999999992e134 < Vef < -4.20000000000000035e-167Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Ev around inf
lower-/.f6464.1
Applied rewrites64.1%
if -4.20000000000000035e-167 < Vef < 9.50000000000000036e-8Initial program 100.0%
Taylor expanded in EDonor around inf
lower-/.f6468.7
Applied rewrites68.7%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
Taylor expanded in mu around inf
lower-/.f6464.3
Applied rewrites64.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_0 -2e-149)
(+
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ Ev Vef) mu) KbT)))))
(if (<= t_0 2e-45)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+
(/ NaChar (+ 1.0 (exp (/ Ev KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_0 <= -2e-149) {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT))));
} else if (t_0 <= 2e-45) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_0 <= (-2d-149)) then
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + exp((((ev + vef) - mu) / kbt))))
else if (t_0 <= 2d-45) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (nachar / (1.0d0 + exp((ev / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_0 <= -2e-149) {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + Math.exp((((Ev + Vef) - mu) / KbT))));
} else if (t_0 <= 2e-45) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NaChar / (1.0 + Math.exp((Ev / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_0 <= -2e-149: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + math.exp((((Ev + Vef) - mu) / KbT)))) elif t_0 <= 2e-45: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NaChar / (1.0 + math.exp((Ev / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_0 <= -2e-149) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT))))); elseif (t_0 <= 2e-45) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_0 <= -2e-149) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT)))); elseif (t_0 <= 2e-45) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-149], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-149}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(Ev + Vef\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.99999999999999996e-149Initial program 100.0%
Taylor expanded in EDonor around inf
lower-/.f6468.7
Applied rewrites68.7%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
if -1.99999999999999996e-149 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 1.99999999999999997e-45Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
if 1.99999999999999997e-45 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Ev around inf
lower-/.f6464.1
Applied rewrites64.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(t_1 (+ (/ NaChar (+ 1.0 (exp (/ Vef KbT)))) t_0)))
(if (<= Vef -9.8e+134)
t_1
(if (<= Vef 1.15e-25) (+ (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) t_0) t_1))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)));
double t_1 = (NaChar / (1.0 + exp((Vef / KbT)))) + t_0;
double tmp;
if (Vef <= -9.8e+134) {
tmp = t_1;
} else if (Vef <= 1.15e-25) {
tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))
t_1 = (nachar / (1.0d0 + exp((vef / kbt)))) + t_0
if (vef <= (-9.8d+134)) then
tmp = t_1
else if (vef <= 1.15d-25) then
tmp = (nachar / (1.0d0 + exp((ev / kbt)))) + t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)));
double t_1 = (NaChar / (1.0 + Math.exp((Vef / KbT)))) + t_0;
double tmp;
if (Vef <= -9.8e+134) {
tmp = t_1;
} else if (Vef <= 1.15e-25) {
tmp = (NaChar / (1.0 + Math.exp((Ev / KbT)))) + t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT))) t_1 = (NaChar / (1.0 + math.exp((Vef / KbT)))) + t_0 tmp = 0 if Vef <= -9.8e+134: tmp = t_1 elif Vef <= 1.15e-25: tmp = (NaChar / (1.0 + math.exp((Ev / KbT)))) + t_0 else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + t_0) tmp = 0.0 if (Vef <= -9.8e+134) tmp = t_1; elseif (Vef <= 1.15e-25) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))) + t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))); t_1 = (NaChar / (1.0 + exp((Vef / KbT)))) + t_0; tmp = 0.0; if (Vef <= -9.8e+134) tmp = t_1; elseif (Vef <= 1.15e-25) tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_0; else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[Vef, -9.8e+134], t$95$1, If[LessEqual[Vef, 1.15e-25], N[(N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
t_1 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}} + t\_0\\
\mathbf{if}\;Vef \leq -9.8 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;Vef \leq 1.15 \cdot 10^{-25}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} + t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if Vef < -9.79999999999999992e134 or 1.15e-25 < Vef Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Vef around inf
lower-/.f6465.7
Applied rewrites65.7%
if -9.79999999999999992e134 < Vef < 1.15e-25Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Ev around inf
lower-/.f6464.1
Applied rewrites64.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT))))))
(if (<= t_0 -5e-135)
(+ (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))) t_1)
(if (<= t_0 2e-45)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+ (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) t_1)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double t_1 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)));
double tmp;
if (t_0 <= -5e-135) {
tmp = (NaChar / (1.0 + exp((EAccept / KbT)))) + t_1;
} else if (t_0 <= 2e-45) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
t_1 = ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))
if (t_0 <= (-5d-135)) then
tmp = (nachar / (1.0d0 + exp((eaccept / kbt)))) + t_1
else if (t_0 <= 2d-45) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (nachar / (1.0d0 + exp((ev / kbt)))) + t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double t_1 = NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)));
double tmp;
if (t_0 <= -5e-135) {
tmp = (NaChar / (1.0 + Math.exp((EAccept / KbT)))) + t_1;
} else if (t_0 <= 2e-45) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NaChar / (1.0 + Math.exp((Ev / KbT)))) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) t_1 = NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT))) tmp = 0 if t_0 <= -5e-135: tmp = (NaChar / (1.0 + math.exp((EAccept / KbT)))) + t_1 elif t_0 <= 2e-45: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NaChar / (1.0 + math.exp((Ev / KbT)))) + t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) tmp = 0.0 if (t_0 <= -5e-135) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))) + t_1); elseif (t_0 <= 2e-45) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))) + t_1); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); t_1 = NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))); tmp = 0.0; if (t_0 <= -5e-135) tmp = (NaChar / (1.0 + exp((EAccept / KbT)))) + t_1; elseif (t_0 <= 2e-45) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NaChar / (1.0 + exp((Ev / KbT)))) + t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-135], N[(N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 2e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-135}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} + t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} + t\_1\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-135Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in EAccept around inf
lower-/.f6463.5
Applied rewrites63.5%
if -5.0000000000000002e-135 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 1.99999999999999997e-45Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
if 1.99999999999999997e-45 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in Ev around inf
lower-/.f6464.1
Applied rewrites64.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT))))))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_1 -5e-135)
t_0
(if (<= t_1 2e-45)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NaChar / (1.0 + exp((EAccept / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_1 <= -5e-135) {
tmp = t_0;
} else if (t_1 <= 2e-45) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (nachar / (1.0d0 + exp((eaccept / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_1 <= (-5d-135)) then
tmp = t_0
else if (t_1 <= 2d-45) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NaChar / (1.0 + Math.exp((EAccept / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_1 <= -5e-135) {
tmp = t_0;
} else if (t_1 <= 2e-45) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar / (1.0 + math.exp((EAccept / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_1 <= -5e-135: tmp = t_0 elif t_1 <= 2e-45: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -5e-135) tmp = t_0; elseif (t_1 <= 2e-45) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NaChar / (1.0 + exp((EAccept / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -5e-135) tmp = t_0; elseif (t_1 <= 2e-45) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-135], t$95$0, If[LessEqual[t$95$1, 2e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-135 or 1.99999999999999997e-45 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in EAccept around inf
lower-/.f6463.5
Applied rewrites63.5%
if -5.0000000000000002e-135 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 1.99999999999999997e-45Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_1
(+
t_0
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_1 -2e+38)
(+
(/ NdChar 2.0)
(/ NaChar (- (exp (/ (- EAccept (- (- mu Ev) Vef)) KbT)) -1.0)))
(if (<= t_1 -5e-121)
(+
(/ NdChar (- (exp (/ (- mu (- Ec EDonor)) KbT)) -1.0))
(* 0.5 NaChar))
(if (<= t_1 2e-45)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+ t_0 (* 0.5 NaChar)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_1 <= -2e+38) {
tmp = (NdChar / 2.0) + (NaChar / (exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0));
} else if (t_1 <= -5e-121) {
tmp = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
} else if (t_1 <= 2e-45) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0 + (0.5 * NaChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_1 <= (-2d+38)) then
tmp = (ndchar / 2.0d0) + (nachar / (exp(((eaccept - ((mu - ev) - vef)) / kbt)) - (-1.0d0)))
else if (t_1 <= (-5d-121)) then
tmp = (ndchar / (exp(((mu - (ec - edonor)) / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
else if (t_1 <= 2d-45) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_0 + (0.5d0 * nachar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_1 <= -2e+38) {
tmp = (NdChar / 2.0) + (NaChar / (Math.exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0));
} else if (t_1 <= -5e-121) {
tmp = (NdChar / (Math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
} else if (t_1 <= 2e-45) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0 + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_1 <= -2e+38: tmp = (NdChar / 2.0) + (NaChar / (math.exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0)) elif t_1 <= -5e-121: tmp = (NdChar / (math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar) elif t_1 <= 2e-45: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_0 + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -2e+38) tmp = Float64(Float64(NdChar / 2.0) + Float64(NaChar / Float64(exp(Float64(Float64(EAccept - Float64(Float64(mu - Ev) - Vef)) / KbT)) - -1.0))); elseif (t_1 <= -5e-121) tmp = Float64(Float64(NdChar / Float64(exp(Float64(Float64(mu - Float64(Ec - EDonor)) / KbT)) - -1.0)) + Float64(0.5 * NaChar)); elseif (t_1 <= 2e-45) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(t_0 + Float64(0.5 * NaChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -2e+38) tmp = (NdChar / 2.0) + (NaChar / (exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0)); elseif (t_1 <= -5e-121) tmp = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar); elseif (t_1 <= 2e-45) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_0 + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+38], N[(N[(NdChar / 2.0), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[(EAccept - N[(N[(mu - Ev), $MachinePrecision] - Vef), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-121], N[(N[(NdChar / N[(N[Exp[N[(N[(mu - N[(Ec - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+38}:\\
\;\;\;\;\frac{NdChar}{2} + \frac{NaChar}{e^{\frac{EAccept - \left(\left(mu - Ev\right) - Vef\right)}{KbT}} - -1}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-121}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu - \left(Ec - EDonor\right)}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + 0.5 \cdot NaChar\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.99999999999999995e38Initial program 100.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6499.8
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in KbT around inf
Applied rewrites47.1%
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6447.1
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.1
Applied rewrites47.1%
if -1.99999999999999995e38 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.99999999999999989e-121Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
Taylor expanded in Vef around 0
lower--.f6444.2
Applied rewrites44.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6444.2
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lower--.f6444.2
Applied rewrites44.2%
if -4.99999999999999989e-121 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 1.99999999999999997e-45Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
if 1.99999999999999997e-45 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_0 -2e+38)
(+
(/ NdChar 2.0)
(/ NaChar (- (exp (/ (- EAccept (- (- mu Ev) Vef)) KbT)) -1.0)))
(if (<= t_0 -5e-121)
(+
(/ NdChar (- (exp (/ (- mu (- Ec EDonor)) KbT)) -1.0))
(* 0.5 NaChar))
(if (<= t_0 2e-45)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+
(/ NdChar (+ 1.0 (exp (/ (- (- Ec (+ Vef mu))) KbT))))
(* 0.5 NaChar)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_0 <= -2e+38) {
tmp = (NdChar / 2.0) + (NaChar / (exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0));
} else if (t_0 <= -5e-121) {
tmp = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
} else if (t_0 <= 2e-45) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + exp((-(Ec - (Vef + mu)) / KbT)))) + (0.5 * NaChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_0 <= (-2d+38)) then
tmp = (ndchar / 2.0d0) + (nachar / (exp(((eaccept - ((mu - ev) - vef)) / kbt)) - (-1.0d0)))
else if (t_0 <= (-5d-121)) then
tmp = (ndchar / (exp(((mu - (ec - edonor)) / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
else if (t_0 <= 2d-45) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (ndchar / (1.0d0 + exp((-(ec - (vef + mu)) / kbt)))) + (0.5d0 * nachar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_0 <= -2e+38) {
tmp = (NdChar / 2.0) + (NaChar / (Math.exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0));
} else if (t_0 <= -5e-121) {
tmp = (NdChar / (Math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
} else if (t_0 <= 2e-45) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + Math.exp((-(Ec - (Vef + mu)) / KbT)))) + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_0 <= -2e+38: tmp = (NdChar / 2.0) + (NaChar / (math.exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0)) elif t_0 <= -5e-121: tmp = (NdChar / (math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar) elif t_0 <= 2e-45: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NdChar / (1.0 + math.exp((-(Ec - (Vef + mu)) / KbT)))) + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_0 <= -2e+38) tmp = Float64(Float64(NdChar / 2.0) + Float64(NaChar / Float64(exp(Float64(Float64(EAccept - Float64(Float64(mu - Ev) - Vef)) / KbT)) - -1.0))); elseif (t_0 <= -5e-121) tmp = Float64(Float64(NdChar / Float64(exp(Float64(Float64(mu - Float64(Ec - EDonor)) / KbT)) - -1.0)) + Float64(0.5 * NaChar)); elseif (t_0 <= 2e-45) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Ec - Float64(Vef + mu))) / KbT)))) + Float64(0.5 * NaChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_0 <= -2e+38) tmp = (NdChar / 2.0) + (NaChar / (exp(((EAccept - ((mu - Ev) - Vef)) / KbT)) - -1.0)); elseif (t_0 <= -5e-121) tmp = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar); elseif (t_0 <= 2e-45) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NdChar / (1.0 + exp((-(Ec - (Vef + mu)) / KbT)))) + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+38], N[(N[(NdChar / 2.0), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[(EAccept - N[(N[(mu - Ev), $MachinePrecision] - Vef), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -5e-121], N[(N[(NdChar / N[(N[Exp[N[(N[(mu - N[(Ec - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(Ec - N[(Vef + mu), $MachinePrecision]), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+38}:\\
\;\;\;\;\frac{NdChar}{2} + \frac{NaChar}{e^{\frac{EAccept - \left(\left(mu - Ev\right) - Vef\right)}{KbT}} - -1}\\
\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-121}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu - \left(Ec - EDonor\right)}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-\left(Ec - \left(Vef + mu\right)\right)}{KbT}}} + 0.5 \cdot NaChar\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.99999999999999995e38Initial program 100.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6499.8
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in KbT around inf
Applied rewrites47.1%
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6447.1
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.1
Applied rewrites47.1%
if -1.99999999999999995e38 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.99999999999999989e-121Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
Taylor expanded in Vef around 0
lower--.f6444.2
Applied rewrites44.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6444.2
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lower--.f6444.2
Applied rewrites44.2%
if -4.99999999999999989e-121 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 1.99999999999999997e-45Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
if 1.99999999999999997e-45 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
Taylor expanded in EDonor around 0
lower--.f64N/A
lower-+.f6443.4
Applied rewrites43.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= KbT -9e+140)
(+ (/ NaChar 2.0) (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= KbT 2.7e+204)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+
(/ NdChar (- (exp (/ (- mu (- Ec EDonor)) KbT)) -1.0))
(* 0.5 NaChar)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -9e+140) {
tmp = (NaChar / 2.0) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (KbT <= 2.7e+204) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-9d+140)) then
tmp = (nachar / 2.0d0) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (kbt <= 2.7d+204) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (ndchar / (exp(((mu - (ec - edonor)) / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -9e+140) {
tmp = (NaChar / 2.0) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (KbT <= 2.7e+204) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (Math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -9e+140: tmp = (NaChar / 2.0) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif KbT <= 2.7e+204: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NdChar / (math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -9e+140) tmp = Float64(Float64(NaChar / 2.0) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (KbT <= 2.7e+204) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(exp(Float64(Float64(mu - Float64(Ec - EDonor)) / KbT)) - -1.0)) + Float64(0.5 * NaChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -9e+140) tmp = (NaChar / 2.0) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (KbT <= 2.7e+204) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -9e+140], N[(N[(NaChar / 2.0), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 2.7e+204], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(N[Exp[N[(N[(mu - N[(Ec - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -9 \cdot 10^{+140}:\\
\;\;\;\;\frac{NaChar}{2} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;KbT \leq 2.7 \cdot 10^{+204}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu - \left(Ec - EDonor\right)}{KbT}} - -1} + 0.5 \cdot NaChar\\
\end{array}
\end{array}
if KbT < -9.0000000000000003e140Initial program 100.0%
Taylor expanded in mu around 0
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in KbT around inf
Applied rewrites43.9%
if -9.0000000000000003e140 < KbT < 2.6999999999999999e204Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
if 2.6999999999999999e204 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
Taylor expanded in Vef around 0
lower--.f6444.2
Applied rewrites44.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6444.2
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lower--.f6444.2
Applied rewrites44.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (- (exp (/ (- mu (- Ec EDonor)) KbT)) -1.0))
(* 0.5 NaChar))))
(if (<= KbT -9e+140)
t_0
(if (<= KbT 2.7e+204)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
double tmp;
if (KbT <= -9e+140) {
tmp = t_0;
} else if (KbT <= 2.7e+204) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (exp(((mu - (ec - edonor)) / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
if (kbt <= (-9d+140)) then
tmp = t_0
else if (kbt <= 2.7d+204) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (Math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar);
double tmp;
if (KbT <= -9e+140) {
tmp = t_0;
} else if (KbT <= 2.7e+204) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (math.exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar) tmp = 0 if KbT <= -9e+140: tmp = t_0 elif KbT <= 2.7e+204: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(exp(Float64(Float64(mu - Float64(Ec - EDonor)) / KbT)) - -1.0)) + Float64(0.5 * NaChar)) tmp = 0.0 if (KbT <= -9e+140) tmp = t_0; elseif (KbT <= 2.7e+204) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (exp(((mu - (Ec - EDonor)) / KbT)) - -1.0)) + (0.5 * NaChar); tmp = 0.0; if (KbT <= -9e+140) tmp = t_0; elseif (KbT <= 2.7e+204) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(N[Exp[N[(N[(mu - N[(Ec - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -9e+140], t$95$0, If[LessEqual[KbT, 2.7e+204], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{e^{\frac{mu - \left(Ec - EDonor\right)}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{if}\;KbT \leq -9 \cdot 10^{+140}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;KbT \leq 2.7 \cdot 10^{+204}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if KbT < -9.0000000000000003e140 or 2.6999999999999999e204 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
Taylor expanded in Vef around 0
lower--.f6444.2
Applied rewrites44.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6444.2
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lower--.f6444.2
Applied rewrites44.2%
if -9.0000000000000003e140 < KbT < 2.6999999999999999e204Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= KbT -9.4e+180) (+ (/ NdChar (+ 1.0 (exp (/ (- (* -1.0 Vef)) KbT)))) (* 0.5 NaChar)) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -9.4e+180) {
tmp = (NdChar / (1.0 + exp((-(-1.0 * Vef) / KbT)))) + (0.5 * NaChar);
} else {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-9.4d+180)) then
tmp = (ndchar / (1.0d0 + exp((-((-1.0d0) * vef) / kbt)))) + (0.5d0 * nachar)
else
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -9.4e+180) {
tmp = (NdChar / (1.0 + Math.exp((-(-1.0 * Vef) / KbT)))) + (0.5 * NaChar);
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -9.4e+180: tmp = (NdChar / (1.0 + math.exp((-(-1.0 * Vef) / KbT)))) + (0.5 * NaChar) else: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -9.4e+180) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(-1.0 * Vef)) / KbT)))) + Float64(0.5 * NaChar)); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -9.4e+180) tmp = (NdChar / (1.0 + exp((-(-1.0 * Vef) / KbT)))) + (0.5 * NaChar); else tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -9.4e+180], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(-1.0 * Vef), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -9.4 \cdot 10^{+180}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{--1 \cdot Vef}{KbT}}} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\end{array}
\end{array}
if KbT < -9.39999999999999944e180Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.1
Applied rewrites47.1%
Taylor expanded in Vef around 0
lower--.f6444.2
Applied rewrites44.2%
Taylor expanded in Vef around inf
lower-*.f6434.8
Applied rewrites34.8%
if -9.39999999999999944e180 < KbT Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= KbT -1.05e+185) (* 0.5 NdChar) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -1.05e+185) {
tmp = 0.5 * NdChar;
} else {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-1.05d+185)) then
tmp = 0.5d0 * ndchar
else
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -1.05e+185) {
tmp = 0.5 * NdChar;
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -1.05e+185: tmp = 0.5 * NdChar else: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -1.05e+185) tmp = Float64(0.5 * NdChar); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -1.05e+185) tmp = 0.5 * NdChar; else tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -1.05e+185], N[(0.5 * NdChar), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -1.05 \cdot 10^{+185}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\end{array}
\end{array}
if KbT < -1.05e185Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
Taylor expanded in NdChar around 0
lower-*.f6418.4
Applied rewrites18.4%
Taylor expanded in NdChar around inf
lower-*.f6418.3
Applied rewrites18.3%
if -1.05e185 < KbT Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= EAccept 1.4e+134) (/ NaChar (+ 1.0 (exp (/ (- (+ Ev Vef) mu) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept Vef) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= 1.4e+134) {
tmp = NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT)));
} else {
tmp = NaChar / (1.0 + exp((((EAccept + Vef) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (eaccept <= 1.4d+134) then
tmp = nachar / (1.0d0 + exp((((ev + vef) - mu) / kbt)))
else
tmp = nachar / (1.0d0 + exp((((eaccept + vef) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= 1.4e+134) {
tmp = NaChar / (1.0 + Math.exp((((Ev + Vef) - mu) / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + Vef) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if EAccept <= 1.4e+134: tmp = NaChar / (1.0 + math.exp((((Ev + Vef) - mu) / KbT))) else: tmp = NaChar / (1.0 + math.exp((((EAccept + Vef) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EAccept <= 1.4e+134) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Vef) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (EAccept <= 1.4e+134) tmp = NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT))); else tmp = NaChar / (1.0 + exp((((EAccept + Vef) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, 1.4e+134], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;EAccept \leq 1.4 \cdot 10^{+134}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(Ev + Vef\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + Vef\right) - mu}{KbT}}}\\
\end{array}
\end{array}
if EAccept < 1.3999999999999999e134Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
Taylor expanded in EAccept around 0
lower-/.f64N/A
lower--.f64N/A
lower-+.f6454.0
Applied rewrites54.0%
if 1.3999999999999999e134 < EAccept Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
Taylor expanded in Ev around 0
lower-+.f6454.1
Applied rewrites54.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= KbT -1.05e+185) (* 0.5 NdChar) (/ NaChar (+ 1.0 (exp (/ (- (+ Ev Vef) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -1.05e+185) {
tmp = 0.5 * NdChar;
} else {
tmp = NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-1.05d+185)) then
tmp = 0.5d0 * ndchar
else
tmp = nachar / (1.0d0 + exp((((ev + vef) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -1.05e+185) {
tmp = 0.5 * NdChar;
} else {
tmp = NaChar / (1.0 + Math.exp((((Ev + Vef) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -1.05e+185: tmp = 0.5 * NdChar else: tmp = NaChar / (1.0 + math.exp((((Ev + Vef) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -1.05e+185) tmp = Float64(0.5 * NdChar); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -1.05e+185) tmp = 0.5 * NdChar; else tmp = NaChar / (1.0 + exp((((Ev + Vef) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -1.05e+185], N[(0.5 * NdChar), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -1.05 \cdot 10^{+185}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(Ev + Vef\right) - mu}{KbT}}}\\
\end{array}
\end{array}
if KbT < -1.05e185Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
Taylor expanded in NdChar around 0
lower-*.f6418.4
Applied rewrites18.4%
Taylor expanded in NdChar around inf
lower-*.f6418.3
Applied rewrites18.3%
if -1.05e185 < KbT Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
Taylor expanded in EAccept around 0
lower-/.f64N/A
lower--.f64N/A
lower-+.f6454.0
Applied rewrites54.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= KbT -1.9e+183) (* 0.5 NdChar) (/ NaChar (- (exp (/ (- mu) KbT)) -1.0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -1.9e+183) {
tmp = 0.5 * NdChar;
} else {
tmp = NaChar / (exp((-mu / KbT)) - -1.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-1.9d+183)) then
tmp = 0.5d0 * ndchar
else
tmp = nachar / (exp((-mu / kbt)) - (-1.0d0))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -1.9e+183) {
tmp = 0.5 * NdChar;
} else {
tmp = NaChar / (Math.exp((-mu / KbT)) - -1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -1.9e+183: tmp = 0.5 * NdChar else: tmp = NaChar / (math.exp((-mu / KbT)) - -1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -1.9e+183) tmp = Float64(0.5 * NdChar); else tmp = Float64(NaChar / Float64(exp(Float64(Float64(-mu) / KbT)) - -1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -1.9e+183) tmp = 0.5 * NdChar; else tmp = NaChar / (exp((-mu / KbT)) - -1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -1.9e+183], N[(0.5 * NdChar), $MachinePrecision], N[(NaChar / N[(N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -1.9 \cdot 10^{+183}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{-mu}{KbT}} - -1}\\
\end{array}
\end{array}
if KbT < -1.9e183Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
Taylor expanded in NdChar around 0
lower-*.f6418.4
Applied rewrites18.4%
Taylor expanded in NdChar around inf
lower-*.f6418.3
Applied rewrites18.3%
if -1.9e183 < KbT Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6434.5
Applied rewrites34.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6434.5
+-commutative34.5
sub-flip-reverse34.5
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6434.5
Applied rewrites34.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* (+ NaChar NdChar) 0.5))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NaChar + NdChar) * 0.5;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (nachar + ndchar) * 0.5d0
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NaChar + NdChar) * 0.5;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NaChar + NdChar) * 0.5
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NaChar + NdChar) * 0.5) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NaChar + NdChar) * 0.5; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(NaChar + NdChar\right) \cdot 0.5
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.7
Applied rewrites27.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= Ev -1.48e+116) (* 0.5 NdChar) (* 0.5 NaChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (Ev <= -1.48e+116) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (ev <= (-1.48d+116)) then
tmp = 0.5d0 * ndchar
else
tmp = 0.5d0 * nachar
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (Ev <= -1.48e+116) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if Ev <= -1.48e+116: tmp = 0.5 * NdChar else: tmp = 0.5 * NaChar return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (Ev <= -1.48e+116) tmp = Float64(0.5 * NdChar); else tmp = Float64(0.5 * NaChar); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (Ev <= -1.48e+116) tmp = 0.5 * NdChar; else tmp = 0.5 * NaChar; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[Ev, -1.48e+116], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;Ev \leq -1.48 \cdot 10^{+116}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NaChar\\
\end{array}
\end{array}
if Ev < -1.48000000000000002e116Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
Taylor expanded in NdChar around 0
lower-*.f6418.4
Applied rewrites18.4%
Taylor expanded in NdChar around inf
lower-*.f6418.3
Applied rewrites18.3%
if -1.48000000000000002e116 < Ev Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
Taylor expanded in NdChar around 0
lower-*.f6418.4
Applied rewrites18.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 NaChar))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * nachar
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * NaChar
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * NaChar) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * NaChar; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot NaChar
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.7
Applied rewrites27.7%
Taylor expanded in NdChar around 0
lower-*.f6418.4
Applied rewrites18.4%
herbie shell --seed 2025164
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:name "Bulmash initializePoisson"
:precision binary64
(+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))