
(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]
\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}}}
Herbie found 21 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]
\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}}}
(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 -2.4e+173)
t_0
(if (<= mu 1.22e+83)
(+
(/ 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 <= -2.4e+173) {
tmp = t_0;
} else if (mu <= 1.22e+83) {
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 <= (-2.4d+173)) then
tmp = t_0
else if (mu <= 1.22d+83) 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 <= -2.4e+173) {
tmp = t_0;
} else if (mu <= 1.22e+83) {
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 <= -2.4e+173: tmp = t_0 elif mu <= 1.22e+83: 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 <= -2.4e+173) tmp = t_0; elseif (mu <= 1.22e+83) 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 <= -2.4e+173) tmp = t_0; elseif (mu <= 1.22e+83) 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, -2.4e+173], t$95$0, If[LessEqual[mu, 1.22e+83], 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}
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 -2.4 \cdot 10^{+173}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;mu \leq 1.22 \cdot 10^{+83}:\\
\;\;\;\;\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}
if mu < -2.3999999999999999e173 or 1.22e83 < mu Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.2%
Applied rewrites69.2%
if -2.3999999999999999e173 < mu < 1.22e83Initial 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 rewrites85.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_0)))
(if (<= t_1 -2e-288)
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ Vef mu) Ec) KbT))))
(/ NaChar (+ 1.0 (exp (* -1.0 (/ mu KbT))))))
(if (<= t_1 2e-304)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+ (/ NdChar (+ 1.0 (exp (/ 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(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0;
double tmp;
if (t_1 <= -2e-288) {
tmp = (NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + exp((-1.0 * (mu / KbT)))));
} else if (t_1 <= 2e-304) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + 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(((((ev + vef) + eaccept) + -mu) / kbt)))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_0
if (t_1 <= (-2d-288)) then
tmp = (ndchar / (1.0d0 + exp((((vef + mu) - ec) / kbt)))) + (nachar / (1.0d0 + exp(((-1.0d0) * (mu / kbt)))))
else if (t_1 <= 2d-304) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + 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(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0;
double tmp;
if (t_1 <= -2e-288) {
tmp = (NdChar / (1.0 + Math.exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + Math.exp((-1.0 * (mu / KbT)))));
} else if (t_1 <= 2e-304) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0 tmp = 0 if t_1 <= -2e-288: tmp = (NdChar / (1.0 + math.exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + math.exp((-1.0 * (mu / KbT))))) elif t_1 <= 2e-304: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_0) tmp = 0.0 if (t_1 <= -2e-288) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(Vef + mu) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(-1.0 * Float64(mu / KbT)))))); elseif (t_1 <= 2e-304) 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(mu / KbT)))) + 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(((((Ev + Vef) + EAccept) + -mu) / KbT))); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0; tmp = 0.0; if (t_1 <= -2e-288) tmp = (NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + exp((-1.0 * (mu / KbT))))); elseif (t_1 <= 2e-304) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{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]}, 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] + t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-288], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(Vef + mu), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(-1.0 * N[(mu / KbT), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-304], 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[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-288}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(Vef + mu\right) - Ec}{KbT}}} + \frac{NaChar}{1 + e^{-1 \cdot \frac{mu}{KbT}}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-304}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_0\\
\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))))) < -2.00000000000000012e-288Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
Taylor expanded in EDonor around 0
lower-/.f64N/A
lower--.f64N/A
lower-+.f6463.5%
Applied rewrites63.5%
if -2.00000000000000012e-288 < (+.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.99999999999999994e-304Initial 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.9%
Applied rewrites60.9%
if 1.99999999999999994e-304 < (+.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 inf
lower-/.f6469.2%
Applied rewrites69.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ Vef mu) Ec) KbT))))
(/ NaChar (+ 1.0 (exp (* -1.0 (/ mu KbT)))))))
(t_1
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -2e-288)
t_0
(if (<= t_2 2e-290)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(if (<= t_2 2e+67)
t_0
(+ (/ NdChar (+ 1.0 (exp (/ EDonor 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((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + exp((-1.0 * (mu / KbT)))));
double t_1 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-288) {
tmp = t_0;
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = t_0;
} else {
tmp = (NdChar / (1.0 + exp((EDonor / 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) :: t_2
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((((vef + mu) - ec) / kbt)))) + (nachar / (1.0d0 + exp(((-1.0d0) * (mu / kbt)))))
t_1 = nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt)))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-2d-288)) then
tmp = t_0
else if (t_2 <= 2d-290) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else if (t_2 <= 2d+67) then
tmp = t_0
else
tmp = (ndchar / (1.0d0 + exp((edonor / 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((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + Math.exp((-1.0 * (mu / KbT)))));
double t_1 = NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-288) {
tmp = t_0;
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = t_0;
} else {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + math.exp((-1.0 * (mu / KbT))))) t_1 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -2e-288: tmp = t_0 elif t_2 <= 2e-290: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) elif t_2 <= 2e+67: tmp = t_0 else: tmp = (NdChar / (1.0 + math.exp((EDonor / 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(Vef + mu) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(-1.0 * Float64(mu / KbT)))))) t_1 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if (t_2 <= -2e-288) tmp = t_0; elseif (t_2 <= 2e-290) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); elseif (t_2 <= 2e+67) tmp = t_0; else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / 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((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + exp((-1.0 * (mu / KbT))))); t_1 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -2e-288) tmp = t_0; elseif (t_2 <= 2e-290) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); elseif (t_2 <= 2e+67) tmp = t_0; else tmp = (NdChar / (1.0 + exp((EDonor / 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[(Vef + mu), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(-1.0 * N[(mu / KbT), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-288], t$95$0, If[LessEqual[t$95$2, 2e-290], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+67], t$95$0, N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{\left(Vef + mu\right) - Ec}{KbT}}} + \frac{NaChar}{1 + e^{-1 \cdot \frac{mu}{KbT}}}\\
t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-288}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-290}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + t\_1\\
\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))))) < -2.00000000000000012e-288 or 2.0000000000000001e-290 < (+.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.99999999999999997e67Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
Taylor expanded in EDonor around 0
lower-/.f64N/A
lower--.f64N/A
lower-+.f6463.5%
Applied rewrites63.5%
if -2.00000000000000012e-288 < (+.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))))) < 2.0000000000000001e-290Initial 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.9%
Applied rewrites60.9%
if 1.99999999999999997e67 < (+.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 EDonor around inf
lower-/.f6469.1%
Applied rewrites69.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ Vef mu) Ec) KbT))))
(/ NaChar (+ 1.0 (exp (* -1.0 (/ mu KbT)))))))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
(t_2 (+ EAccept (+ Ev Vef))))
(if (<= t_1 -2e-288)
t_0
(if (<= t_1 2e-290)
(/ NaChar (+ 1.0 (exp (/ (- t_2 mu) KbT))))
(if (<= t_1 2e+67)
t_0
(+
(/ NaChar (+ 1.0 (exp (/ t_2 KbT))))
(/ NdChar (+ 1.0 (exp (/ EDonor 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((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + exp((-1.0 * (mu / KbT)))));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double t_2 = EAccept + (Ev + Vef);
double tmp;
if (t_1 <= -2e-288) {
tmp = t_0;
} else if (t_1 <= 2e-290) {
tmp = NaChar / (1.0 + exp(((t_2 - mu) / KbT)));
} else if (t_1 <= 2e+67) {
tmp = t_0;
} else {
tmp = (NaChar / (1.0 + exp((t_2 / KbT)))) + (NdChar / (1.0 + exp((EDonor / 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) :: t_2
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((((vef + mu) - ec) / kbt)))) + (nachar / (1.0d0 + exp(((-1.0d0) * (mu / kbt)))))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
t_2 = eaccept + (ev + vef)
if (t_1 <= (-2d-288)) then
tmp = t_0
else if (t_1 <= 2d-290) then
tmp = nachar / (1.0d0 + exp(((t_2 - mu) / kbt)))
else if (t_1 <= 2d+67) then
tmp = t_0
else
tmp = (nachar / (1.0d0 + exp((t_2 / kbt)))) + (ndchar / (1.0d0 + exp((edonor / 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((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + Math.exp((-1.0 * (mu / 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 t_2 = EAccept + (Ev + Vef);
double tmp;
if (t_1 <= -2e-288) {
tmp = t_0;
} else if (t_1 <= 2e-290) {
tmp = NaChar / (1.0 + Math.exp(((t_2 - mu) / KbT)));
} else if (t_1 <= 2e+67) {
tmp = t_0;
} else {
tmp = (NaChar / (1.0 + Math.exp((t_2 / KbT)))) + (NdChar / (1.0 + Math.exp((EDonor / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + math.exp((-1.0 * (mu / KbT))))) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) t_2 = EAccept + (Ev + Vef) tmp = 0 if t_1 <= -2e-288: tmp = t_0 elif t_1 <= 2e-290: tmp = NaChar / (1.0 + math.exp(((t_2 - mu) / KbT))) elif t_1 <= 2e+67: tmp = t_0 else: tmp = (NaChar / (1.0 + math.exp((t_2 / KbT)))) + (NdChar / (1.0 + math.exp((EDonor / 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(Vef + mu) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(-1.0 * Float64(mu / 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))))) t_2 = Float64(EAccept + Float64(Ev + Vef)) tmp = 0.0 if (t_1 <= -2e-288) tmp = t_0; elseif (t_1 <= 2e-290) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_2 - mu) / KbT)))); elseif (t_1 <= 2e+67) tmp = t_0; else tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(t_2 / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)))) + (NaChar / (1.0 + exp((-1.0 * (mu / KbT))))); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); t_2 = EAccept + (Ev + Vef); tmp = 0.0; if (t_1 <= -2e-288) tmp = t_0; elseif (t_1 <= 2e-290) tmp = NaChar / (1.0 + exp(((t_2 - mu) / KbT))); elseif (t_1 <= 2e+67) tmp = t_0; else tmp = (NaChar / (1.0 + exp((t_2 / KbT)))) + (NdChar / (1.0 + exp((EDonor / 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[(Vef + mu), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(-1.0 * N[(mu / KbT), $MachinePrecision]), $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]}, Block[{t$95$2 = N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-288], t$95$0, If[LessEqual[t$95$1, 2e-290], N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$2 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+67], t$95$0, N[(N[(NaChar / N[(1.0 + N[Exp[N[(t$95$2 / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{\left(Vef + mu\right) - Ec}{KbT}}} + \frac{NaChar}{1 + e^{-1 \cdot \frac{mu}{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}}}\\
t_2 := EAccept + \left(Ev + Vef\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-288}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-290}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{t\_2 - mu}{KbT}}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{t\_2}{KbT}}} + \frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\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))))) < -2.00000000000000012e-288 or 2.0000000000000001e-290 < (+.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.99999999999999997e67Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
Taylor expanded in EDonor around 0
lower-/.f64N/A
lower--.f64N/A
lower-+.f6463.5%
Applied rewrites63.5%
if -2.00000000000000012e-288 < (+.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))))) < 2.0000000000000001e-290Initial 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.9%
Applied rewrites60.9%
if 1.99999999999999997e67 < (+.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 rewrites85.0%
Taylor expanded in EDonor around inf
lower-/.f6464.0%
Applied rewrites64.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1 (+ (fmax Ev EAccept) t_0))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_2 -2e+162)
(+
(/ NdChar (+ 1.0 (exp (/ Vef KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) Vef) mu) KbT)))))
(if (<= t_2 -2e-182)
(+
(/ NaChar (+ 1.0 (exp (/ (fmin Ev EAccept) KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= t_2 2e-290)
(/ NaChar (+ 1.0 (exp (/ (- t_1 mu) KbT))))
(if (<= t_2 2e+67)
(+
(/ NdChar (- (exp (/ mu KbT)) -1.0))
(/ NaChar (- (exp (/ (- mu) KbT)) -1.0)))
(+
(/ NaChar (+ 1.0 (exp (/ t_1 KbT))))
(/ NdChar (+ 1.0 (exp (/ EDonor KbT)))))))))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = fmax(Ev, EAccept) + t_0;
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -2e+162) {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp((((fmax(Ev, EAccept) + Vef) - mu) / KbT))));
} else if (t_2 <= -2e-182) {
tmp = (NaChar / (1.0 + exp((fmin(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + exp(((t_1 - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0));
} else {
tmp = (NaChar / (1.0 + exp((t_1 / KbT)))) + (NdChar / (1.0 + exp((EDonor / 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) :: t_2
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = fmax(ev, eaccept) + t_0
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_2 <= (-2d+162)) then
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (nachar / (1.0d0 + exp((((fmax(ev, eaccept) + vef) - mu) / kbt))))
else if (t_2 <= (-2d-182)) then
tmp = (nachar / (1.0d0 + exp((fmin(ev, eaccept) / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (t_2 <= 2d-290) then
tmp = nachar / (1.0d0 + exp(((t_1 - mu) / kbt)))
else if (t_2 <= 2d+67) then
tmp = (ndchar / (exp((mu / kbt)) - (-1.0d0))) + (nachar / (exp((-mu / kbt)) - (-1.0d0)))
else
tmp = (nachar / (1.0d0 + exp((t_1 / kbt)))) + (ndchar / (1.0d0 + exp((edonor / 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 = fmin(Ev, EAccept) + Vef;
double t_1 = fmax(Ev, EAccept) + t_0;
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -2e+162) {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + Vef) - mu) / KbT))));
} else if (t_2 <= -2e-182) {
tmp = (NaChar / (1.0 + Math.exp((fmin(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + Math.exp(((t_1 - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = (NdChar / (Math.exp((mu / KbT)) - -1.0)) + (NaChar / (Math.exp((-mu / KbT)) - -1.0));
} else {
tmp = (NaChar / (1.0 + Math.exp((t_1 / KbT)))) + (NdChar / (1.0 + Math.exp((EDonor / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = fmax(Ev, EAccept) + t_0 t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_2 <= -2e+162: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + Vef) - mu) / KbT)))) elif t_2 <= -2e-182: tmp = (NaChar / (1.0 + math.exp((fmin(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif t_2 <= 2e-290: tmp = NaChar / (1.0 + math.exp(((t_1 - mu) / KbT))) elif t_2 <= 2e+67: tmp = (NdChar / (math.exp((mu / KbT)) - -1.0)) + (NaChar / (math.exp((-mu / KbT)) - -1.0)) else: tmp = (NaChar / (1.0 + math.exp((t_1 / KbT)))) + (NdChar / (1.0 + math.exp((EDonor / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(fmax(Ev, EAccept) + t_0) t_2 = 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(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -2e+162) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + Vef) - mu) / KbT))))); elseif (t_2 <= -2e-182) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(fmin(Ev, EAccept) / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (t_2 <= 2e-290) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_1 - mu) / KbT)))); elseif (t_2 <= 2e+67) tmp = Float64(Float64(NdChar / Float64(exp(Float64(mu / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(Float64(-mu) / KbT)) - -1.0))); else tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(t_1 / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = max(Ev, EAccept) + t_0; t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -2e+162) tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp((((max(Ev, EAccept) + Vef) - mu) / KbT)))); elseif (t_2 <= -2e-182) tmp = (NaChar / (1.0 + exp((min(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (t_2 <= 2e-290) tmp = NaChar / (1.0 + exp(((t_1 - mu) / KbT))); elseif (t_2 <= 2e+67) tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0)); else tmp = (NaChar / (1.0 + exp((t_1 / KbT)))) + (NdChar / (1.0 + exp((EDonor / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = 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[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+162], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-182], N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[Min[Ev, EAccept], $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], If[LessEqual[t$95$2, 2e-290], N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$1 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+67], N[(N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NaChar / N[(1.0 + N[Exp[N[(t$95$1 / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \mathsf{max}\left(Ev, EAccept\right) + t\_0\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+162}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + Vef\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-182}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-290}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{t\_1 - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} - -1} + \frac{NaChar}{e^{\frac{-mu}{KbT}} - -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{t\_1}{KbT}}} + \frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\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.9999999999999999e162Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in Ev around 0
lower--.f64N/A
lower-+.f6464.8%
Applied rewrites64.8%
if -1.9999999999999999e162 < (+.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))))) < -2.0000000000000001e-182Initial 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 rewrites85.0%
Taylor expanded in Ev around inf
lower-/.f6463.6%
Applied rewrites63.6%
if -2.0000000000000001e-182 < (+.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))))) < 2.0000000000000001e-290Initial 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.9%
Applied rewrites60.9%
if 2.0000000000000001e-290 < (+.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.99999999999999997e67Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
Applied rewrites47.4%
Taylor expanded in mu around inf
lower-/.f6451.7%
Applied rewrites51.7%
if 1.99999999999999997e67 < (+.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 rewrites85.0%
Taylor expanded in EDonor around inf
lower-/.f6464.0%
Applied rewrites64.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(/ NaChar (+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -2e+162)
(+
(/ NdChar (+ 1.0 (exp (/ Vef KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) Vef) mu) KbT)))))
(if (<= t_2 -2e-182)
(+
(/ NaChar (+ 1.0 (exp (/ (fmin Ev EAccept) KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= t_2 2e-290)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(if (<= t_2 2e+67)
(+
(/ NdChar (- (exp (/ mu KbT)) -1.0))
(/ NaChar (- (exp (/ (- mu) KbT)) -1.0)))
(+ (* 0.5 NdChar) 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 = fmin(Ev, EAccept) + Vef;
double t_1 = NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e+162) {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp((((fmax(Ev, EAccept) + Vef) - mu) / KbT))));
} else if (t_2 <= -2e-182) {
tmp = (NaChar / (1.0 + exp((fmin(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0));
} else {
tmp = (0.5 * NdChar) + 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 = fmin(ev, eaccept) + vef
t_1 = nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt)))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-2d+162)) then
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (nachar / (1.0d0 + exp((((fmax(ev, eaccept) + vef) - mu) / kbt))))
else if (t_2 <= (-2d-182)) then
tmp = (nachar / (1.0d0 + exp((fmin(ev, eaccept) / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (t_2 <= 2d-290) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else if (t_2 <= 2d+67) then
tmp = (ndchar / (exp((mu / kbt)) - (-1.0d0))) + (nachar / (exp((-mu / kbt)) - (-1.0d0)))
else
tmp = (0.5d0 * ndchar) + 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 = fmin(Ev, EAccept) + Vef;
double t_1 = NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e+162) {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + Vef) - mu) / KbT))));
} else if (t_2 <= -2e-182) {
tmp = (NaChar / (1.0 + Math.exp((fmin(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = (NdChar / (Math.exp((mu / KbT)) - -1.0)) + (NaChar / (Math.exp((-mu / KbT)) - -1.0));
} else {
tmp = (0.5 * NdChar) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -2e+162: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + Vef) - mu) / KbT)))) elif t_2 <= -2e-182: tmp = (NaChar / (1.0 + math.exp((fmin(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif t_2 <= 2e-290: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) elif t_2 <= 2e+67: tmp = (NdChar / (math.exp((mu / KbT)) - -1.0)) + (NaChar / (math.exp((-mu / KbT)) - -1.0)) else: tmp = (0.5 * NdChar) + t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if (t_2 <= -2e+162) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + Vef) - mu) / KbT))))); elseif (t_2 <= -2e-182) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(fmin(Ev, EAccept) / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (t_2 <= 2e-290) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); elseif (t_2 <= 2e+67) tmp = Float64(Float64(NdChar / Float64(exp(Float64(mu / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(Float64(-mu) / KbT)) - -1.0))); else tmp = Float64(Float64(0.5 * NdChar) + t_1); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -2e+162) tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp((((max(Ev, EAccept) + Vef) - mu) / KbT)))); elseif (t_2 <= -2e-182) tmp = (NaChar / (1.0 + exp((min(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (t_2 <= 2e-290) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); elseif (t_2 <= 2e+67) tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0)); else tmp = (0.5 * NdChar) + t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+162], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-182], N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[Min[Ev, EAccept], $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], If[LessEqual[t$95$2, 2e-290], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+67], N[(N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+162}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + Vef\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-182}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-290}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} - -1} + \frac{NaChar}{e^{\frac{-mu}{KbT}} - -1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\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.9999999999999999e162Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in Ev around 0
lower--.f64N/A
lower-+.f6464.8%
Applied rewrites64.8%
if -1.9999999999999999e162 < (+.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))))) < -2.0000000000000001e-182Initial 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 rewrites85.0%
Taylor expanded in Ev around inf
lower-/.f6463.6%
Applied rewrites63.6%
if -2.0000000000000001e-182 < (+.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))))) < 2.0000000000000001e-290Initial 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.9%
Applied rewrites60.9%
if 2.0000000000000001e-290 < (+.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.99999999999999997e67Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
Applied rewrites47.4%
Taylor expanded in mu around inf
lower-/.f6451.7%
Applied rewrites51.7%
if 1.99999999999999997e67 < (+.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.5%
Applied rewrites47.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(/ NaChar (+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -2e-182)
(+
(/ NaChar (+ 1.0 (exp (/ (fmax Ev EAccept) KbT))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= t_2 2e-290)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(if (<= t_2 2e+67)
(+
(/ NdChar (- (exp (/ mu KbT)) -1.0))
(/ NaChar (- (exp (/ (- mu) KbT)) -1.0)))
(+ (* 0.5 NdChar) 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 = fmin(Ev, EAccept) + Vef;
double t_1 = NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-182) {
tmp = (NaChar / (1.0 + exp((fmax(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0));
} else {
tmp = (0.5 * NdChar) + 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 = fmin(ev, eaccept) + vef
t_1 = nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt)))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-2d-182)) then
tmp = (nachar / (1.0d0 + exp((fmax(ev, eaccept) / kbt)))) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (t_2 <= 2d-290) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else if (t_2 <= 2d+67) then
tmp = (ndchar / (exp((mu / kbt)) - (-1.0d0))) + (nachar / (exp((-mu / kbt)) - (-1.0d0)))
else
tmp = (0.5d0 * ndchar) + 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 = fmin(Ev, EAccept) + Vef;
double t_1 = NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-182) {
tmp = (NaChar / (1.0 + Math.exp((fmax(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (t_2 <= 2e-290) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_2 <= 2e+67) {
tmp = (NdChar / (Math.exp((mu / KbT)) - -1.0)) + (NaChar / (Math.exp((-mu / KbT)) - -1.0));
} else {
tmp = (0.5 * NdChar) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -2e-182: tmp = (NaChar / (1.0 + math.exp((fmax(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif t_2 <= 2e-290: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) elif t_2 <= 2e+67: tmp = (NdChar / (math.exp((mu / KbT)) - -1.0)) + (NaChar / (math.exp((-mu / KbT)) - -1.0)) else: tmp = (0.5 * NdChar) + t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if (t_2 <= -2e-182) tmp = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(fmax(Ev, EAccept) / KbT)))) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (t_2 <= 2e-290) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); elseif (t_2 <= 2e+67) tmp = Float64(Float64(NdChar / Float64(exp(Float64(mu / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(Float64(-mu) / KbT)) - -1.0))); else tmp = Float64(Float64(0.5 * NdChar) + t_1); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -2e-182) tmp = (NaChar / (1.0 + exp((max(Ev, EAccept) / KbT)))) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (t_2 <= 2e-290) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); elseif (t_2 <= 2e+67) tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0)); else tmp = (0.5 * NdChar) + t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-182], N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[Max[Ev, EAccept], $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], If[LessEqual[t$95$2, 2e-290], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+67], N[(N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-182}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-290}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} - -1} + \frac{NaChar}{e^{\frac{-mu}{KbT}} - -1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\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))))) < -2.0000000000000001e-182Initial 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 rewrites85.0%
Taylor expanded in EAccept around inf
lower-/.f6463.9%
Applied rewrites63.9%
if -2.0000000000000001e-182 < (+.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))))) < 2.0000000000000001e-290Initial 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.9%
Applied rewrites60.9%
if 2.0000000000000001e-290 < (+.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.99999999999999997e67Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
Applied rewrites47.4%
Taylor expanded in mu around inf
lower-/.f6451.7%
Applied rewrites51.7%
if 1.99999999999999997e67 < (+.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.5%
Applied rewrites47.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
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
(t_2 (+ (* 0.5 NdChar) t_1))
(t_3 (+ t_0 t_1)))
(if (<= t_3 -1e+184)
t_2
(if (<= t_3 -1e-15)
(+ t_0 (* 0.5 NaChar))
(if (<= t_3 2e-290)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(if (<= t_3 2e+67)
(+
(/ NdChar (- (exp (/ mu KbT)) -1.0))
(/ NaChar (- (exp (/ (- mu) KbT)) -1.0)))
t_2))))))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 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_2 = (0.5 * NdChar) + t_1;
double t_3 = t_0 + t_1;
double tmp;
if (t_3 <= -1e+184) {
tmp = t_2;
} else if (t_3 <= -1e-15) {
tmp = t_0 + (0.5 * NaChar);
} else if (t_3 <= 2e-290) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else if (t_3 <= 2e+67) {
tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0));
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt)))
t_2 = (0.5d0 * ndchar) + t_1
t_3 = t_0 + t_1
if (t_3 <= (-1d+184)) then
tmp = t_2
else if (t_3 <= (-1d-15)) then
tmp = t_0 + (0.5d0 * nachar)
else if (t_3 <= 2d-290) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else if (t_3 <= 2d+67) then
tmp = (ndchar / (exp((mu / kbt)) - (-1.0d0))) + (nachar / (exp((-mu / kbt)) - (-1.0d0)))
else
tmp = t_2
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 = NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_2 = (0.5 * NdChar) + t_1;
double t_3 = t_0 + t_1;
double tmp;
if (t_3 <= -1e+184) {
tmp = t_2;
} else if (t_3 <= -1e-15) {
tmp = t_0 + (0.5 * NaChar);
} else if (t_3 <= 2e-290) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else if (t_3 <= 2e+67) {
tmp = (NdChar / (Math.exp((mu / KbT)) - -1.0)) + (NaChar / (Math.exp((-mu / KbT)) - -1.0));
} else {
tmp = t_2;
}
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 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))) t_2 = (0.5 * NdChar) + t_1 t_3 = t_0 + t_1 tmp = 0 if t_3 <= -1e+184: tmp = t_2 elif t_3 <= -1e-15: tmp = t_0 + (0.5 * NaChar) elif t_3 <= 2e-290: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) elif t_3 <= 2e+67: tmp = (NdChar / (math.exp((mu / KbT)) - -1.0)) + (NaChar / (math.exp((-mu / KbT)) - -1.0)) else: tmp = t_2 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(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(0.5 * NdChar) + t_1) t_3 = Float64(t_0 + t_1) tmp = 0.0 if (t_3 <= -1e+184) tmp = t_2; elseif (t_3 <= -1e-15) tmp = Float64(t_0 + Float64(0.5 * NaChar)); elseif (t_3 <= 2e-290) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); elseif (t_3 <= 2e+67) tmp = Float64(Float64(NdChar / Float64(exp(Float64(mu / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(Float64(-mu) / KbT)) - -1.0))); else tmp = t_2; 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 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))); t_2 = (0.5 * NdChar) + t_1; t_3 = t_0 + t_1; tmp = 0.0; if (t_3 <= -1e+184) tmp = t_2; elseif (t_3 <= -1e-15) tmp = t_0 + (0.5 * NaChar); elseif (t_3 <= 2e-290) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); elseif (t_3 <= 2e+67) tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (NaChar / (exp((-mu / KbT)) - -1.0)); else tmp = t_2; 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[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+184], t$95$2, If[LessEqual[t$95$3, -1e-15], N[(t$95$0 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-290], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+67], N[(N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
t_2 := 0.5 \cdot NdChar + t\_1\\
t_3 := t\_0 + t\_1\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+184}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-15}:\\
\;\;\;\;t\_0 + 0.5 \cdot NaChar\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-290}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} - -1} + \frac{NaChar}{e^{\frac{-mu}{KbT}} - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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.00000000000000002e184 or 1.99999999999999997e67 < (+.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.5%
Applied rewrites47.5%
if -1.00000000000000002e184 < (+.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.0000000000000001e-15Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.2%
Applied rewrites46.2%
if -1.0000000000000001e-15 < (+.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))))) < 2.0000000000000001e-290Initial 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.9%
Applied rewrites60.9%
if 2.0000000000000001e-290 < (+.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.99999999999999997e67Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
Taylor expanded in mu around inf
lower-*.f64N/A
lower-/.f6447.4%
Applied rewrites47.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.4%
Applied rewrites47.4%
Taylor expanded in mu around inf
lower-/.f6451.7%
Applied rewrites51.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
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
(t_2 (+ (* 0.5 NdChar) t_1))
(t_3 (+ t_0 t_1)))
(if (<= t_3 -1e+184)
t_2
(if (<= t_3 -1e-15)
(+ t_0 (* 0.5 NaChar))
(if (<= t_3 2e-153)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_2)))))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 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_2 = (0.5 * NdChar) + t_1;
double t_3 = t_0 + t_1;
double tmp;
if (t_3 <= -1e+184) {
tmp = t_2;
} else if (t_3 <= -1e-15) {
tmp = t_0 + (0.5 * NaChar);
} else if (t_3 <= 2e-153) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt)))
t_2 = (0.5d0 * ndchar) + t_1
t_3 = t_0 + t_1
if (t_3 <= (-1d+184)) then
tmp = t_2
else if (t_3 <= (-1d-15)) then
tmp = t_0 + (0.5d0 * nachar)
else if (t_3 <= 2d-153) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_2
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 = NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_2 = (0.5 * NdChar) + t_1;
double t_3 = t_0 + t_1;
double tmp;
if (t_3 <= -1e+184) {
tmp = t_2;
} else if (t_3 <= -1e-15) {
tmp = t_0 + (0.5 * NaChar);
} else if (t_3 <= 2e-153) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_2;
}
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 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))) t_2 = (0.5 * NdChar) + t_1 t_3 = t_0 + t_1 tmp = 0 if t_3 <= -1e+184: tmp = t_2 elif t_3 <= -1e-15: tmp = t_0 + (0.5 * NaChar) elif t_3 <= 2e-153: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_2 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(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(0.5 * NdChar) + t_1) t_3 = Float64(t_0 + t_1) tmp = 0.0 if (t_3 <= -1e+184) tmp = t_2; elseif (t_3 <= -1e-15) tmp = Float64(t_0 + Float64(0.5 * NaChar)); elseif (t_3 <= 2e-153) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_2; 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 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))); t_2 = (0.5 * NdChar) + t_1; t_3 = t_0 + t_1; tmp = 0.0; if (t_3 <= -1e+184) tmp = t_2; elseif (t_3 <= -1e-15) tmp = t_0 + (0.5 * NaChar); elseif (t_3 <= 2e-153) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_2; 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[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+184], t$95$2, If[LessEqual[t$95$3, -1e-15], N[(t$95$0 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-153], 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$2]]]]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
t_2 := 0.5 \cdot NdChar + t\_1\\
t_3 := t\_0 + t\_1\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+184}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-15}:\\
\;\;\;\;t\_0 + 0.5 \cdot NaChar\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-153}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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.00000000000000002e184 or 2.00000000000000008e-153 < (+.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.5%
Applied rewrites47.5%
if -1.00000000000000002e184 < (+.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.0000000000000001e-15Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.2%
Applied rewrites46.2%
if -1.0000000000000001e-15 < (+.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))))) < 2.00000000000000008e-153Initial 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.9%
Applied rewrites60.9%
(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 (* 0.5 NaChar)))
(t_2
(+
t_0
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_2 -1e-15)
t_1
(if (<= t_2 5e-116)
(/ 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 + (0.5 * NaChar);
double t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-15) {
tmp = t_1;
} else if (t_2 <= 5e-116) {
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 + (0.5d0 * nachar)
t_2 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_2 <= (-1d-15)) then
tmp = t_1
else if (t_2 <= 5d-116) 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 + (0.5 * NaChar);
double t_2 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-15) {
tmp = t_1;
} else if (t_2 <= 5e-116) {
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 + (0.5 * NaChar) t_2 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_2 <= -1e-15: tmp = t_1 elif t_2 <= 5e-116: 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(0.5 * NaChar)) 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 <= -1e-15) tmp = t_1; elseif (t_2 <= 5e-116) 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 + (0.5 * NaChar); t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -1e-15) tmp = t_1; elseif (t_2 <= 5e-116) 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[(0.5 * NaChar), $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, -1e-15], t$95$1, If[LessEqual[t$95$2, 5e-116], 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}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := t\_0 + 0.5 \cdot NaChar\\
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 -1 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-116}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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.0000000000000001e-15 or 5.0000000000000003e-116 < (+.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-*.f6446.2%
Applied rewrites46.2%
if -1.0000000000000001e-15 < (+.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.0000000000000003e-116Initial 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.9%
Applied rewrites60.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= KbT -7.5e+159)
(+ (/ NaChar 2.0) (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(if (<= KbT 2e+214)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(+ (/ NdChar (+ 1.0 (exp (/ Vef KbT)))) (/ 1.0 (/ 2.0 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 <= -7.5e+159) {
tmp = (NaChar / 2.0) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT))));
} else if (KbT <= 2e+214) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (1.0 / (2.0 / 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 <= (-7.5d+159)) then
tmp = (nachar / 2.0d0) + (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt))))
else if (kbt <= 2d+214) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (1.0d0 / (2.0d0 / 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 <= -7.5e+159) {
tmp = (NaChar / 2.0) + (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT))));
} else if (KbT <= 2e+214) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -7.5e+159: tmp = (NaChar / 2.0) + (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) elif KbT <= 2e+214: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -7.5e+159) tmp = Float64(Float64(NaChar / 2.0) + Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT))))); elseif (KbT <= 2e+214) 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(Vef / KbT)))) + Float64(1.0 / Float64(2.0 / NaChar))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -7.5e+159) tmp = (NaChar / 2.0) + (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))); elseif (KbT <= 2e+214) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -7.5e+159], 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, 2e+214], 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[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(2.0 / NaChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;KbT \leq -7.5 \cdot 10^{+159}:\\
\;\;\;\;\frac{NaChar}{2} + \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
\mathbf{elif}\;KbT \leq 2 \cdot 10^{+214}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{1}{\frac{2}{NaChar}}\\
\end{array}
if KbT < -7.4999999999999997e159Initial 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 rewrites85.0%
Taylor expanded in KbT around inf
Applied rewrites42.9%
if -7.4999999999999997e159 < KbT < 1.9999999999999999e214Initial 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.9%
Applied rewrites60.9%
if 1.9999999999999999e214 < KbT Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6470.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6470.2%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-neg.f64N/A
sub-flipN/A
lift--.f6470.2%
Applied rewrites70.2%
Taylor expanded in KbT around inf
lower-/.f6434.0%
Applied rewrites34.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (/ NdChar (+ 1.0 (exp (/ Vef KbT)))) (/ 1.0 (/ 2.0 NaChar)))))
(if (<= KbT -1.9e+159)
t_0
(if (<= KbT 2e+214)
(/ 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 / (1.0 + exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar));
double tmp;
if (KbT <= -1.9e+159) {
tmp = t_0;
} else if (KbT <= 2e+214) {
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 / (1.0d0 + exp((vef / kbt)))) + (1.0d0 / (2.0d0 / nachar))
if (kbt <= (-1.9d+159)) then
tmp = t_0
else if (kbt <= 2d+214) 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 / (1.0 + Math.exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar));
double tmp;
if (KbT <= -1.9e+159) {
tmp = t_0;
} else if (KbT <= 2e+214) {
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 / (1.0 + math.exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar)) tmp = 0 if KbT <= -1.9e+159: tmp = t_0 elif KbT <= 2e+214: 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(1.0 + exp(Float64(Vef / KbT)))) + Float64(1.0 / Float64(2.0 / NaChar))) tmp = 0.0 if (KbT <= -1.9e+159) tmp = t_0; elseif (KbT <= 2e+214) 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 / (1.0 + exp((Vef / KbT)))) + (1.0 / (2.0 / NaChar)); tmp = 0.0; if (KbT <= -1.9e+159) tmp = t_0; elseif (KbT <= 2e+214) 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[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(2.0 / NaChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -1.9e+159], t$95$0, If[LessEqual[KbT, 2e+214], 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}
t_0 := \frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{1}{\frac{2}{NaChar}}\\
\mathbf{if}\;KbT \leq -1.9 \cdot 10^{+159}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;KbT \leq 2 \cdot 10^{+214}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if KbT < -1.89999999999999983e159 or 1.9999999999999999e214 < KbT Initial program 100.0%
Taylor expanded in Vef around inf
lower-/.f6470.3%
Applied rewrites70.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6470.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6470.2%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-neg.f64N/A
sub-flipN/A
lift--.f6470.2%
Applied rewrites70.2%
Taylor expanded in KbT around inf
lower-/.f6434.0%
Applied rewrites34.0%
if -1.89999999999999983e159 < KbT < 1.9999999999999999e214Initial 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.9%
Applied rewrites60.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (* (+ NaChar NdChar) 0.5)))
(if (<= KbT -7.1e+193)
t_0
(if (<= KbT 1.65e+203)
(/ 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 + NdChar) * 0.5;
double tmp;
if (KbT <= -7.1e+193) {
tmp = t_0;
} else if (KbT <= 1.65e+203) {
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 = (nachar + ndchar) * 0.5d0
if (kbt <= (-7.1d+193)) then
tmp = t_0
else if (kbt <= 1.65d+203) 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 + NdChar) * 0.5;
double tmp;
if (KbT <= -7.1e+193) {
tmp = t_0;
} else if (KbT <= 1.65e+203) {
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 + NdChar) * 0.5 tmp = 0 if KbT <= -7.1e+193: tmp = t_0 elif KbT <= 1.65e+203: 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 + NdChar) * 0.5) tmp = 0.0 if (KbT <= -7.1e+193) tmp = t_0; elseif (KbT <= 1.65e+203) 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 + NdChar) * 0.5; tmp = 0.0; if (KbT <= -7.1e+193) tmp = t_0; elseif (KbT <= 1.65e+203) 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 + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[KbT, -7.1e+193], t$95$0, If[LessEqual[KbT, 1.65e+203], 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}
t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
\mathbf{if}\;KbT \leq -7.1 \cdot 10^{+193}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;KbT \leq 1.65 \cdot 10^{+203}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if KbT < -7.0999999999999997e193 or 1.64999999999999995e203 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.2%
Applied rewrites27.2%
if -7.0999999999999997e193 < KbT < 1.64999999999999995e203Initial 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.9%
Applied rewrites60.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (* (+ NaChar NdChar) 0.5)))
(if (<= KbT -7.1e+193)
t_0
(if (<= KbT 1.65e+203)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept 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 + NdChar) * 0.5;
double tmp;
if (KbT <= -7.1e+193) {
tmp = t_0;
} else if (KbT <= 1.65e+203) {
tmp = NaChar / (1.0 + exp((((EAccept + 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 = (nachar + ndchar) * 0.5d0
if (kbt <= (-7.1d+193)) then
tmp = t_0
else if (kbt <= 1.65d+203) then
tmp = nachar / (1.0d0 + exp((((eaccept + 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 + NdChar) * 0.5;
double tmp;
if (KbT <= -7.1e+193) {
tmp = t_0;
} else if (KbT <= 1.65e+203) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + Vef) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar + NdChar) * 0.5 tmp = 0 if KbT <= -7.1e+193: tmp = t_0 elif KbT <= 1.65e+203: tmp = NaChar / (1.0 + math.exp((((EAccept + 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 + NdChar) * 0.5) tmp = 0.0 if (KbT <= -7.1e+193) tmp = t_0; elseif (KbT <= 1.65e+203) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + 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 + NdChar) * 0.5; tmp = 0.0; if (KbT <= -7.1e+193) tmp = t_0; elseif (KbT <= 1.65e+203) tmp = NaChar / (1.0 + exp((((EAccept + 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 + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[KbT, -7.1e+193], t$95$0, If[LessEqual[KbT, 1.65e+203], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
\mathbf{if}\;KbT \leq -7.1 \cdot 10^{+193}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;KbT \leq 1.65 \cdot 10^{+203}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + Vef\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if KbT < -7.0999999999999997e193 or 1.64999999999999995e203 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.2%
Applied rewrites27.2%
if -7.0999999999999997e193 < KbT < 1.64999999999999995e203Initial 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.9%
Applied rewrites60.9%
Taylor expanded in Ev around 0
lower-+.f6454.1%
Applied rewrites54.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (* (+ NaChar NdChar) 0.5)))
(if (<= KbT -1.22e+157)
t_0
(if (<= KbT 1.95e+89) (/ NaChar (+ 1.0 (exp (/ (* -1.0 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 + NdChar) * 0.5;
double tmp;
if (KbT <= -1.22e+157) {
tmp = t_0;
} else if (KbT <= 1.95e+89) {
tmp = NaChar / (1.0 + exp(((-1.0 * 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 + ndchar) * 0.5d0
if (kbt <= (-1.22d+157)) then
tmp = t_0
else if (kbt <= 1.95d+89) then
tmp = nachar / (1.0d0 + exp((((-1.0d0) * 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 + NdChar) * 0.5;
double tmp;
if (KbT <= -1.22e+157) {
tmp = t_0;
} else if (KbT <= 1.95e+89) {
tmp = NaChar / (1.0 + Math.exp(((-1.0 * mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar + NdChar) * 0.5 tmp = 0 if KbT <= -1.22e+157: tmp = t_0 elif KbT <= 1.95e+89: tmp = NaChar / (1.0 + math.exp(((-1.0 * mu) / KbT))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NaChar + NdChar) * 0.5) tmp = 0.0 if (KbT <= -1.22e+157) tmp = t_0; elseif (KbT <= 1.95e+89) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(-1.0 * 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 + NdChar) * 0.5; tmp = 0.0; if (KbT <= -1.22e+157) tmp = t_0; elseif (KbT <= 1.95e+89) tmp = NaChar / (1.0 + exp(((-1.0 * 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 + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[KbT, -1.22e+157], t$95$0, If[LessEqual[KbT, 1.95e+89], N[(NaChar / N[(1.0 + N[Exp[N[(N[(-1.0 * mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
\mathbf{if}\;KbT \leq -1.22 \cdot 10^{+157}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;KbT \leq 1.95 \cdot 10^{+89}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{-1 \cdot mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if KbT < -1.22e157 or 1.95000000000000005e89 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.2%
Applied rewrites27.2%
if -1.22e157 < KbT < 1.95000000000000005e89Initial 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.9%
Applied rewrites60.9%
Taylor expanded in mu around inf
lower-*.f6434.8%
Applied rewrites34.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (* (+ NaChar NdChar) 0.5))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+
1.0
(exp
(/
(+ (+ (+ (fmin Ev EAccept) Vef) (fmax Ev EAccept)) (- mu))
KbT)))))))
(if (<= t_1 -2e-299)
t_0
(if (<= t_1 1e-288) (* -0.25 (/ (* (fmin Ev EAccept) NaChar) 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 + NdChar) * 0.5;
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((fmin(Ev, EAccept) + Vef) + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_1 <= -2e-299) {
tmp = t_0;
} else if (t_1 <= 1e-288) {
tmp = -0.25 * ((fmin(Ev, EAccept) * NaChar) / 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 + ndchar) * 0.5d0
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((fmin(ev, eaccept) + vef) + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_1 <= (-2d-299)) then
tmp = t_0
else if (t_1 <= 1d-288) then
tmp = (-0.25d0) * ((fmin(ev, eaccept) * nachar) / 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 + NdChar) * 0.5;
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((fmin(Ev, EAccept) + Vef) + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_1 <= -2e-299) {
tmp = t_0;
} else if (t_1 <= 1e-288) {
tmp = -0.25 * ((fmin(Ev, EAccept) * NaChar) / KbT);
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar + NdChar) * 0.5 t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((fmin(Ev, EAccept) + Vef) + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_1 <= -2e-299: tmp = t_0 elif t_1 <= 1e-288: tmp = -0.25 * ((fmin(Ev, EAccept) * NaChar) / KbT) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NaChar + NdChar) * 0.5) 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(fmin(Ev, EAccept) + Vef) + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -2e-299) tmp = t_0; elseif (t_1 <= 1e-288) tmp = Float64(-0.25 * Float64(Float64(fmin(Ev, EAccept) * NaChar) / 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 + NdChar) * 0.5; t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((min(Ev, EAccept) + Vef) + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -2e-299) tmp = t_0; elseif (t_1 <= 1e-288) tmp = -0.25 * ((min(Ev, EAccept) * NaChar) / 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 + NdChar), $MachinePrecision] * 0.5), $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[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision] + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-299], t$95$0, If[LessEqual[t$95$1, 1e-288], N[(-0.25 * N[(N[(N[Min[Ev, EAccept], $MachinePrecision] * NaChar), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
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(\mathsf{min}\left(Ev, EAccept\right) + Vef\right) + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-288}:\\
\;\;\;\;-0.25 \cdot \frac{\mathsf{min}\left(Ev, EAccept\right) \cdot NaChar}{KbT}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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.99999999999999998e-299 or 1.00000000000000006e-288 < (+.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-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.2%
Applied rewrites27.2%
if -1.99999999999999998e-299 < (+.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.00000000000000006e-288Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
Applied rewrites14.4%
Taylor expanded in Ev around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f645.7%
Applied rewrites5.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (* (+ NaChar NdChar) 0.5))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_1 -2e-299)
t_0
(if (<= t_1 1e-288) (* -0.25 (/ (* EAccept NaChar) 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 + NdChar) * 0.5;
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 <= -2e-299) {
tmp = t_0;
} else if (t_1 <= 1e-288) {
tmp = -0.25 * ((EAccept * NaChar) / 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 + ndchar) * 0.5d0
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_1 <= (-2d-299)) then
tmp = t_0
else if (t_1 <= 1d-288) then
tmp = (-0.25d0) * ((eaccept * nachar) / 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 + NdChar) * 0.5;
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 <= -2e-299) {
tmp = t_0;
} else if (t_1 <= 1e-288) {
tmp = -0.25 * ((EAccept * NaChar) / KbT);
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar + NdChar) * 0.5 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 <= -2e-299: tmp = t_0 elif t_1 <= 1e-288: tmp = -0.25 * ((EAccept * NaChar) / KbT) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NaChar + NdChar) * 0.5) 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 <= -2e-299) tmp = t_0; elseif (t_1 <= 1e-288) tmp = Float64(-0.25 * Float64(Float64(EAccept * NaChar) / 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 + NdChar) * 0.5; 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 <= -2e-299) tmp = t_0; elseif (t_1 <= 1e-288) tmp = -0.25 * ((EAccept * NaChar) / 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 + NdChar), $MachinePrecision] * 0.5), $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, -2e-299], t$95$0, If[LessEqual[t$95$1, 1e-288], N[(-0.25 * N[(N[(EAccept * NaChar), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
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 -2 \cdot 10^{-299}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-288}:\\
\;\;\;\;-0.25 \cdot \frac{EAccept \cdot NaChar}{KbT}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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.99999999999999998e-299 or 1.00000000000000006e-288 < (+.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-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.2%
Applied rewrites27.2%
if -1.99999999999999998e-299 < (+.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.00000000000000006e-288Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
Applied rewrites14.4%
Taylor expanded in EAccept around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f646.0%
Applied rewrites6.0%
(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]
\left(NaChar + NdChar\right) \cdot 0.5
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.2%
Applied rewrites27.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= NaChar -9.5e+39) (* 0.5 NaChar) (if (<= NaChar 6.2e+155) (* 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 (NaChar <= -9.5e+39) {
tmp = 0.5 * NaChar;
} else if (NaChar <= 6.2e+155) {
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 (nachar <= (-9.5d+39)) then
tmp = 0.5d0 * nachar
else if (nachar <= 6.2d+155) 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 (NaChar <= -9.5e+39) {
tmp = 0.5 * NaChar;
} else if (NaChar <= 6.2e+155) {
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 NaChar <= -9.5e+39: tmp = 0.5 * NaChar elif NaChar <= 6.2e+155: 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 (NaChar <= -9.5e+39) tmp = Float64(0.5 * NaChar); elseif (NaChar <= 6.2e+155) 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 (NaChar <= -9.5e+39) tmp = 0.5 * NaChar; elseif (NaChar <= 6.2e+155) 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[NaChar, -9.5e+39], N[(0.5 * NaChar), $MachinePrecision], If[LessEqual[NaChar, 6.2e+155], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;NaChar \leq -9.5 \cdot 10^{+39}:\\
\;\;\;\;0.5 \cdot NaChar\\
\mathbf{elif}\;NaChar \leq 6.2 \cdot 10^{+155}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NaChar\\
\end{array}
if NaChar < -9.50000000000000011e39 or 6.19999999999999978e155 < NaChar Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
Taylor expanded in NdChar around 0
lower-*.f6418.0%
Applied rewrites18.0%
if -9.50000000000000011e39 < NaChar < 6.19999999999999978e155Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
Taylor expanded in NdChar around 0
lower-*.f6418.0%
Applied rewrites18.0%
Taylor expanded in NdChar around inf
lower-*.f6418.1%
Applied rewrites18.1%
(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]
0.5 \cdot NaChar
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.2%
Applied rewrites27.2%
Taylor expanded in NdChar around 0
lower-*.f6418.0%
Applied rewrites18.0%
herbie shell --seed 2025187
(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))))))