
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2
(/ NaChar (+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))
(t_3 (+ (/ NdChar (+ 1.0 (exp (/ mu KbT)))) t_2))
(t_4 (+ t_1 t_2)))
(if (<= t_4 -1e-278)
t_3
(if (<= t_4 0.0)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(if (<= t_4 2e+195)
t_3
(+ t_1 (/ NaChar (+ 1.0 (exp (/ (fmax Ev 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 = fmin(Ev, EAccept) + Vef;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_3 = (NdChar / (1.0 + exp((mu / KbT)))) + t_2;
double t_4 = t_1 + t_2;
double tmp;
if (t_4 <= -1e-278) {
tmp = t_3;
} else if (t_4 <= 0.0) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_4 <= 2e+195) {
tmp = t_3;
} else {
tmp = t_1 + (NaChar / (1.0 + exp((fmax(Ev, 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 = fmin(ev, eaccept) + vef
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt)))
t_3 = (ndchar / (1.0d0 + exp((mu / kbt)))) + t_2
t_4 = t_1 + t_2
if (t_4 <= (-1d-278)) then
tmp = t_3
else if (t_4 <= 0.0d0) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else if (t_4 <= 2d+195) then
tmp = t_3
else
tmp = t_1 + (nachar / (1.0d0 + exp((fmax(ev, 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 = fmin(Ev, EAccept) + Vef;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_3 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_2;
double t_4 = t_1 + t_2;
double tmp;
if (t_4 <= -1e-278) {
tmp = t_3;
} else if (t_4 <= 0.0) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_4 <= 2e+195) {
tmp = t_3;
} else {
tmp = t_1 + (NaChar / (1.0 + Math.exp((fmax(Ev, EAccept) / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))) t_3 = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_2 t_4 = t_1 + t_2 tmp = 0 if t_4 <= -1e-278: tmp = t_3 elif t_4 <= 0.0: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) elif t_4 <= 2e+195: tmp = t_3 else: tmp = t_1 + (NaChar / (1.0 + math.exp((fmax(Ev, EAccept) / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_2 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT)))) t_3 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_2) t_4 = Float64(t_1 + t_2) tmp = 0.0 if (t_4 <= -1e-278) tmp = t_3; elseif (t_4 <= 0.0) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); elseif (t_4 <= 2e+195) tmp = t_3; else tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(fmax(Ev, EAccept) / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT))); t_3 = (NdChar / (1.0 + exp((mu / KbT)))) + t_2; t_4 = t_1 + t_2; tmp = 0.0; if (t_4 <= -1e-278) tmp = t_3; elseif (t_4 <= 0.0) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); elseif (t_4 <= 2e+195) tmp = t_3; else tmp = t_1 + (NaChar / (1.0 + exp((max(Ev, EAccept) / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(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$2 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$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$1 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$4, -1e-278], t$95$3, If[LessEqual[t$95$4, 0.0], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2e+195], t$95$3, N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_2 := \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
t_3 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_2\\
t_4 := t\_1 + t\_2\\
\mathbf{if}\;t\_4 \leq -1 \cdot 10^{-278}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+195}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}}}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999938e-279 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.99999999999999995e195Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
if -9.99999999999999938e-279 < (+.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
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 1.99999999999999995e195 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
(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 (+ (fmin Ev EAccept) Vef))
(t_2 (+ t_0 (/ NaChar (+ 1.0 (exp (/ (fmax Ev EAccept) KbT)))))))
(if (<= (fmin Ev EAccept) -2.8e+56)
(+ t_0 (/ NaChar (+ 1.0 (exp (/ (fmin Ev EAccept) KbT)))))
(if (<= (fmin Ev EAccept) -6.5e-126)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- t_1 mu) KbT)))))
(if (<= (fmin Ev EAccept) -1.1e-262)
t_2
(if (<= (fmin Ev EAccept) 3.8e-263)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_1) mu) KbT))))
t_2))))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = fmin(Ev, EAccept) + Vef;
double t_2 = t_0 + (NaChar / (1.0 + exp((fmax(Ev, EAccept) / KbT))));
double tmp;
if (fmin(Ev, EAccept) <= -2.8e+56) {
tmp = t_0 + (NaChar / (1.0 + exp((fmin(Ev, EAccept) / KbT))));
} else if (fmin(Ev, EAccept) <= -6.5e-126) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((t_1 - mu) / KbT))));
} else if (fmin(Ev, EAccept) <= -1.1e-262) {
tmp = t_2;
} else if (fmin(Ev, EAccept) <= 3.8e-263) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_1) - mu) / KbT)));
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = fmin(ev, eaccept) + vef
t_2 = t_0 + (nachar / (1.0d0 + exp((fmax(ev, eaccept) / kbt))))
if (fmin(ev, eaccept) <= (-2.8d+56)) then
tmp = t_0 + (nachar / (1.0d0 + exp((fmin(ev, eaccept) / kbt))))
else if (fmin(ev, eaccept) <= (-6.5d-126)) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((t_1 - mu) / kbt))))
else if (fmin(ev, eaccept) <= (-1.1d-262)) then
tmp = t_2
else if (fmin(ev, eaccept) <= 3.8d-263) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_1) - mu) / kbt)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = fmin(Ev, EAccept) + Vef;
double t_2 = t_0 + (NaChar / (1.0 + Math.exp((fmax(Ev, EAccept) / KbT))));
double tmp;
if (fmin(Ev, EAccept) <= -2.8e+56) {
tmp = t_0 + (NaChar / (1.0 + Math.exp((fmin(Ev, EAccept) / KbT))));
} else if (fmin(Ev, EAccept) <= -6.5e-126) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((t_1 - mu) / KbT))));
} else if (fmin(Ev, EAccept) <= -1.1e-262) {
tmp = t_2;
} else if (fmin(Ev, EAccept) <= 3.8e-263) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_1) - mu) / KbT)));
} else {
tmp = t_2;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = fmin(Ev, EAccept) + Vef t_2 = t_0 + (NaChar / (1.0 + math.exp((fmax(Ev, EAccept) / KbT)))) tmp = 0 if fmin(Ev, EAccept) <= -2.8e+56: tmp = t_0 + (NaChar / (1.0 + math.exp((fmin(Ev, EAccept) / KbT)))) elif fmin(Ev, EAccept) <= -6.5e-126: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((t_1 - mu) / KbT)))) elif fmin(Ev, EAccept) <= -1.1e-262: tmp = t_2 elif fmin(Ev, EAccept) <= 3.8e-263: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_1) - mu) / KbT))) else: tmp = t_2 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = Float64(fmin(Ev, EAccept) + Vef) t_2 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(fmax(Ev, EAccept) / KbT))))) tmp = 0.0 if (fmin(Ev, EAccept) <= -2.8e+56) tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(fmin(Ev, EAccept) / KbT))))); elseif (fmin(Ev, EAccept) <= -6.5e-126) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_1 - mu) / KbT))))); elseif (fmin(Ev, EAccept) <= -1.1e-262) tmp = t_2; elseif (fmin(Ev, EAccept) <= 3.8e-263) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_1) - mu) / KbT)))); else tmp = t_2; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = min(Ev, EAccept) + Vef; t_2 = t_0 + (NaChar / (1.0 + exp((max(Ev, EAccept) / KbT)))); tmp = 0.0; if (min(Ev, EAccept) <= -2.8e+56) tmp = t_0 + (NaChar / (1.0 + exp((min(Ev, EAccept) / KbT)))); elseif (min(Ev, EAccept) <= -6.5e-126) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((t_1 - mu) / KbT)))); elseif (min(Ev, EAccept) <= -1.1e-262) tmp = t_2; elseif (min(Ev, EAccept) <= 3.8e-263) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_1) - mu) / KbT))); else tmp = t_2; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[Ev, EAccept], $MachinePrecision], -2.8e+56], N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[Min[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[Ev, EAccept], $MachinePrecision], -6.5e-126], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$1 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[Ev, EAccept], $MachinePrecision], -1.1e-262], t$95$2, If[LessEqual[N[Min[Ev, EAccept], $MachinePrecision], 3.8e-263], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$1), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_2 := t\_0 + \frac{NaChar}{1 + e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}}}\\
\mathbf{if}\;\mathsf{min}\left(Ev, EAccept\right) \leq -2.8 \cdot 10^{+56}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}}}\\
\mathbf{elif}\;\mathsf{min}\left(Ev, EAccept\right) \leq -6.5 \cdot 10^{-126}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_1 - mu}{KbT}}}\\
\mathbf{elif}\;\mathsf{min}\left(Ev, EAccept\right) \leq -1.1 \cdot 10^{-262}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\mathsf{min}\left(Ev, EAccept\right) \leq 3.8 \cdot 10^{-263}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_1\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if Ev < -2.80000000000000008e56Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.2%
Applied rewrites69.2%
if -2.80000000000000008e56 < Ev < -6.50000000000000014e-126Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.2%
Applied rewrites64.2%
if -6.50000000000000014e-126 < Ev < -1.09999999999999994e-262 or 3.80000000000000005e-263 < Ev Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
if -1.09999999999999994e-262 < Ev < 3.80000000000000005e-263Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- t_0 mu) KbT))))))
(t_2 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_3
(+
t_2
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_3 -1e-278)
t_1
(if (<= t_3 0.0)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(if (<= t_3 5e-78)
t_1
(+ t_2 (/ NaChar (+ 1.0 (exp (/ (fmax Ev 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 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT))));
double t_2 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_3 = t_2 + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_3 <= -1e-278) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_3 <= 5e-78) {
tmp = t_1;
} else {
tmp = t_2 + (NaChar / (1.0 + exp((fmax(Ev, 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) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((t_0 - mu) / kbt))))
t_2 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_3 = t_2 + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_3 <= (-1d-278)) then
tmp = t_1
else if (t_3 <= 0.0d0) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else if (t_3 <= 5d-78) then
tmp = t_1
else
tmp = t_2 + (nachar / (1.0d0 + exp((fmax(ev, 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 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((t_0 - mu) / KbT))));
double t_2 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_3 = t_2 + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_3 <= -1e-278) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_3 <= 5e-78) {
tmp = t_1;
} else {
tmp = t_2 + (NaChar / (1.0 + Math.exp((fmax(Ev, EAccept) / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((t_0 - mu) / KbT)))) t_2 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_3 = t_2 + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_3 <= -1e-278: tmp = t_1 elif t_3 <= 0.0: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) elif t_3 <= 5e-78: tmp = t_1 else: tmp = t_2 + (NaChar / (1.0 + math.exp((fmax(Ev, EAccept) / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 - mu) / KbT))))) t_2 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_3 = Float64(t_2 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_3 <= -1e-278) tmp = t_1; elseif (t_3 <= 0.0) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); elseif (t_3 <= 5e-78) tmp = t_1; else tmp = Float64(t_2 + Float64(NaChar / Float64(1.0 + exp(Float64(fmax(Ev, EAccept) / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT)))); t_2 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_3 = t_2 + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_3 <= -1e-278) tmp = t_1; elseif (t_3 <= 0.0) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); elseif (t_3 <= 5e-78) tmp = t_1; else tmp = t_2 + (NaChar / (1.0 + exp((max(Ev, EAccept) / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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$3 = N[(t$95$2 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e-278], t$95$1, If[LessEqual[t$95$3, 0.0], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e-78], t$95$1, N[(t$95$2 + N[(NaChar / N[(1.0 + N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_0 - mu}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_3 := t\_2 + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-78}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \frac{NaChar}{1 + e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}}}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999938e-279 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))))) < 4.9999999999999996e-78Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.2%
Applied rewrites64.2%
if -9.99999999999999938e-279 < (+.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
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 4.9999999999999996e-78 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (fmin Ev EAccept) mu) KbT))))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_2 -1e-278)
t_1
(if (<= t_2 0.0)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(if (<= t_2 1e+108)
t_1
(+
(/ NdChar (+ 1.0 (exp (/ Vef KbT))))
(/ NaChar (+ 1.0 (exp (/ (- t_0 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 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((fmin(Ev, EAccept) - mu) / KbT))));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-278) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_2 <= 1e+108) {
tmp = t_1;
} else {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp(((t_0 - 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((fmin(ev, eaccept) - mu) / kbt))))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_2 <= (-1d-278)) then
tmp = t_1
else if (t_2 <= 0.0d0) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else if (t_2 <= 1d+108) then
tmp = t_1
else
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (nachar / (1.0d0 + exp(((t_0 - 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 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((fmin(Ev, EAccept) - mu) / KbT))));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-278) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else if (t_2 <= 1e+108) {
tmp = t_1;
} else {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (NaChar / (1.0 + Math.exp(((t_0 - mu) / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((fmin(Ev, EAccept) - mu) / KbT)))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_2 <= -1e-278: tmp = t_1 elif t_2 <= 0.0: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) elif t_2 <= 1e+108: tmp = t_1 else: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (NaChar / (1.0 + math.exp(((t_0 - mu) / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(fmin(Ev, EAccept) - mu) / KbT))))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -1e-278) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); elseif (t_2 <= 1e+108) tmp = t_1; else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 - mu) / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((min(Ev, EAccept) - mu) / KbT)))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -1e-278) tmp = t_1; elseif (t_2 <= 0.0) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); elseif (t_2 <= 1e+108) tmp = t_1; else tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[Min[Ev, EAccept], $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-278], t$95$1, If[LessEqual[t$95$2, 0.0], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+108], t$95$1, N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right) - mu}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_0 - mu}{KbT}}}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999938e-279 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))))) < 1e108Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.2%
Applied rewrites64.2%
Taylor expanded in Vef around 0
Applied rewrites59.7%
if -9.99999999999999938e-279 < (+.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
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 1e108 < (+.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 Vef around inf
lower-/.f6470.1%
Applied rewrites70.1%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.9%
Applied rewrites64.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- t_0 mu) KbT))))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_2 -1e-278)
t_1
(if (<= t_2 0.0)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
t_1))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT))));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-278) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((t_0 - mu) / kbt))))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_2 <= (-1d-278)) then
tmp = t_1
else if (t_2 <= 0.0d0) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((t_0 - mu) / KbT))));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-278) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((t_0 - mu) / KbT)))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_2 <= -1e-278: tmp = t_1 elif t_2 <= 0.0: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 - mu) / KbT))))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -1e-278) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT)))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -1e-278) tmp = t_1; elseif (t_2 <= 0.0) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-278], t$95$1, If[LessEqual[t$95$2, 0.0], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_0 - mu}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999938e-279 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 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.2%
Applied rewrites64.2%
if -9.99999999999999938e-279 < (+.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
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- Ev mu) KbT))))))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_1 -1e-278)
t_0
(if (<= t_1 0.0)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_0))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((Ev - mu) / KbT))));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_1 <= -1e-278) {
tmp = t_0;
} else if (t_1 <= 0.0) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp(((ev - mu) / kbt))))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_1 <= (-1d-278)) then
tmp = t_0
else if (t_1 <= 0.0d0) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp(((Ev - mu) / KbT))));
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_1 <= -1e-278) {
tmp = t_0;
} else if (t_1 <= 0.0) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp(((Ev - mu) / KbT)))) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_1 <= -1e-278: tmp = t_0 elif t_1 <= 0.0: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Ev - mu) / KbT))))) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -1e-278) tmp = t_0; elseif (t_1 <= 0.0) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp(((Ev - mu) / KbT)))); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -1e-278) tmp = t_0; elseif (t_1 <= 0.0) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(Ev - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-278], t$95$0, If[LessEqual[t$95$1, 0.0], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Ev - mu}{KbT}}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-278}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999938e-279 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 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.2%
Applied rewrites64.2%
Taylor expanded in Vef around 0
Applied rewrites59.7%
if -9.99999999999999938e-279 < (+.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
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_1 -1e-126)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (fmin Ev EAccept) KbT)))))
(if (<= t_1 5e-105)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(+
(/ NdChar (- (exp (/ Vef KbT)) -1.0))
(/ NaChar (- (exp (/ (fmax Ev EAccept) KbT)) -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 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_1 <= -1e-126) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((fmin(Ev, EAccept) / KbT))));
} else if (t_1 <= 5e-105) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (NaChar / (exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_1 <= (-1d-126)) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp((fmin(ev, eaccept) / kbt))))
else if (t_1 <= 5d-105) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else
tmp = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + (nachar / (exp((fmax(ev, eaccept) / kbt)) - (-1.0d0)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_1 <= -1e-126) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp((fmin(Ev, EAccept) / KbT))));
} else if (t_1 <= 5e-105) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + (NaChar / (Math.exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_1 <= -1e-126: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp((fmin(Ev, EAccept) / KbT)))) elif t_1 <= 5e-105: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) else: tmp = (NdChar / (math.exp((Vef / KbT)) - -1.0)) + (NaChar / (math.exp((fmax(Ev, EAccept) / KbT)) - -1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -1e-126) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(fmin(Ev, EAccept) / KbT))))); elseif (t_1 <= 5e-105) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(fmax(Ev, EAccept) / KbT)) - -1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -1e-126) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((min(Ev, EAccept) / KbT)))); elseif (t_1 <= 5e-105) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); else tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (NaChar / (exp((max(Ev, EAccept) / KbT)) - -1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-126], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[Min[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-105], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}}}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + \frac{NaChar}{e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}} - -1}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.9999999999999995e-127Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.2%
Applied rewrites69.2%
Taylor expanded in Vef around inf
lower-/.f6449.3%
Applied rewrites49.3%
Taylor expanded in mu around inf
lower-/.f6449.0%
Applied rewrites49.0%
if -9.9999999999999995e-127 < (+.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.99999999999999963e-105Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 4.99999999999999963e-105 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
Taylor expanded in Vef around inf
lower-/.f6448.4%
Applied rewrites48.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
Applied rewrites48.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_1 -1e-126)
(+
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ (fmin Ev EAccept) KbT)))))
(if (<= t_1 5e-105)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(+
(/ NdChar (- (exp (/ Vef KbT)) -1.0))
(/ NaChar (- (exp (/ (fmax Ev EAccept) KbT)) -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 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_1 <= -1e-126) {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((fmin(Ev, EAccept) / KbT))));
} else if (t_1 <= 5e-105) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (NaChar / (exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_1 <= (-1d-126)) then
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + exp((fmin(ev, eaccept) / kbt))))
else if (t_1 <= 5d-105) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else
tmp = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + (nachar / (exp((fmax(ev, eaccept) / kbt)) - (-1.0d0)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_1 <= -1e-126) {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + Math.exp((fmin(Ev, EAccept) / KbT))));
} else if (t_1 <= 5e-105) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + (NaChar / (Math.exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_1 <= -1e-126: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + math.exp((fmin(Ev, EAccept) / KbT)))) elif t_1 <= 5e-105: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) else: tmp = (NdChar / (math.exp((Vef / KbT)) - -1.0)) + (NaChar / (math.exp((fmax(Ev, EAccept) / KbT)) - -1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -1e-126) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(fmin(Ev, EAccept) / KbT))))); elseif (t_1 <= 5e-105) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(fmax(Ev, EAccept) / KbT)) - -1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -1e-126) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((min(Ev, EAccept) / KbT)))); elseif (t_1 <= 5e-105) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); else tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (NaChar / (exp((max(Ev, EAccept) / KbT)) - -1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-126], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[Min[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-105], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}}}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + \frac{NaChar}{e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}} - -1}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.9999999999999995e-127Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.2%
Applied rewrites69.2%
Taylor expanded in EDonor around inf
lower-/.f6449.9%
Applied rewrites49.9%
if -9.9999999999999995e-127 < (+.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.99999999999999963e-105Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 4.99999999999999963e-105 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
Taylor expanded in Vef around inf
lower-/.f6448.4%
Applied rewrites48.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
Applied rewrites48.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1 (/ NdChar (- (exp (/ Vef KbT)) -1.0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_2 -1e-126)
(+ t_1 (/ NaChar (- (exp (/ (fmin Ev EAccept) KbT)) -1.0)))
(if (<= t_2 5e-105)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(+ t_1 (/ NaChar (- (exp (/ (fmax Ev EAccept) KbT)) -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 = fmin(Ev, EAccept) + Vef;
double t_1 = NdChar / (exp((Vef / KbT)) - -1.0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-126) {
tmp = t_1 + (NaChar / (exp((fmin(Ev, EAccept) / KbT)) - -1.0));
} else if (t_2 <= 5e-105) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = t_1 + (NaChar / (exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = ndchar / (exp((vef / kbt)) - (-1.0d0))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_2 <= (-1d-126)) then
tmp = t_1 + (nachar / (exp((fmin(ev, eaccept) / kbt)) - (-1.0d0)))
else if (t_2 <= 5d-105) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else
tmp = t_1 + (nachar / (exp((fmax(ev, eaccept) / kbt)) - (-1.0d0)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = NdChar / (Math.exp((Vef / KbT)) - -1.0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-126) {
tmp = t_1 + (NaChar / (Math.exp((fmin(Ev, EAccept) / KbT)) - -1.0));
} else if (t_2 <= 5e-105) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = t_1 + (NaChar / (Math.exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = NdChar / (math.exp((Vef / KbT)) - -1.0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_2 <= -1e-126: tmp = t_1 + (NaChar / (math.exp((fmin(Ev, EAccept) / KbT)) - -1.0)) elif t_2 <= 5e-105: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) else: tmp = t_1 + (NaChar / (math.exp((fmax(Ev, EAccept) / KbT)) - -1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -1e-126) tmp = Float64(t_1 + Float64(NaChar / Float64(exp(Float64(fmin(Ev, EAccept) / KbT)) - -1.0))); elseif (t_2 <= 5e-105) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); else tmp = Float64(t_1 + Float64(NaChar / Float64(exp(Float64(fmax(Ev, EAccept) / KbT)) - -1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = NdChar / (exp((Vef / KbT)) - -1.0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -1e-126) tmp = t_1 + (NaChar / (exp((min(Ev, EAccept) / KbT)) - -1.0)); elseif (t_2 <= 5e-105) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); else tmp = t_1 + (NaChar / (exp((max(Ev, EAccept) / KbT)) - -1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.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] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-126], N[(t$95$1 + N[(NaChar / N[(N[Exp[N[(N[Min[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-105], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(NaChar / N[(N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{e^{\frac{Vef}{KbT}} - -1}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;t\_1 + \frac{NaChar}{e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}} - -1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{NaChar}{e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}} - -1}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.9999999999999995e-127Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.2%
Applied rewrites69.2%
Taylor expanded in Vef around inf
lower-/.f6449.3%
Applied rewrites49.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6449.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6449.3%
Applied rewrites49.3%
if -9.9999999999999995e-127 < (+.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.99999999999999963e-105Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 4.99999999999999963e-105 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
Taylor expanded in Vef around inf
lower-/.f6448.4%
Applied rewrites48.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
Applied rewrites48.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1
(/ NaChar (+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -1e-126)
(+ (* 0.5 NdChar) t_1)
(if (<= t_2 5e-105)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
(+
(/ NdChar (- (exp (/ Vef KbT)) -1.0))
(/ NaChar (- (exp (/ (fmax Ev EAccept) KbT)) -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 = fmin(Ev, EAccept) + Vef;
double t_1 = NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -1e-126) {
tmp = (0.5 * NdChar) + t_1;
} else if (t_2 <= 5e-105) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (NaChar / (exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt)))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-1d-126)) then
tmp = (0.5d0 * ndchar) + t_1
else if (t_2 <= 5d-105) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else
tmp = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + (nachar / (exp((fmax(ev, eaccept) / kbt)) - (-1.0d0)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -1e-126) {
tmp = (0.5 * NdChar) + t_1;
} else if (t_2 <= 5e-105) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + (NaChar / (Math.exp((fmax(Ev, EAccept) / KbT)) - -1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -1e-126: tmp = (0.5 * NdChar) + t_1 elif t_2 <= 5e-105: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) else: tmp = (NdChar / (math.exp((Vef / KbT)) - -1.0)) + (NaChar / (math.exp((fmax(Ev, EAccept) / KbT)) - -1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if (t_2 <= -1e-126) tmp = Float64(Float64(0.5 * NdChar) + t_1); elseif (t_2 <= 5e-105) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + Float64(NaChar / Float64(exp(Float64(fmax(Ev, EAccept) / KbT)) - -1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -1e-126) tmp = (0.5 * NdChar) + t_1; elseif (t_2 <= 5e-105) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); else tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (NaChar / (exp((max(Ev, EAccept) / KbT)) - -1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-126], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 5e-105], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + \frac{NaChar}{e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}} - -1}\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.9999999999999995e-127Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.8%
Applied rewrites46.8%
if -9.9999999999999995e-127 < (+.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.99999999999999963e-105Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 4.99999999999999963e-105 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
Taylor expanded in Vef around inf
lower-/.f6448.4%
Applied rewrites48.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6448.4%
Applied rewrites48.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))
(t_1 (+ (* 0.5 NdChar) t_0))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_0)))
(if (<= t_2 -1e-126)
t_1
(if (<= t_2 1e+108)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_1))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_1 = (0.5 * NdChar) + t_0;
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0;
double tmp;
if (t_2 <= -1e-126) {
tmp = t_1;
} else if (t_2 <= 1e+108) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt)))
t_1 = (0.5d0 * ndchar) + t_0
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_0
if (t_2 <= (-1d-126)) then
tmp = t_1
else if (t_2 <= 1d+108) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)));
double t_1 = (0.5 * NdChar) + t_0;
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0;
double tmp;
if (t_2 <= -1e-126) {
tmp = t_1;
} else if (t_2 <= 1e+108) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))) t_1 = (0.5 * NdChar) + t_0 t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0 tmp = 0 if t_2 <= -1e-126: tmp = t_1 elif t_2 <= 1e+108: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))) t_1 = Float64(Float64(0.5 * NdChar) + t_0) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_0) tmp = 0.0 if (t_2 <= -1e-126) tmp = t_1; elseif (t_2 <= 1e+108) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))); t_1 = (0.5 * NdChar) + t_0; t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_0; tmp = 0.0; if (t_2 <= -1e-126) tmp = t_1; elseif (t_2 <= 1e+108) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-126], t$95$1, If[LessEqual[t$95$2, 1e+108], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
t_1 := 0.5 \cdot NdChar + t\_0\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_0\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+108}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.9999999999999995e-127 or 1e108 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.8%
Applied rewrites46.8%
if -9.9999999999999995e-127 < (+.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))))) < 1e108Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_1 (+ t_0 (* 0.5 NaChar)))
(t_2
(+
t_0
(/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
(if (<= t_2 -2e+16)
t_1
(if (<= t_2 1e+136)
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
t_1))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (0.5 * NaChar);
double t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_2 <= -2e+16) {
tmp = t_1;
} else if (t_2 <= 1e+136) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = t_0 + (0.5d0 * nachar)
t_2 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
if (t_2 <= (-2d+16)) then
tmp = t_1
else if (t_2 <= 1d+136) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (0.5 * NaChar);
double t_2 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
double tmp;
if (t_2 <= -2e+16) {
tmp = t_1;
} else if (t_2 <= 1e+136) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = t_0 + (0.5 * NaChar) t_2 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))) tmp = 0 if t_2 <= -2e+16: tmp = t_1 elif t_2 <= 1e+136: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = Float64(t_0 + Float64(0.5 * NaChar)) t_2 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -2e+16) tmp = t_1; elseif (t_2 <= 1e+136) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = t_0 + (0.5 * NaChar); t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -2e+16) tmp = t_1; elseif (t_2 <= 1e+136) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+16], t$95$1, If[LessEqual[t$95$2, 1e+136], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := t\_0 + 0.5 \cdot NaChar\\
t_2 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+136}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2e16 or 1.00000000000000006e136 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
if -2e16 < (+.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.00000000000000006e136Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (fmin Ev EAccept) Vef))
(t_1 (+ (/ NdChar 2.0) (/ NaChar (+ 1.0 (exp (/ (- t_0 mu) KbT))))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/
NaChar
(+ 1.0 (exp (/ (+ (+ t_0 (fmax Ev EAccept)) (- mu)) KbT)))))))
(if (<= t_2 -1e-126)
t_1
(if (<= t_2 5e+123)
(/ NaChar (+ 1.0 (exp (/ (- (+ (fmax Ev EAccept) t_0) mu) KbT))))
t_1))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / 2.0) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT))));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-126) {
tmp = t_1;
} else if (t_2 <= 5e+123) {
tmp = NaChar / (1.0 + exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(ev, eaccept) + vef
t_1 = (ndchar / 2.0d0) + (nachar / (1.0d0 + exp(((t_0 - mu) / kbt))))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp((((t_0 + fmax(ev, eaccept)) + -mu) / kbt))))
if (t_2 <= (-1d-126)) then
tmp = t_1
else if (t_2 <= 5d+123) then
tmp = nachar / (1.0d0 + exp((((fmax(ev, eaccept) + t_0) - mu) / kbt)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = fmin(Ev, EAccept) + Vef;
double t_1 = (NdChar / 2.0) + (NaChar / (1.0 + Math.exp(((t_0 - mu) / KbT))));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT))));
double tmp;
if (t_2 <= -1e-126) {
tmp = t_1;
} else if (t_2 <= 5e+123) {
tmp = NaChar / (1.0 + Math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT)));
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = fmin(Ev, EAccept) + Vef t_1 = (NdChar / 2.0) + (NaChar / (1.0 + math.exp(((t_0 - mu) / KbT)))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp((((t_0 + fmax(Ev, EAccept)) + -mu) / KbT)))) tmp = 0 if t_2 <= -1e-126: tmp = t_1 elif t_2 <= 5e+123: tmp = NaChar / (1.0 + math.exp((((fmax(Ev, EAccept) + t_0) - mu) / KbT))) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(fmin(Ev, EAccept) + Vef) t_1 = Float64(Float64(NdChar / 2.0) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 - mu) / KbT))))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(t_0 + fmax(Ev, EAccept)) + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -1e-126) tmp = t_1; elseif (t_2 <= 5e+123) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(fmax(Ev, EAccept) + t_0) - mu) / KbT)))); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = min(Ev, EAccept) + Vef; t_1 = (NdChar / 2.0) + (NaChar / (1.0 + exp(((t_0 - mu) / KbT)))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp((((t_0 + max(Ev, EAccept)) + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -1e-126) tmp = t_1; elseif (t_2 <= 5e+123) tmp = NaChar / (1.0 + exp((((max(Ev, EAccept) + t_0) - mu) / KbT))); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Min[Ev, EAccept], $MachinePrecision] + Vef), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / 2.0), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(t$95$0 + N[Max[Ev, EAccept], $MachinePrecision]), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-126], t$95$1, If[LessEqual[t$95$2, 5e+123], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[Max[Ev, EAccept], $MachinePrecision] + t$95$0), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(Ev, EAccept\right) + Vef\\
t_1 := \frac{NdChar}{2} + \frac{NaChar}{1 + e^{\frac{t\_0 - mu}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(t\_0 + \mathsf{max}\left(Ev, EAccept\right)\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+123}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\mathsf{max}\left(Ev, EAccept\right) + t\_0\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.9999999999999995e-127 or 4.99999999999999974e123 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.4%
Applied rewrites69.4%
Taylor expanded in EAccept around 0
lower--.f64N/A
lower-+.f6464.2%
Applied rewrites64.2%
Taylor expanded in KbT around inf
Applied rewrites43.1%
if -9.9999999999999995e-127 < (+.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.99999999999999974e123Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= NdChar 1.32e+88) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT)))) (+ (/ NdChar (+ 1.0 (exp (/ (- (+ Vef mu) Ec) KbT)))) (* 0.5 NaChar))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (NdChar <= 1.32e+88) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)))) + (0.5 * NaChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (ndchar <= 1.32d+88) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = (ndchar / (1.0d0 + exp((((vef + mu) - ec) / kbt)))) + (0.5d0 * nachar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (NdChar <= 1.32e+88) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = (NdChar / (1.0 + Math.exp((((Vef + mu) - Ec) / KbT)))) + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if NdChar <= 1.32e+88: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = (NdChar / (1.0 + math.exp((((Vef + mu) - Ec) / KbT)))) + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (NdChar <= 1.32e+88) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(Vef + mu) - Ec) / KbT)))) + Float64(0.5 * NaChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (NdChar <= 1.32e+88) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = (NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)))) + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NdChar, 1.32e+88], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(Vef + mu), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;NdChar \leq 1.32 \cdot 10^{+88}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(Vef + mu\right) - Ec}{KbT}}} + 0.5 \cdot NaChar\\
\end{array}
if NdChar < 1.3200000000000001e88Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
if 1.3200000000000001e88 < NdChar Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in EDonor around 0
lower--.f64N/A
lower-+.f6442.7%
Applied rewrites42.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= KbT -2.15e+182) (+ (/ NdChar (- (exp (/ (- mu Ec) KbT)) -1.0)) (* 0.5 NaChar)) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -2.15e+182) {
tmp = (NdChar / (exp(((mu - Ec) / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-2.15d+182)) then
tmp = (ndchar / (exp(((mu - ec) / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
else
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -2.15e+182) {
tmp = (NdChar / (Math.exp(((mu - Ec) / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -2.15e+182: tmp = (NdChar / (math.exp(((mu - Ec) / KbT)) - -1.0)) + (0.5 * NaChar) else: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -2.15e+182) tmp = Float64(Float64(NdChar / Float64(exp(Float64(Float64(mu - Ec) / KbT)) - -1.0)) + Float64(0.5 * NaChar)); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -2.15e+182) tmp = (NdChar / (exp(((mu - Ec) / KbT)) - -1.0)) + (0.5 * NaChar); else tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -2.15e+182], N[(N[(NdChar / N[(N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;KbT \leq -2.15 \cdot 10^{+182}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu - Ec}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\end{array}
if KbT < -2.1500000000000001e182Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in EDonor around 0
lower--.f64N/A
lower-+.f6442.7%
Applied rewrites42.7%
Taylor expanded in Vef around 0
Applied rewrites39.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6439.5%
Applied rewrites39.5%
if -2.1500000000000001e182 < KbT Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= KbT -2.15e+182) (+ (/ NdChar (- (exp (/ mu KbT)) -1.0)) (* 0.5 NaChar)) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -2.15e+182) {
tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (kbt <= (-2.15d+182)) then
tmp = (ndchar / (exp((mu / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
else
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -2.15e+182) {
tmp = (NdChar / (Math.exp((mu / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if KbT <= -2.15e+182: tmp = (NdChar / (math.exp((mu / KbT)) - -1.0)) + (0.5 * NaChar) else: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -2.15e+182) tmp = Float64(Float64(NdChar / Float64(exp(Float64(mu / KbT)) - -1.0)) + Float64(0.5 * NaChar)); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (KbT <= -2.15e+182) tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (0.5 * NaChar); else tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -2.15e+182], N[(N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;KbT \leq -2.15 \cdot 10^{+182}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\end{array}
if KbT < -2.1500000000000001e182Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in Vef around inf
lower-/.f6434.2%
Applied rewrites34.2%
Taylor expanded in mu around inf
lower-/.f6434.7%
Applied rewrites34.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6434.7%
Applied rewrites34.7%
if -2.1500000000000001e182 < KbT Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.6%
Applied rewrites59.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= (fmax Ev EAccept) 2.85e-264)
(+ (/ NdChar 2.0) (/ NaChar (+ 1.0 (exp (/ (fmin Ev EAccept) KbT)))))
(if (<= (fmax Ev EAccept) 4.3e+133)
(+ (/ NdChar (- (exp (/ Vef KbT)) -1.0)) (* 0.5 NaChar))
(+ (/ NdChar 2.0) (/ NaChar (+ 1.0 (exp (/ (fmax Ev EAccept) KbT))))))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (fmax(Ev, EAccept) <= 2.85e-264) {
tmp = (NdChar / 2.0) + (NaChar / (1.0 + exp((fmin(Ev, EAccept) / KbT))));
} else if (fmax(Ev, EAccept) <= 4.3e+133) {
tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = (NdChar / 2.0) + (NaChar / (1.0 + exp((fmax(Ev, 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) :: tmp
if (fmax(ev, eaccept) <= 2.85d-264) then
tmp = (ndchar / 2.0d0) + (nachar / (1.0d0 + exp((fmin(ev, eaccept) / kbt))))
else if (fmax(ev, eaccept) <= 4.3d+133) then
tmp = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
else
tmp = (ndchar / 2.0d0) + (nachar / (1.0d0 + exp((fmax(ev, 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 tmp;
if (fmax(Ev, EAccept) <= 2.85e-264) {
tmp = (NdChar / 2.0) + (NaChar / (1.0 + Math.exp((fmin(Ev, EAccept) / KbT))));
} else if (fmax(Ev, EAccept) <= 4.3e+133) {
tmp = (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = (NdChar / 2.0) + (NaChar / (1.0 + Math.exp((fmax(Ev, EAccept) / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if fmax(Ev, EAccept) <= 2.85e-264: tmp = (NdChar / 2.0) + (NaChar / (1.0 + math.exp((fmin(Ev, EAccept) / KbT)))) elif fmax(Ev, EAccept) <= 4.3e+133: tmp = (NdChar / (math.exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar) else: tmp = (NdChar / 2.0) + (NaChar / (1.0 + math.exp((fmax(Ev, EAccept) / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (fmax(Ev, EAccept) <= 2.85e-264) tmp = Float64(Float64(NdChar / 2.0) + Float64(NaChar / Float64(1.0 + exp(Float64(fmin(Ev, EAccept) / KbT))))); elseif (fmax(Ev, EAccept) <= 4.3e+133) tmp = Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + Float64(0.5 * NaChar)); else tmp = Float64(Float64(NdChar / 2.0) + Float64(NaChar / Float64(1.0 + exp(Float64(fmax(Ev, EAccept) / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (max(Ev, EAccept) <= 2.85e-264) tmp = (NdChar / 2.0) + (NaChar / (1.0 + exp((min(Ev, EAccept) / KbT)))); elseif (max(Ev, EAccept) <= 4.3e+133) tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar); else tmp = (NdChar / 2.0) + (NaChar / (1.0 + exp((max(Ev, EAccept) / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[N[Max[Ev, EAccept], $MachinePrecision], 2.85e-264], N[(N[(NdChar / 2.0), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[Min[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[Ev, EAccept], $MachinePrecision], 4.3e+133], N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / 2.0), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(Ev, EAccept\right) \leq 2.85 \cdot 10^{-264}:\\
\;\;\;\;\frac{NdChar}{2} + \frac{NaChar}{1 + e^{\frac{\mathsf{min}\left(Ev, EAccept\right)}{KbT}}}\\
\mathbf{elif}\;\mathsf{max}\left(Ev, EAccept\right) \leq 4.3 \cdot 10^{+133}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{2} + \frac{NaChar}{1 + e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}}}\\
\end{array}
if EAccept < 2.8500000000000002e-264Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.2%
Applied rewrites69.2%
Taylor expanded in KbT around inf
Applied rewrites35.4%
if 2.8500000000000002e-264 < EAccept < 4.29999999999999994e133Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in Vef around inf
lower-/.f6434.2%
Applied rewrites34.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6434.2%
Applied rewrites34.2%
if 4.29999999999999994e133 < EAccept Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
Taylor expanded in KbT around inf
Applied rewrites35.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar 2.0)
(/ NaChar (+ 1.0 (exp (/ (fmax Ev EAccept) KbT)))))))
(if (<= (fmax Ev EAccept) -1.96e-118)
t_0
(if (<= (fmax Ev EAccept) 3e+135)
(+ (/ NdChar (+ 1.0 (exp (/ EDonor KbT)))) (* 0.5 NaChar))
t_0))))double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / 2.0) + (NaChar / (1.0 + exp((fmax(Ev, EAccept) / KbT))));
double tmp;
if (fmax(Ev, EAccept) <= -1.96e-118) {
tmp = t_0;
} else if (fmax(Ev, EAccept) <= 3e+135) {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (0.5 * NaChar);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / 2.0d0) + (nachar / (1.0d0 + exp((fmax(ev, eaccept) / kbt))))
if (fmax(ev, eaccept) <= (-1.96d-118)) then
tmp = t_0
else if (fmax(ev, eaccept) <= 3d+135) then
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (0.5d0 * nachar)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / 2.0) + (NaChar / (1.0 + Math.exp((fmax(Ev, EAccept) / KbT))));
double tmp;
if (fmax(Ev, EAccept) <= -1.96e-118) {
tmp = t_0;
} else if (fmax(Ev, EAccept) <= 3e+135) {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (0.5 * NaChar);
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / 2.0) + (NaChar / (1.0 + math.exp((fmax(Ev, EAccept) / KbT)))) tmp = 0 if fmax(Ev, EAccept) <= -1.96e-118: tmp = t_0 elif fmax(Ev, EAccept) <= 3e+135: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (0.5 * NaChar) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / 2.0) + Float64(NaChar / Float64(1.0 + exp(Float64(fmax(Ev, EAccept) / KbT))))) tmp = 0.0 if (fmax(Ev, EAccept) <= -1.96e-118) tmp = t_0; elseif (fmax(Ev, EAccept) <= 3e+135) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(0.5 * NaChar)); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / 2.0) + (NaChar / (1.0 + exp((max(Ev, EAccept) / KbT)))); tmp = 0.0; if (max(Ev, EAccept) <= -1.96e-118) tmp = t_0; elseif (max(Ev, EAccept) <= 3e+135) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (0.5 * NaChar); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / 2.0), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[Max[Ev, EAccept], $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[Ev, EAccept], $MachinePrecision], -1.96e-118], t$95$0, If[LessEqual[N[Max[Ev, EAccept], $MachinePrecision], 3e+135], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{NdChar}{2} + \frac{NaChar}{1 + e^{\frac{\mathsf{max}\left(Ev, EAccept\right)}{KbT}}}\\
\mathbf{if}\;\mathsf{max}\left(Ev, EAccept\right) \leq -1.96 \cdot 10^{-118}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\mathsf{max}\left(Ev, EAccept\right) \leq 3 \cdot 10^{+135}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if EAccept < -1.96e-118 or 3e135 < EAccept Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6468.2%
Applied rewrites68.2%
Taylor expanded in KbT around inf
Applied rewrites35.1%
if -1.96e-118 < EAccept < 3e135Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in EDonor around inf
lower-/.f6435.2%
Applied rewrites35.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= (fmin Ev EAccept) -9.8e+42) (+ (/ NdChar (- (exp (/ Vef KbT)) -1.0)) (* 0.5 NaChar)) (+ (/ NdChar (- (exp (/ mu KbT)) -1.0)) (* 0.5 NaChar))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (fmin(Ev, EAccept) <= -9.8e+42) {
tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (0.5 * NaChar);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (fmin(ev, eaccept) <= (-9.8d+42)) then
tmp = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
else
tmp = (ndchar / (exp((mu / kbt)) - (-1.0d0))) + (0.5d0 * nachar)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (fmin(Ev, EAccept) <= -9.8e+42) {
tmp = (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar);
} else {
tmp = (NdChar / (Math.exp((mu / KbT)) - -1.0)) + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if fmin(Ev, EAccept) <= -9.8e+42: tmp = (NdChar / (math.exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar) else: tmp = (NdChar / (math.exp((mu / KbT)) - -1.0)) + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (fmin(Ev, EAccept) <= -9.8e+42) tmp = Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + Float64(0.5 * NaChar)); else tmp = Float64(Float64(NdChar / Float64(exp(Float64(mu / KbT)) - -1.0)) + Float64(0.5 * NaChar)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (min(Ev, EAccept) <= -9.8e+42) tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar); else tmp = (NdChar / (exp((mu / KbT)) - -1.0)) + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[N[Min[Ev, EAccept], $MachinePrecision], -9.8e+42], N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(Ev, EAccept\right) \leq -9.8 \cdot 10^{+42}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} - -1} + 0.5 \cdot NaChar\\
\end{array}
if Ev < -9.8000000000000004e42Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in Vef around inf
lower-/.f6434.2%
Applied rewrites34.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6434.2%
Applied rewrites34.2%
if -9.8000000000000004e42 < Ev Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in Vef around inf
lower-/.f6434.2%
Applied rewrites34.2%
Taylor expanded in mu around inf
lower-/.f6434.7%
Applied rewrites34.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6434.7%
Applied rewrites34.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (- (exp (/ Vef KbT)) -1.0)) (* 0.5 NaChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (exp((Vef / KbT)) - -1.0)) + (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 = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + (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 (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar);
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (math.exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar)
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + Float64(0.5 * NaChar)) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (exp((Vef / KbT)) - -1.0)) + (0.5 * NaChar); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]
\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + 0.5 \cdot NaChar
Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6446.3%
Applied rewrites46.3%
Taylor expanded in Vef around inf
lower-/.f6434.2%
Applied rewrites34.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6434.2%
Applied rewrites34.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* (+ NaChar NdChar) 0.5))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NaChar + NdChar) * 0.5;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (nachar + ndchar) * 0.5d0
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NaChar + NdChar) * 0.5;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NaChar + NdChar) * 0.5
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NaChar + NdChar) * 0.5) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NaChar + NdChar) * 0.5; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]
\left(NaChar + NdChar\right) \cdot 0.5
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.3%
Applied rewrites27.3%
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6427.3%
Applied rewrites27.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= NaChar -1.15e+52) (* 0.5 NaChar) (if (<= NaChar 1.95e+36) (* 0.5 NdChar) (* 0.5 NaChar))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (NaChar <= -1.15e+52) {
tmp = 0.5 * NaChar;
} else if (NaChar <= 1.95e+36) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (nachar <= (-1.15d+52)) then
tmp = 0.5d0 * nachar
else if (nachar <= 1.95d+36) then
tmp = 0.5d0 * ndchar
else
tmp = 0.5d0 * nachar
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (NaChar <= -1.15e+52) {
tmp = 0.5 * NaChar;
} else if (NaChar <= 1.95e+36) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if NaChar <= -1.15e+52: tmp = 0.5 * NaChar elif NaChar <= 1.95e+36: tmp = 0.5 * NdChar else: tmp = 0.5 * NaChar return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (NaChar <= -1.15e+52) tmp = Float64(0.5 * NaChar); elseif (NaChar <= 1.95e+36) tmp = Float64(0.5 * NdChar); else tmp = Float64(0.5 * NaChar); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (NaChar <= -1.15e+52) tmp = 0.5 * NaChar; elseif (NaChar <= 1.95e+36) tmp = 0.5 * NdChar; else tmp = 0.5 * NaChar; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NaChar, -1.15e+52], N[(0.5 * NaChar), $MachinePrecision], If[LessEqual[NaChar, 1.95e+36], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;NaChar \leq -1.15 \cdot 10^{+52}:\\
\;\;\;\;0.5 \cdot NaChar\\
\mathbf{elif}\;NaChar \leq 1.95 \cdot 10^{+36}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NaChar\\
\end{array}
if NaChar < -1.15e52 or 1.9500000000000001e36 < NaChar Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.3%
Applied rewrites27.3%
Taylor expanded in NdChar around 0
lower-*.f6417.9%
Applied rewrites17.9%
if -1.15e52 < NaChar < 1.9500000000000001e36Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.3%
Applied rewrites27.3%
Taylor expanded in NdChar around 0
lower-*.f6417.9%
Applied rewrites17.9%
Taylor expanded in NdChar around inf
lower-*.f6418.6%
Applied rewrites18.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 NaChar))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * nachar
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * NaChar
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * NaChar) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * NaChar; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar), $MachinePrecision]
0.5 \cdot NaChar
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.3%
Applied rewrites27.3%
Taylor expanded in NdChar around 0
lower-*.f6417.9%
Applied rewrites17.9%
herbie shell --seed 2025183
(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))))))