
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}
\end{array}
Initial program 99.9%
Final simplification99.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 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_2 (/ NaChar (+ 1.0 t_1)))
(t_3 (+ (/ NdChar (+ 1.0 (exp (/ mu KbT)))) t_2))
(t_4 (+ t_0 t_2)))
(if (<= t_4 -1e-300)
t_3
(if (<= t_4 0.0)
(/ NaChar (+ t_1 1.0))
(if (<= t_4 1e-41)
t_3
(+ t_0 (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_2 = NaChar / (1.0 + t_1);
double t_3 = (NdChar / (1.0 + exp((mu / KbT)))) + t_2;
double t_4 = t_0 + t_2;
double tmp;
if (t_4 <= -1e-300) {
tmp = t_3;
} else if (t_4 <= 0.0) {
tmp = NaChar / (t_1 + 1.0);
} else if (t_4 <= 1e-41) {
tmp = t_3;
} else {
tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_2 = nachar / (1.0d0 + t_1)
t_3 = (ndchar / (1.0d0 + exp((mu / kbt)))) + t_2
t_4 = t_0 + t_2
if (t_4 <= (-1d-300)) then
tmp = t_3
else if (t_4 <= 0.0d0) then
tmp = nachar / (t_1 + 1.0d0)
else if (t_4 <= 1d-41) then
tmp = t_3
else
tmp = t_0 + (nachar / (1.0d0 + exp((eaccept / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_2 = NaChar / (1.0 + t_1);
double t_3 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_2;
double t_4 = t_0 + t_2;
double tmp;
if (t_4 <= -1e-300) {
tmp = t_3;
} else if (t_4 <= 0.0) {
tmp = NaChar / (t_1 + 1.0);
} else if (t_4 <= 1e-41) {
tmp = t_3;
} else {
tmp = t_0 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_2 = NaChar / (1.0 + t_1) t_3 = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_2 t_4 = t_0 + t_2 tmp = 0 if t_4 <= -1e-300: tmp = t_3 elif t_4 <= 0.0: tmp = NaChar / (t_1 + 1.0) elif t_4 <= 1e-41: tmp = t_3 else: tmp = t_0 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_2 = Float64(NaChar / Float64(1.0 + t_1)) t_3 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_2) t_4 = Float64(t_0 + t_2) tmp = 0.0 if (t_4 <= -1e-300) tmp = t_3; elseif (t_4 <= 0.0) tmp = Float64(NaChar / Float64(t_1 + 1.0)); elseif (t_4 <= 1e-41) tmp = t_3; else tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_2 = NaChar / (1.0 + t_1); t_3 = (NdChar / (1.0 + exp((mu / KbT)))) + t_2; t_4 = t_0 + t_2; tmp = 0.0; if (t_4 <= -1e-300) tmp = t_3; elseif (t_4 <= 0.0) tmp = NaChar / (t_1 + 1.0); elseif (t_4 <= 1e-41) tmp = t_3; else tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(NaChar / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$0 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$4, -1e-300], t$95$3, If[LessEqual[t$95$4, 0.0], N[(NaChar / N[(t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e-41], t$95$3, N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_2 := \frac{NaChar}{1 + t\_1}\\
t_3 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_2\\
t_4 := t\_0 + t\_2\\
\mathbf{if}\;t\_4 \leq -1 \cdot 10^{-300}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;\frac{NaChar}{t\_1 + 1}\\
\mathbf{elif}\;t\_4 \leq 10^{-41}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.00000000000000003e-300 or 0.0 < (+.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.00000000000000001e-41Initial program 99.9%
Taylor expanded in mu around inf
lower-/.f6479.0
Applied rewrites79.0%
if -1.00000000000000003e-300 < (+.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))))) < 0.0Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
if 1.00000000000000001e-41 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6484.6
Applied rewrites84.6%
Final simplification84.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT)))))
(t_1 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_2 (/ NaChar (+ 1.0 t_1)))
(t_3
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_2)))
(if (<= t_3 -4e-24)
(+ t_0 (/ NaChar (+ 1.0 (+ 1.0 (/ Vef KbT)))))
(if (<= t_3 2e-24)
(/ NaChar (+ t_1 1.0))
(if (<= t_3 5e+47)
(+ t_0 (/ NaChar (+ 1.0 (+ 1.0 (/ Ev KbT)))))
(+ (* 0.5 NdChar) 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((((EDonor + Vef) - Ec) / KbT)));
double t_1 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_2 = NaChar / (1.0 + t_1);
double t_3 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_2;
double tmp;
if (t_3 <= -4e-24) {
tmp = t_0 + (NaChar / (1.0 + (1.0 + (Vef / KbT))));
} else if (t_3 <= 2e-24) {
tmp = NaChar / (t_1 + 1.0);
} else if (t_3 <= 5e+47) {
tmp = t_0 + (NaChar / (1.0 + (1.0 + (Ev / KbT))));
} else {
tmp = (0.5 * NdChar) + 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((((edonor + vef) - ec) / kbt)))
t_1 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_2 = nachar / (1.0d0 + t_1)
t_3 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_2
if (t_3 <= (-4d-24)) then
tmp = t_0 + (nachar / (1.0d0 + (1.0d0 + (vef / kbt))))
else if (t_3 <= 2d-24) then
tmp = nachar / (t_1 + 1.0d0)
else if (t_3 <= 5d+47) then
tmp = t_0 + (nachar / (1.0d0 + (1.0d0 + (ev / kbt))))
else
tmp = (0.5d0 * ndchar) + 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((((EDonor + Vef) - Ec) / KbT)));
double t_1 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_2 = NaChar / (1.0 + t_1);
double t_3 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_2;
double tmp;
if (t_3 <= -4e-24) {
tmp = t_0 + (NaChar / (1.0 + (1.0 + (Vef / KbT))));
} else if (t_3 <= 2e-24) {
tmp = NaChar / (t_1 + 1.0);
} else if (t_3 <= 5e+47) {
tmp = t_0 + (NaChar / (1.0 + (1.0 + (Ev / KbT))));
} else {
tmp = (0.5 * NdChar) + t_2;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT))) t_1 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_2 = NaChar / (1.0 + t_1) t_3 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_2 tmp = 0 if t_3 <= -4e-24: tmp = t_0 + (NaChar / (1.0 + (1.0 + (Vef / KbT)))) elif t_3 <= 2e-24: tmp = NaChar / (t_1 + 1.0) elif t_3 <= 5e+47: tmp = t_0 + (NaChar / (1.0 + (1.0 + (Ev / KbT)))) else: tmp = (0.5 * NdChar) + 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(EDonor + Vef) - Ec) / KbT)))) t_1 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_2 = Float64(NaChar / Float64(1.0 + t_1)) t_3 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_2) tmp = 0.0 if (t_3 <= -4e-24) tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + Float64(1.0 + Float64(Vef / KbT))))); elseif (t_3 <= 2e-24) tmp = Float64(NaChar / Float64(t_1 + 1.0)); elseif (t_3 <= 5e+47) tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + Float64(1.0 + Float64(Ev / KbT))))); else tmp = Float64(Float64(0.5 * NdChar) + 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((((EDonor + Vef) - Ec) / KbT))); t_1 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_2 = NaChar / (1.0 + t_1); t_3 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_2; tmp = 0.0; if (t_3 <= -4e-24) tmp = t_0 + (NaChar / (1.0 + (1.0 + (Vef / KbT)))); elseif (t_3 <= 2e-24) tmp = NaChar / (t_1 + 1.0); elseif (t_3 <= 5e+47) tmp = t_0 + (NaChar / (1.0 + (1.0 + (Ev / KbT)))); else tmp = (0.5 * NdChar) + 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[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(NaChar / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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$2), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-24], N[(t$95$0 + N[(NaChar / N[(1.0 + N[(1.0 + N[(Vef / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-24], N[(NaChar / N[(t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+47], N[(t$95$0 + N[(NaChar / N[(1.0 + N[(1.0 + N[(Ev / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}}\\
t_1 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_2 := \frac{NaChar}{1 + t\_1}\\
t_3 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_2\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{-24}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + \left(1 + \frac{Vef}{KbT}\right)}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{NaChar}{t\_1 + 1}\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+47}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + \left(1 + \frac{Ev}{KbT}\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_2\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -3.99999999999999969e-24Initial program 99.8%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6467.1
Applied rewrites67.1%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6464.3
Applied rewrites64.3%
Taylor expanded in Vef around inf
Applied rewrites67.7%
if -3.99999999999999969e-24 < (+.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.99999999999999985e-24Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6468.2
Applied rewrites68.2%
if 1.99999999999999985e-24 < (+.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.00000000000000022e47Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6491.0
Applied rewrites91.0%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6491.0
Applied rewrites91.0%
Taylor expanded in Ev around inf
Applied rewrites84.0%
if 5.00000000000000022e47 < (+.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-*.f6475.5
Applied rewrites75.5%
Final simplification70.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -2e-101)
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ mu Vef) Ec) KbT))))
(/ NaChar (+ 1.0 1.0)))
(if (<= t_2 2e-24)
(/ NaChar (+ t_0 1.0))
(if (<= t_2 5e+47)
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 (/ Ev KbT)))))
(+ (* 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 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-101) {
tmp = (NdChar / (1.0 + exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0));
} else if (t_2 <= 2e-24) {
tmp = NaChar / (t_0 + 1.0);
} else if (t_2 <= 5e+47) {
tmp = (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + (Ev / KbT))));
} 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 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-2d-101)) then
tmp = (ndchar / (1.0d0 + exp((((mu + vef) - ec) / kbt)))) + (nachar / (1.0d0 + 1.0d0))
else if (t_2 <= 2d-24) then
tmp = nachar / (t_0 + 1.0d0)
else if (t_2 <= 5d+47) then
tmp = (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))) + (nachar / (1.0d0 + (1.0d0 + (ev / kbt))))
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 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-101) {
tmp = (NdChar / (1.0 + Math.exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0));
} else if (t_2 <= 2e-24) {
tmp = NaChar / (t_0 + 1.0);
} else if (t_2 <= 5e+47) {
tmp = (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + (Ev / KbT))));
} else {
tmp = (0.5 * NdChar) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -2e-101: tmp = (NdChar / (1.0 + math.exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0)) elif t_2 <= 2e-24: tmp = NaChar / (t_0 + 1.0) elif t_2 <= 5e+47: tmp = (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + (Ev / KbT)))) else: tmp = (0.5 * NdChar) + t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) 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-101) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(mu + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + 1.0))); elseif (t_2 <= 2e-24) tmp = Float64(NaChar / Float64(t_0 + 1.0)); elseif (t_2 <= 5e+47) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + Float64(Ev / KbT))))); 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 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -2e-101) tmp = (NdChar / (1.0 + exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0)); elseif (t_2 <= 2e-24) tmp = NaChar / (t_0 + 1.0); elseif (t_2 <= 5e+47) tmp = (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + (Ev / KbT)))); 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[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $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-101], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(mu + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-24], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+47], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[(1.0 + N[(Ev / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
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^{-101}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(mu + Vef\right) - Ec}{KbT}}} + \frac{NaChar}{1 + 1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+47}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}} + \frac{NaChar}{1 + \left(1 + \frac{Ev}{KbT}\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2.0000000000000001e-101Initial program 99.8%
Taylor expanded in mu around inf
lower-/.f6477.8
Applied rewrites77.8%
Taylor expanded in KbT around inf
Applied rewrites47.2%
Taylor expanded in EDonor around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6464.4
Applied rewrites64.4%
if -2.0000000000000001e-101 < (+.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.99999999999999985e-24Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6468.7
Applied rewrites68.7%
if 1.99999999999999985e-24 < (+.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.00000000000000022e47Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6491.0
Applied rewrites91.0%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6491.0
Applied rewrites91.0%
Taylor expanded in Ev around inf
Applied rewrites84.0%
if 5.00000000000000022e47 < (+.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-*.f6475.5
Applied rewrites75.5%
Final simplification69.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (or (<= t_2 -1e-300) (not (<= t_2 0.0)))
(+ (/ NdChar (+ 1.0 (exp (/ mu KbT)))) t_1)
(/ NaChar (+ t_0 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -1e-300) || !(t_2 <= 0.0)) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if ((t_2 <= (-1d-300)) .or. (.not. (t_2 <= 0.0d0))) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + t_1
else
tmp = nachar / (t_0 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -1e-300) || !(t_2 <= 0.0)) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if (t_2 <= -1e-300) or not (t_2 <= 0.0): tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_1 else: tmp = NaChar / (t_0 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) 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 <= -1e-300) || !(t_2 <= 0.0)) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_1); else tmp = Float64(NaChar / Float64(t_0 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if ((t_2 <= -1e-300) || ~((t_2 <= 0.0))) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_1; else tmp = NaChar / (t_0 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $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[Or[LessEqual[t$95$2, -1e-300], N[Not[LessEqual[t$95$2, 0.0]], $MachinePrecision]], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
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 -1 \cdot 10^{-300} \lor \neg \left(t\_2 \leq 0\right):\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.00000000000000003e-300 or 0.0 < (+.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 99.9%
Taylor expanded in mu around inf
lower-/.f6479.2
Applied rewrites79.2%
if -1.00000000000000003e-300 < (+.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))))) < 0.0Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification83.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (or (<= t_2 -5e-54) (not (<= t_2 2e-24)))
(+ (* 0.5 NdChar) t_1)
(/ NaChar (+ t_0 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -5e-54) || !(t_2 <= 2e-24)) {
tmp = (0.5 * NdChar) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if ((t_2 <= (-5d-54)) .or. (.not. (t_2 <= 2d-24))) then
tmp = (0.5d0 * ndchar) + t_1
else
tmp = nachar / (t_0 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -5e-54) || !(t_2 <= 2e-24)) {
tmp = (0.5 * NdChar) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if (t_2 <= -5e-54) or not (t_2 <= 2e-24): tmp = (0.5 * NdChar) + t_1 else: tmp = NaChar / (t_0 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) 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 <= -5e-54) || !(t_2 <= 2e-24)) tmp = Float64(Float64(0.5 * NdChar) + t_1); else tmp = Float64(NaChar / Float64(t_0 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if ((t_2 <= -5e-54) || ~((t_2 <= 2e-24))) tmp = (0.5 * NdChar) + t_1; else tmp = NaChar / (t_0 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $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[Or[LessEqual[t$95$2, -5e-54], N[Not[LessEqual[t$95$2, 2e-24]], $MachinePrecision]], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
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 -5 \cdot 10^{-54} \lor \neg \left(t\_2 \leq 2 \cdot 10^{-24}\right):\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.00000000000000015e-54 or 1.99999999999999985e-24 < (+.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 99.9%
Taylor expanded in KbT around inf
lower-*.f6466.9
Applied rewrites66.9%
if -5.00000000000000015e-54 < (+.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.99999999999999985e-24Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6469.0
Applied rewrites69.0%
Final simplification67.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -2e-101)
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ mu Vef) Ec) KbT))))
(/ NaChar (+ 1.0 1.0)))
(if (<= t_2 2e-24) (/ NaChar (+ t_0 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 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-101) {
tmp = (NdChar / (1.0 + exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0));
} else if (t_2 <= 2e-24) {
tmp = NaChar / (t_0 + 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 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-2d-101)) then
tmp = (ndchar / (1.0d0 + exp((((mu + vef) - ec) / kbt)))) + (nachar / (1.0d0 + 1.0d0))
else if (t_2 <= 2d-24) then
tmp = nachar / (t_0 + 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 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-101) {
tmp = (NdChar / (1.0 + Math.exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0));
} else if (t_2 <= 2e-24) {
tmp = NaChar / (t_0 + 1.0);
} else {
tmp = (0.5 * NdChar) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -2e-101: tmp = (NdChar / (1.0 + math.exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0)) elif t_2 <= 2e-24: tmp = NaChar / (t_0 + 1.0) else: tmp = (0.5 * NdChar) + t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) 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-101) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(mu + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + 1.0))); elseif (t_2 <= 2e-24) tmp = Float64(NaChar / Float64(t_0 + 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 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -2e-101) tmp = (NdChar / (1.0 + exp((((mu + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + 1.0)); elseif (t_2 <= 2e-24) tmp = NaChar / (t_0 + 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[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $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-101], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(mu + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-24], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
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^{-101}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(mu + Vef\right) - Ec}{KbT}}} + \frac{NaChar}{1 + 1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2.0000000000000001e-101Initial program 99.8%
Taylor expanded in mu around inf
lower-/.f6477.8
Applied rewrites77.8%
Taylor expanded in KbT around inf
Applied rewrites47.2%
Taylor expanded in EDonor around 0
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6464.4
Applied rewrites64.4%
if -2.0000000000000001e-101 < (+.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.99999999999999985e-24Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6468.7
Applied rewrites68.7%
if 1.99999999999999985e-24 < (+.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-*.f6471.8
Applied rewrites71.8%
Final simplification68.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_0 -5e-237) (not (<= t_0 2e-281)))
(* 0.5 (+ NaChar NdChar))
(/ NaChar (+ 2.0 (/ (- (+ (+ Vef Ev) EAccept) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-237) || !(t_0 <= 2e-281)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = NaChar / (2.0 + ((((Vef + Ev) + EAccept) - mu) / KbT));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
if ((t_0 <= (-5d-237)) .or. (.not. (t_0 <= 2d-281))) then
tmp = 0.5d0 * (nachar + ndchar)
else
tmp = nachar / (2.0d0 + ((((vef + ev) + eaccept) - mu) / kbt))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-237) || !(t_0 <= 2e-281)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = NaChar / (2.0 + ((((Vef + Ev) + EAccept) - mu) / KbT));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) tmp = 0 if (t_0 <= -5e-237) or not (t_0 <= 2e-281): tmp = 0.5 * (NaChar + NdChar) else: tmp = NaChar / (2.0 + ((((Vef + Ev) + EAccept) - mu) / KbT)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if ((t_0 <= -5e-237) || !(t_0 <= 2e-281)) tmp = Float64(0.5 * Float64(NaChar + NdChar)); else tmp = Float64(NaChar / Float64(2.0 + Float64(Float64(Float64(Float64(Vef + Ev) + EAccept) - mu) / KbT))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); tmp = 0.0; if ((t_0 <= -5e-237) || ~((t_0 <= 2e-281))) tmp = 0.5 * (NaChar + NdChar); else tmp = NaChar / (2.0 + ((((Vef + Ev) + EAccept) - mu) / KbT)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-237], N[Not[LessEqual[t$95$0, 2e-281]], $MachinePrecision]], N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(2.0 + N[(N[(N[(N[(Vef + Ev), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-237} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-281}\right):\\
\;\;\;\;0.5 \cdot \left(NaChar + NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{2 + \frac{\left(\left(Vef + Ev\right) + EAccept\right) - mu}{KbT}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-237 or 2e-281 < (+.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 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6436.4
Applied rewrites36.4%
if -5.0000000000000002e-237 < (+.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))))) < 2e-281Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6488.1
Applied rewrites88.1%
Taylor expanded in KbT around inf
Applied rewrites62.9%
Final simplification42.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))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_0 -5e-237) (not (<= t_0 0.0)))
(* 0.5 (+ NaChar NdChar))
(/ (* (* NaChar NaChar) 0.5) (- NaChar NdChar)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-237) || !(t_0 <= 0.0)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = ((NaChar * NaChar) * 0.5) / (NaChar - NdChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
if ((t_0 <= (-5d-237)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = 0.5d0 * (nachar + ndchar)
else
tmp = ((nachar * nachar) * 0.5d0) / (nachar - ndchar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-237) || !(t_0 <= 0.0)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = ((NaChar * NaChar) * 0.5) / (NaChar - NdChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) tmp = 0 if (t_0 <= -5e-237) or not (t_0 <= 0.0): tmp = 0.5 * (NaChar + NdChar) else: tmp = ((NaChar * NaChar) * 0.5) / (NaChar - NdChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if ((t_0 <= -5e-237) || !(t_0 <= 0.0)) tmp = Float64(0.5 * Float64(NaChar + NdChar)); else tmp = Float64(Float64(Float64(NaChar * NaChar) * 0.5) / Float64(NaChar - NdChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); tmp = 0.0; if ((t_0 <= -5e-237) || ~((t_0 <= 0.0))) tmp = 0.5 * (NaChar + NdChar); else tmp = ((NaChar * NaChar) * 0.5) / (NaChar - NdChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-237], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision], N[(N[(N[(NaChar * NaChar), $MachinePrecision] * 0.5), $MachinePrecision] / N[(NaChar - NdChar), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-237} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;0.5 \cdot \left(NaChar + NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(NaChar \cdot NaChar\right) \cdot 0.5}{NaChar - NdChar}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-237 or 0.0 < (+.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 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6435.9
Applied rewrites35.9%
if -5.0000000000000002e-237 < (+.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))))) < 0.0Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f642.6
Applied rewrites2.6%
Applied rewrites5.7%
Taylor expanded in NdChar around 0
Applied rewrites28.5%
Final simplification34.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_0 -5e-237) (not (<= t_0 2e-281)))
(* 0.5 (+ NaChar NdChar))
(/ (* (* NdChar NdChar) -0.5) (- NaChar NdChar)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-237) || !(t_0 <= 2e-281)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = ((NdChar * NdChar) * -0.5) / (NaChar - NdChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
if ((t_0 <= (-5d-237)) .or. (.not. (t_0 <= 2d-281))) then
tmp = 0.5d0 * (nachar + ndchar)
else
tmp = ((ndchar * ndchar) * (-0.5d0)) / (nachar - ndchar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-237) || !(t_0 <= 2e-281)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = ((NdChar * NdChar) * -0.5) / (NaChar - NdChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) tmp = 0 if (t_0 <= -5e-237) or not (t_0 <= 2e-281): tmp = 0.5 * (NaChar + NdChar) else: tmp = ((NdChar * NdChar) * -0.5) / (NaChar - NdChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if ((t_0 <= -5e-237) || !(t_0 <= 2e-281)) tmp = Float64(0.5 * Float64(NaChar + NdChar)); else tmp = Float64(Float64(Float64(NdChar * NdChar) * -0.5) / Float64(NaChar - NdChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); tmp = 0.0; if ((t_0 <= -5e-237) || ~((t_0 <= 2e-281))) tmp = 0.5 * (NaChar + NdChar); else tmp = ((NdChar * NdChar) * -0.5) / (NaChar - NdChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-237], N[Not[LessEqual[t$95$0, 2e-281]], $MachinePrecision]], N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision], N[(N[(N[(NdChar * NdChar), $MachinePrecision] * -0.5), $MachinePrecision] / N[(NaChar - NdChar), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-237} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-281}\right):\\
\;\;\;\;0.5 \cdot \left(NaChar + NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(NdChar \cdot NdChar\right) \cdot -0.5}{NaChar - NdChar}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-237 or 2e-281 < (+.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 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6436.4
Applied rewrites36.4%
if -5.0000000000000002e-237 < (+.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))))) < 2e-281Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f642.7
Applied rewrites2.7%
Applied rewrites5.6%
Taylor expanded in NdChar around inf
Applied rewrites22.5%
Final simplification33.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_0 -5e-249) (not (<= t_0 2e-281)))
(* 0.5 (+ NaChar NdChar))
(* (/ (* NaChar mu) KbT) 0.25))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 2e-281)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = ((NaChar * mu) / KbT) * 0.25;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
if ((t_0 <= (-5d-249)) .or. (.not. (t_0 <= 2d-281))) then
tmp = 0.5d0 * (nachar + ndchar)
else
tmp = ((nachar * mu) / kbt) * 0.25d0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 2e-281)) {
tmp = 0.5 * (NaChar + NdChar);
} else {
tmp = ((NaChar * mu) / KbT) * 0.25;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) tmp = 0 if (t_0 <= -5e-249) or not (t_0 <= 2e-281): tmp = 0.5 * (NaChar + NdChar) else: tmp = ((NaChar * mu) / KbT) * 0.25 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 2e-281)) tmp = Float64(0.5 * Float64(NaChar + NdChar)); else tmp = Float64(Float64(Float64(NaChar * mu) / KbT) * 0.25); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); tmp = 0.0; if ((t_0 <= -5e-249) || ~((t_0 <= 2e-281))) tmp = 0.5 * (NaChar + NdChar); else tmp = ((NaChar * mu) / KbT) * 0.25; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 2e-281]], $MachinePrecision]], N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision], N[(N[(N[(NaChar * mu), $MachinePrecision] / KbT), $MachinePrecision] * 0.25), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-281}\right):\\
\;\;\;\;0.5 \cdot \left(NaChar + NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar \cdot mu}{KbT} \cdot 0.25\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.9999999999999999e-249 or 2e-281 < (+.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 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6435.9
Applied rewrites35.9%
if -4.9999999999999999e-249 < (+.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))))) < 2e-281Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6432.7
Applied rewrites32.7%
Taylor expanded in KbT around inf
mul-1-negN/A
div-addN/A
associate-*r/N/A
associate-*r/N/A
distribute-lft-outN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites1.8%
Taylor expanded in mu around -inf
Applied rewrites8.9%
Taylor expanded in NdChar around 0
Applied rewrites22.9%
Final simplification33.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)) (t_1 (exp t_0)))
(if (<= NaChar -1.4e+86)
(+
(/ NdChar (+ 2.0 (/ (- (+ (+ mu Vef) EDonor) Ec) KbT)))
(/ NaChar (+ 1.0 t_1)))
(if (<= NaChar 6.2e+30)
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 t_0))))
(/ NaChar (+ t_1 1.0))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double t_1 = exp(t_0);
double tmp;
if (NaChar <= -1.4e+86) {
tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1));
} else if (NaChar <= 6.2e+30) {
tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else {
tmp = NaChar / (t_1 + 1.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((ev + vef) + eaccept) - mu) / kbt
t_1 = exp(t_0)
if (nachar <= (-1.4d+86)) then
tmp = (ndchar / (2.0d0 + ((((mu + vef) + edonor) - ec) / kbt))) + (nachar / (1.0d0 + t_1))
else if (nachar <= 6.2d+30) then
tmp = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + (1.0d0 + t_0)))
else
tmp = nachar / (t_1 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double t_1 = Math.exp(t_0);
double tmp;
if (NaChar <= -1.4e+86) {
tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1));
} else if (NaChar <= 6.2e+30) {
tmp = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else {
tmp = NaChar / (t_1 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (((Ev + Vef) + EAccept) - mu) / KbT t_1 = math.exp(t_0) tmp = 0 if NaChar <= -1.4e+86: tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1)) elif NaChar <= 6.2e+30: tmp = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))) else: tmp = NaChar / (t_1 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT) t_1 = exp(t_0) tmp = 0.0 if (NaChar <= -1.4e+86) tmp = Float64(Float64(NdChar / Float64(2.0 + Float64(Float64(Float64(Float64(mu + Vef) + EDonor) - Ec) / KbT))) + Float64(NaChar / Float64(1.0 + t_1))); elseif (NaChar <= 6.2e+30) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + t_0)))); else tmp = Float64(NaChar / Float64(t_1 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (((Ev + Vef) + EAccept) - mu) / KbT; t_1 = exp(t_0); tmp = 0.0; if (NaChar <= -1.4e+86) tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1)); elseif (NaChar <= 6.2e+30) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))); else tmp = NaChar / (t_1 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]}, Block[{t$95$1 = N[Exp[t$95$0], $MachinePrecision]}, If[LessEqual[NaChar, -1.4e+86], N[(N[(NdChar / N[(2.0 + N[(N[(N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, 6.2e+30], 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[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\\
t_1 := e^{t\_0}\\
\mathbf{if}\;NaChar \leq -1.4 \cdot 10^{+86}:\\
\;\;\;\;\frac{NdChar}{2 + \frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}} + \frac{NaChar}{1 + t\_1}\\
\mathbf{elif}\;NaChar \leq 6.2 \cdot 10^{+30}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + \left(1 + t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_1 + 1}\\
\end{array}
\end{array}
if NaChar < -1.40000000000000002e86Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6476.4
Applied rewrites76.4%
if -1.40000000000000002e86 < NaChar < 6.1999999999999995e30Initial program 99.9%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6474.7
Applied rewrites74.7%
if 6.1999999999999995e30 < NaChar Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6479.3
Applied rewrites79.3%
Final simplification76.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(if (or (<= NaChar -3.9e+93) (not (<= NaChar 5.6e+30)))
(/ NaChar (+ (exp t_0) 1.0))
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 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 = (((Ev + Vef) + EAccept) - mu) / KbT;
double tmp;
if ((NaChar <= -3.9e+93) || !(NaChar <= 5.6e+30)) {
tmp = NaChar / (exp(t_0) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + 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 = (((ev + vef) + eaccept) - mu) / kbt
if ((nachar <= (-3.9d+93)) .or. (.not. (nachar <= 5.6d+30))) then
tmp = nachar / (exp(t_0) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))) + (nachar / (1.0d0 + (1.0d0 + 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 = (((Ev + Vef) + EAccept) - mu) / KbT;
double tmp;
if ((NaChar <= -3.9e+93) || !(NaChar <= 5.6e+30)) {
tmp = NaChar / (Math.exp(t_0) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (((Ev + Vef) + EAccept) - mu) / KbT tmp = 0 if (NaChar <= -3.9e+93) or not (NaChar <= 5.6e+30): tmp = NaChar / (math.exp(t_0) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT) tmp = 0.0 if ((NaChar <= -3.9e+93) || !(NaChar <= 5.6e+30)) tmp = Float64(NaChar / Float64(exp(t_0) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + t_0)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (((Ev + Vef) + EAccept) - mu) / KbT; tmp = 0.0; if ((NaChar <= -3.9e+93) || ~((NaChar <= 5.6e+30))) tmp = NaChar / (exp(t_0) + 1.0); else tmp = (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]}, If[Or[LessEqual[NaChar, -3.9e+93], N[Not[LessEqual[NaChar, 5.6e+30]], $MachinePrecision]], N[(NaChar / N[(N[Exp[t$95$0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\\
\mathbf{if}\;NaChar \leq -3.9 \cdot 10^{+93} \lor \neg \left(NaChar \leq 5.6 \cdot 10^{+30}\right):\\
\;\;\;\;\frac{NaChar}{e^{t\_0} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}} + \frac{NaChar}{1 + \left(1 + t\_0\right)}\\
\end{array}
\end{array}
if NaChar < -3.9000000000000002e93 or 5.59999999999999966e30 < NaChar Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6475.5
Applied rewrites75.5%
if -3.9000000000000002e93 < NaChar < 5.59999999999999966e30Initial program 99.9%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6474.5
Applied rewrites74.5%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6469.6
Applied rewrites69.6%
Final simplification72.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)) (t_1 (exp t_0)))
(if (<= NaChar -1.4e+86)
(+
(/ NdChar (+ 2.0 (/ (- (+ (+ mu Vef) EDonor) Ec) KbT)))
(/ NaChar (+ 1.0 t_1)))
(if (<= NaChar 5.6e+30)
(+
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor Vef) Ec) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 t_0))))
(/ NaChar (+ t_1 1.0))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double t_1 = exp(t_0);
double tmp;
if (NaChar <= -1.4e+86) {
tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1));
} else if (NaChar <= 5.6e+30) {
tmp = (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else {
tmp = NaChar / (t_1 + 1.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((ev + vef) + eaccept) - mu) / kbt
t_1 = exp(t_0)
if (nachar <= (-1.4d+86)) then
tmp = (ndchar / (2.0d0 + ((((mu + vef) + edonor) - ec) / kbt))) + (nachar / (1.0d0 + t_1))
else if (nachar <= 5.6d+30) then
tmp = (ndchar / (1.0d0 + exp((((edonor + vef) - ec) / kbt)))) + (nachar / (1.0d0 + (1.0d0 + t_0)))
else
tmp = nachar / (t_1 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double t_1 = Math.exp(t_0);
double tmp;
if (NaChar <= -1.4e+86) {
tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1));
} else if (NaChar <= 5.6e+30) {
tmp = (NdChar / (1.0 + Math.exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else {
tmp = NaChar / (t_1 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (((Ev + Vef) + EAccept) - mu) / KbT t_1 = math.exp(t_0) tmp = 0 if NaChar <= -1.4e+86: tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1)) elif NaChar <= 5.6e+30: tmp = (NdChar / (1.0 + math.exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))) else: tmp = NaChar / (t_1 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT) t_1 = exp(t_0) tmp = 0.0 if (NaChar <= -1.4e+86) tmp = Float64(Float64(NdChar / Float64(2.0 + Float64(Float64(Float64(Float64(mu + Vef) + EDonor) - Ec) / KbT))) + Float64(NaChar / Float64(1.0 + t_1))); elseif (NaChar <= 5.6e+30) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + t_0)))); else tmp = Float64(NaChar / Float64(t_1 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (((Ev + Vef) + EAccept) - mu) / KbT; t_1 = exp(t_0); tmp = 0.0; if (NaChar <= -1.4e+86) tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + t_1)); elseif (NaChar <= 5.6e+30) tmp = (NdChar / (1.0 + exp((((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))); else tmp = NaChar / (t_1 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]}, Block[{t$95$1 = N[Exp[t$95$0], $MachinePrecision]}, If[LessEqual[NaChar, -1.4e+86], N[(N[(NdChar / N[(2.0 + N[(N[(N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, 5.6e+30], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\\
t_1 := e^{t\_0}\\
\mathbf{if}\;NaChar \leq -1.4 \cdot 10^{+86}:\\
\;\;\;\;\frac{NdChar}{2 + \frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}} + \frac{NaChar}{1 + t\_1}\\
\mathbf{elif}\;NaChar \leq 5.6 \cdot 10^{+30}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + Vef\right) - Ec}{KbT}}} + \frac{NaChar}{1 + \left(1 + t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_1 + 1}\\
\end{array}
\end{array}
if NaChar < -1.40000000000000002e86Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6476.4
Applied rewrites76.4%
if -1.40000000000000002e86 < NaChar < 5.59999999999999966e30Initial program 99.9%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6474.7
Applied rewrites74.7%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
if 5.59999999999999966e30 < NaChar Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6479.3
Applied rewrites79.3%
Final simplification73.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NaChar (+ 1.0 1.0))))
(if (<= KbT -5.2e+224)
(+ (/ NdChar (+ 1.0 (exp (/ mu KbT)))) t_0)
(if (<= KbT 4.8e+142)
(/ NaChar (+ (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)) 1.0))
(+ (/ NdChar (+ 1.0 (exp (/ EDonor 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 + 1.0);
double tmp;
if (KbT <= -5.2e+224) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_0;
} else if (KbT <= 4.8e+142) {
tmp = NaChar / (exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((EDonor / 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) :: tmp
t_0 = nachar / (1.0d0 + 1.0d0)
if (kbt <= (-5.2d+224)) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + t_0
else if (kbt <= 4.8d+142) then
tmp = nachar / (exp(((((ev + vef) + eaccept) - mu) / kbt)) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((edonor / 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 + 1.0);
double tmp;
if (KbT <= -5.2e+224) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_0;
} else if (KbT <= 4.8e+142) {
tmp = NaChar / (Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NaChar / (1.0 + 1.0) tmp = 0 if KbT <= -5.2e+224: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_0 elif KbT <= 4.8e+142: tmp = NaChar / (math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NaChar / Float64(1.0 + 1.0)) tmp = 0.0 if (KbT <= -5.2e+224) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_0); elseif (KbT <= 4.8e+142) tmp = Float64(NaChar / Float64(exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / 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 + 1.0); tmp = 0.0; if (KbT <= -5.2e+224) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_0; elseif (KbT <= 4.8e+142) tmp = NaChar / (exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0); else tmp = (NdChar / (1.0 + exp((EDonor / 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 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -5.2e+224], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[KbT, 4.8e+142], N[(NaChar / N[(N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NaChar}{1 + 1}\\
\mathbf{if}\;KbT \leq -5.2 \cdot 10^{+224}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_0\\
\mathbf{elif}\;KbT \leq 4.8 \cdot 10^{+142}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + t\_0\\
\end{array}
\end{array}
if KbT < -5.2000000000000001e224Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6497.7
Applied rewrites97.7%
Taylor expanded in KbT around inf
Applied rewrites84.9%
if -5.2000000000000001e224 < KbT < 4.7999999999999998e142Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6459.5
Applied rewrites59.5%
if 4.7999999999999998e142 < KbT Initial program 99.6%
Taylor expanded in mu around inf
lower-/.f6484.0
Applied rewrites84.0%
Taylor expanded in KbT around inf
Applied rewrites76.4%
Taylor expanded in EDonor around inf
lower-/.f6480.4
Applied rewrites80.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(if (<= KbT -3.8e+225)
(+
(/ NdChar (+ 1.0 (+ 1.0 (/ (- (+ EDonor Vef) Ec) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 t_0))))
(if (<= KbT 4.8e+142)
(/ NaChar (+ (exp t_0) 1.0))
(+ (/ NdChar (+ 1.0 (exp (/ EDonor KbT)))) (/ NaChar (+ 1.0 1.0)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double tmp;
if (KbT <= -3.8e+225) {
tmp = (NdChar / (1.0 + (1.0 + (((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else if (KbT <= 4.8e+142) {
tmp = NaChar / (exp(t_0) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + 1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (((ev + vef) + eaccept) - mu) / kbt
if (kbt <= (-3.8d+225)) then
tmp = (ndchar / (1.0d0 + (1.0d0 + (((edonor + vef) - ec) / kbt)))) + (nachar / (1.0d0 + (1.0d0 + t_0)))
else if (kbt <= 4.8d+142) then
tmp = nachar / (exp(t_0) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + 1.0d0))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double tmp;
if (KbT <= -3.8e+225) {
tmp = (NdChar / (1.0 + (1.0 + (((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else if (KbT <= 4.8e+142) {
tmp = NaChar / (Math.exp(t_0) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + 1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (((Ev + Vef) + EAccept) - mu) / KbT tmp = 0 if KbT <= -3.8e+225: tmp = (NdChar / (1.0 + (1.0 + (((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))) elif KbT <= 4.8e+142: tmp = NaChar / (math.exp(t_0) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + 1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT) tmp = 0.0 if (KbT <= -3.8e+225) tmp = Float64(Float64(NdChar / Float64(1.0 + Float64(1.0 + Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + t_0)))); elseif (KbT <= 4.8e+142) tmp = Float64(NaChar / Float64(exp(t_0) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + 1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (((Ev + Vef) + EAccept) - mu) / KbT; tmp = 0.0; if (KbT <= -3.8e+225) tmp = (NdChar / (1.0 + (1.0 + (((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0))); elseif (KbT <= 4.8e+142) tmp = NaChar / (exp(t_0) + 1.0); else tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + 1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]}, If[LessEqual[KbT, -3.8e+225], N[(N[(NdChar / N[(1.0 + N[(1.0 + N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 4.8e+142], N[(NaChar / N[(N[Exp[t$95$0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\\
\mathbf{if}\;KbT \leq -3.8 \cdot 10^{+225}:\\
\;\;\;\;\frac{NdChar}{1 + \left(1 + \frac{\left(EDonor + Vef\right) - Ec}{KbT}\right)} + \frac{NaChar}{1 + \left(1 + t\_0\right)}\\
\mathbf{elif}\;KbT \leq 4.8 \cdot 10^{+142}:\\
\;\;\;\;\frac{NaChar}{e^{t\_0} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + 1}\\
\end{array}
\end{array}
if KbT < -3.8000000000000001e225Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6487.4
Applied rewrites87.4%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6484.1
Applied rewrites84.1%
Taylor expanded in KbT around inf
Applied rewrites83.0%
if -3.8000000000000001e225 < KbT < 4.7999999999999998e142Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6459.5
Applied rewrites59.5%
if 4.7999999999999998e142 < KbT Initial program 99.6%
Taylor expanded in mu around inf
lower-/.f6484.0
Applied rewrites84.0%
Taylor expanded in KbT around inf
Applied rewrites76.4%
Taylor expanded in EDonor around inf
lower-/.f6480.4
Applied rewrites80.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= KbT -5.5e+224)
(+
(/ NdChar (+ 1.0 (+ 1.0 (/ (- (+ EDonor Vef) Ec) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))
(if (<= KbT -4.3e-33)
(/ NaChar (+ (exp (/ (- (+ EAccept Vef) mu) KbT)) 1.0))
(if (<= KbT 4.5e+142)
(/ NaChar (+ (exp (/ (- (+ EAccept Ev) mu) KbT)) 1.0))
(fma -0.25 (* EDonor (/ NdChar KbT)) (* 0.5 (+ NaChar NdChar)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -5.5e+224) {
tmp = (NdChar / (1.0 + (1.0 + (((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + ((((Ev + Vef) + EAccept) - mu) / KbT))));
} else if (KbT <= -4.3e-33) {
tmp = NaChar / (exp((((EAccept + Vef) - mu) / KbT)) + 1.0);
} else if (KbT <= 4.5e+142) {
tmp = NaChar / (exp((((EAccept + Ev) - mu) / KbT)) + 1.0);
} else {
tmp = fma(-0.25, (EDonor * (NdChar / KbT)), (0.5 * (NaChar + NdChar)));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -5.5e+224) tmp = Float64(Float64(NdChar / Float64(1.0 + Float64(1.0 + Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))); elseif (KbT <= -4.3e-33) tmp = Float64(NaChar / Float64(exp(Float64(Float64(Float64(EAccept + Vef) - mu) / KbT)) + 1.0)); elseif (KbT <= 4.5e+142) tmp = Float64(NaChar / Float64(exp(Float64(Float64(Float64(EAccept + Ev) - mu) / KbT)) + 1.0)); else tmp = fma(-0.25, Float64(EDonor * Float64(NdChar / KbT)), Float64(0.5 * Float64(NaChar + NdChar))); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -5.5e+224], N[(N[(NdChar / N[(1.0 + N[(1.0 + N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[(1.0 + N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, -4.3e-33], N[(NaChar / N[(N[Exp[N[(N[(N[(EAccept + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 4.5e+142], N[(NaChar / N[(N[Exp[N[(N[(N[(EAccept + Ev), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(EDonor * N[(NdChar / KbT), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -5.5 \cdot 10^{+224}:\\
\;\;\;\;\frac{NdChar}{1 + \left(1 + \frac{\left(EDonor + Vef\right) - Ec}{KbT}\right)} + \frac{NaChar}{1 + \left(1 + \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\right)}\\
\mathbf{elif}\;KbT \leq -4.3 \cdot 10^{-33}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{\left(EAccept + Vef\right) - mu}{KbT}} + 1}\\
\mathbf{elif}\;KbT \leq 4.5 \cdot 10^{+142}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{\left(EAccept + Ev\right) - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, EDonor \cdot \frac{NdChar}{KbT}, 0.5 \cdot \left(NaChar + NdChar\right)\right)\\
\end{array}
\end{array}
if KbT < -5.50000000000000035e224Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6487.4
Applied rewrites87.4%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6484.1
Applied rewrites84.1%
Taylor expanded in KbT around inf
Applied rewrites83.0%
if -5.50000000000000035e224 < KbT < -4.30000000000000031e-33Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6452.2
Applied rewrites52.2%
Taylor expanded in Ev around 0
Applied rewrites45.5%
if -4.30000000000000031e-33 < KbT < 4.4999999999999999e142Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6461.8
Applied rewrites61.8%
Taylor expanded in Vef around 0
Applied rewrites55.5%
if 4.4999999999999999e142 < KbT Initial program 99.6%
Taylor expanded in mu around inf
lower-/.f6484.0
Applied rewrites84.0%
Taylor expanded in KbT around inf
mul-1-negN/A
div-addN/A
associate-*r/N/A
associate-*r/N/A
distribute-lft-outN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites48.7%
Taylor expanded in EDonor around inf
Applied rewrites72.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(if (<= KbT -3.8e+225)
(+
(/ NdChar (+ 1.0 (+ 1.0 (/ (- (+ EDonor Vef) Ec) KbT))))
(/ NaChar (+ 1.0 (+ 1.0 t_0))))
(if (<= KbT 5e+142)
(/ NaChar (+ (exp t_0) 1.0))
(fma -0.25 (* EDonor (/ NdChar KbT)) (* 0.5 (+ NaChar NdChar)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double tmp;
if (KbT <= -3.8e+225) {
tmp = (NdChar / (1.0 + (1.0 + (((EDonor + Vef) - Ec) / KbT)))) + (NaChar / (1.0 + (1.0 + t_0)));
} else if (KbT <= 5e+142) {
tmp = NaChar / (exp(t_0) + 1.0);
} else {
tmp = fma(-0.25, (EDonor * (NdChar / KbT)), (0.5 * (NaChar + NdChar)));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT) tmp = 0.0 if (KbT <= -3.8e+225) tmp = Float64(Float64(NdChar / Float64(1.0 + Float64(1.0 + Float64(Float64(Float64(EDonor + Vef) - Ec) / KbT)))) + Float64(NaChar / Float64(1.0 + Float64(1.0 + t_0)))); elseif (KbT <= 5e+142) tmp = Float64(NaChar / Float64(exp(t_0) + 1.0)); else tmp = fma(-0.25, Float64(EDonor * Float64(NdChar / KbT)), Float64(0.5 * Float64(NaChar + NdChar))); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]}, If[LessEqual[KbT, -3.8e+225], N[(N[(NdChar / N[(1.0 + N[(1.0 + N[(N[(N[(EDonor + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 5e+142], N[(NaChar / N[(N[Exp[t$95$0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(EDonor * N[(NdChar / KbT), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\\
\mathbf{if}\;KbT \leq -3.8 \cdot 10^{+225}:\\
\;\;\;\;\frac{NdChar}{1 + \left(1 + \frac{\left(EDonor + Vef\right) - Ec}{KbT}\right)} + \frac{NaChar}{1 + \left(1 + t\_0\right)}\\
\mathbf{elif}\;KbT \leq 5 \cdot 10^{+142}:\\
\;\;\;\;\frac{NaChar}{e^{t\_0} + 1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, EDonor \cdot \frac{NdChar}{KbT}, 0.5 \cdot \left(NaChar + NdChar\right)\right)\\
\end{array}
\end{array}
if KbT < -3.8000000000000001e225Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6487.4
Applied rewrites87.4%
Taylor expanded in mu around 0
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6484.1
Applied rewrites84.1%
Taylor expanded in KbT around inf
Applied rewrites83.0%
if -3.8000000000000001e225 < KbT < 5.0000000000000001e142Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6459.5
Applied rewrites59.5%
if 5.0000000000000001e142 < KbT Initial program 99.6%
Taylor expanded in mu around inf
lower-/.f6484.0
Applied rewrites84.0%
Taylor expanded in KbT around inf
mul-1-negN/A
div-addN/A
associate-*r/N/A
associate-*r/N/A
distribute-lft-outN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites48.7%
Taylor expanded in EDonor around inf
Applied rewrites72.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= KbT -4.4e+163)
(+
(/ NdChar (+ 2.0 (/ (- (+ (+ mu Vef) EDonor) Ec) KbT)))
(/ NaChar (+ 1.0 1.0)))
(if (<= KbT 4.5e+142)
(/ NaChar (+ (exp (/ (- (+ EAccept Ev) mu) KbT)) 1.0))
(fma -0.25 (* EDonor (/ NdChar KbT)) (* 0.5 (+ NaChar NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -4.4e+163) {
tmp = (NdChar / (2.0 + ((((mu + Vef) + EDonor) - Ec) / KbT))) + (NaChar / (1.0 + 1.0));
} else if (KbT <= 4.5e+142) {
tmp = NaChar / (exp((((EAccept + Ev) - mu) / KbT)) + 1.0);
} else {
tmp = fma(-0.25, (EDonor * (NdChar / KbT)), (0.5 * (NaChar + NdChar)));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -4.4e+163) tmp = Float64(Float64(NdChar / Float64(2.0 + Float64(Float64(Float64(Float64(mu + Vef) + EDonor) - Ec) / KbT))) + Float64(NaChar / Float64(1.0 + 1.0))); elseif (KbT <= 4.5e+142) tmp = Float64(NaChar / Float64(exp(Float64(Float64(Float64(EAccept + Ev) - mu) / KbT)) + 1.0)); else tmp = fma(-0.25, Float64(EDonor * Float64(NdChar / KbT)), Float64(0.5 * Float64(NaChar + NdChar))); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -4.4e+163], N[(N[(NdChar / N[(2.0 + N[(N[(N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 4.5e+142], N[(NaChar / N[(N[Exp[N[(N[(N[(EAccept + Ev), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(EDonor * N[(NdChar / KbT), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -4.4 \cdot 10^{+163}:\\
\;\;\;\;\frac{NdChar}{2 + \frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}} + \frac{NaChar}{1 + 1}\\
\mathbf{elif}\;KbT \leq 4.5 \cdot 10^{+142}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{\left(EAccept + Ev\right) - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, EDonor \cdot \frac{NdChar}{KbT}, 0.5 \cdot \left(NaChar + NdChar\right)\right)\\
\end{array}
\end{array}
if KbT < -4.39999999999999973e163Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6479.9
Applied rewrites79.9%
Taylor expanded in KbT around inf
Applied rewrites64.4%
if -4.39999999999999973e163 < KbT < 4.4999999999999999e142Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6460.1
Applied rewrites60.1%
Taylor expanded in Vef around 0
Applied rewrites53.9%
if 4.4999999999999999e142 < KbT Initial program 99.6%
Taylor expanded in mu around inf
lower-/.f6484.0
Applied rewrites84.0%
Taylor expanded in KbT around inf
mul-1-negN/A
div-addN/A
associate-*r/N/A
associate-*r/N/A
distribute-lft-outN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites48.7%
Taylor expanded in EDonor around inf
Applied rewrites72.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NaChar -4.8e+93) (not (<= NaChar 1.65e+37))) (* 0.5 NaChar) (* 0.5 NdChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NaChar <= -4.8e+93) || !(NaChar <= 1.65e+37)) {
tmp = 0.5 * NaChar;
} else {
tmp = 0.5 * NdChar;
}
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 <= (-4.8d+93)) .or. (.not. (nachar <= 1.65d+37))) then
tmp = 0.5d0 * nachar
else
tmp = 0.5d0 * ndchar
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 <= -4.8e+93) || !(NaChar <= 1.65e+37)) {
tmp = 0.5 * NaChar;
} else {
tmp = 0.5 * NdChar;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NaChar <= -4.8e+93) or not (NaChar <= 1.65e+37): tmp = 0.5 * NaChar else: tmp = 0.5 * NdChar return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NaChar <= -4.8e+93) || !(NaChar <= 1.65e+37)) tmp = Float64(0.5 * NaChar); else tmp = Float64(0.5 * NdChar); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NaChar <= -4.8e+93) || ~((NaChar <= 1.65e+37))) tmp = 0.5 * NaChar; else tmp = 0.5 * NdChar; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NaChar, -4.8e+93], N[Not[LessEqual[NaChar, 1.65e+37]], $MachinePrecision]], N[(0.5 * NaChar), $MachinePrecision], N[(0.5 * NdChar), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NaChar \leq -4.8 \cdot 10^{+93} \lor \neg \left(NaChar \leq 1.65 \cdot 10^{+37}\right):\\
\;\;\;\;0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar\\
\end{array}
\end{array}
if NaChar < -4.80000000000000021e93 or 1.65e37 < NaChar Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6433.4
Applied rewrites33.4%
Taylor expanded in NdChar around 0
Applied rewrites28.4%
if -4.80000000000000021e93 < NaChar < 1.65e37Initial program 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6425.2
Applied rewrites25.2%
Taylor expanded in NdChar around inf
Applied rewrites23.1%
Final simplification25.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 (+ NaChar NdChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * (NaChar + NdChar);
}
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 + ndchar)
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 + NdChar);
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * (NaChar + NdChar)
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * Float64(NaChar + NdChar)) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * (NaChar + NdChar); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(NaChar + NdChar\right)
\end{array}
Initial program 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.4
Applied rewrites28.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 NaChar))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * nachar
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * NaChar
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * NaChar) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * NaChar; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot NaChar
\end{array}
Initial program 99.9%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.4
Applied rewrites28.4%
Taylor expanded in NdChar around 0
Applied rewrites17.4%
herbie shell --seed 2024364
(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))))))