
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
Initial program 100.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))
(t_3 (+ t_1 t_2)))
(if (<= t_3 -5e-264)
(+ t_1 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
(if (<= t_3 2e-178)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+ (/ NdChar (+ 1.0 (exp (/ (- Ec) 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 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT)));
double t_3 = t_1 + t_2;
double tmp;
if (t_3 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT))));
} else if (t_3 <= 2e-178) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = nachar / (1.0d0 + exp(((t_0 + -mu) / kbt)))
t_3 = t_1 + t_2
if (t_3 <= (-5d-264)) then
tmp = t_1 + (nachar / (1.0d0 + exp((eaccept / kbt))))
else if (t_3 <= 2d-178) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((-ec / kbt)))) + 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 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT)));
double t_3 = t_1 + t_2;
double tmp;
if (t_3 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else if (t_3 <= 2e-178) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((-Ec / KbT)))) + t_2;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT))) t_3 = t_1 + t_2 tmp = 0 if t_3 <= -5e-264: tmp = t_1 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) elif t_3 <= 2e-178: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((-Ec / KbT)))) + t_2 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) 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(t_0 + Float64(-mu)) / KbT)))) t_3 = Float64(t_1 + t_2) tmp = 0.0 if (t_3 <= -5e-264) tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); elseif (t_3 <= 2e-178) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Ec) / KbT)))) + t_2); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT))); t_3 = t_1 + t_2; tmp = 0.0; if (t_3 <= -5e-264) tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT)))); elseif (t_3 <= 2e-178) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + t_2; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-264], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-178], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-Ec) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
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{t\_0 + \left(-mu\right)}{KbT}}}\\
t_3 := t\_1 + t\_2\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-264}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-178}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-Ec}{KbT}}} + t\_2\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000001e-264Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
if -5.0000000000000001e-264 < (+.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.9999999999999999e-178Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 1.9999999999999999e-178 < (+.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 Ec around inf
mul-1-negN/A
lower-neg.f6469.0
Applied rewrites69.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))
(t_3 (+ t_1 t_2)))
(if (<= t_3 -5e-264)
(+ t_1 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
(if (<= t_3 0.0)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+ (/ NdChar (+ 1.0 (exp (/ 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 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT)));
double t_3 = t_1 + t_2;
double tmp;
if (t_3 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT))));
} else if (t_3 <= 0.0) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = nachar / (1.0d0 + exp(((t_0 + -mu) / kbt)))
t_3 = t_1 + t_2
if (t_3 <= (-5d-264)) then
tmp = t_1 + (nachar / (1.0d0 + exp((eaccept / kbt))))
else if (t_3 <= 0.0d0) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + 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 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT)));
double t_3 = t_1 + t_2;
double tmp;
if (t_3 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else if (t_3 <= 0.0) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_2;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT))) t_3 = t_1 + t_2 tmp = 0 if t_3 <= -5e-264: tmp = t_1 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) elif t_3 <= 0.0: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_2 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) 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(t_0 + Float64(-mu)) / KbT)))) t_3 = Float64(t_1 + t_2) tmp = 0.0 if (t_3 <= -5e-264) tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); elseif (t_3 <= 0.0) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_2); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT))); t_3 = t_1 + t_2; tmp = 0.0; if (t_3 <= -5e-264) tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT)))); elseif (t_3 <= 0.0) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_2; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-264], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
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{t\_0 + \left(-mu\right)}{KbT}}}\\
t_3 := t\_1 + t\_2\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-264}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_2\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000001e-264Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
if -5.0000000000000001e-264 < (+.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
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if -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.8
Applied rewrites69.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (+ t_1 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))))
(if (<= t_2 -5e-264)
(+ t_1 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
(if (<= t_2 9.5e-257)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+ t_1 (/ NaChar (+ 1.0 (exp (/ Ev KbT)))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT))));
} else if (t_2 <= 9.5e-257) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = t_1 + (NaChar / (1.0 + exp((Ev / 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 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = t_1 + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))
if (t_2 <= (-5d-264)) then
tmp = t_1 + (nachar / (1.0d0 + exp((eaccept / kbt))))
else if (t_2 <= 9.5d-257) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = t_1 + (nachar / (1.0d0 + exp((ev / 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 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else if (t_2 <= 9.5e-257) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = t_1 + (NaChar / (1.0 + Math.exp((Ev / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = t_1 + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT)))) tmp = 0 if t_2 <= -5e-264: tmp = t_1 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) elif t_2 <= 9.5e-257: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = t_1 + (NaChar / (1.0 + math.exp((Ev / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_2 = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -5e-264) tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); elseif (t_2 <= 9.5e-257) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -5e-264) tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT)))); elseif (t_2 <= 9.5e-257) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = t_1 + (NaChar / (1.0 + exp((Ev / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-264], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 9.5e-257], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_2 := t\_1 + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-264}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 9.5 \cdot 10^{-257}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000001e-264Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
if -5.0000000000000001e-264 < (+.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.49999999999999941e-257Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 9.49999999999999941e-257 < (+.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 Ev around inf
lower-/.f6469.3
Applied rewrites69.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (+ t_1 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))))
(if (<= t_2 -5e-264)
(+ t_1 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
(if (<= t_2 2e-178)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+
(/ NdChar (+ 1.0 (exp (/ (- Ec) KbT))))
(/ NaChar (+ (exp (/ (- (+ Ev Vef) mu) KbT)) 1.0)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT))));
} else if (t_2 <= 2e-178) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (NaChar / (exp((((Ev + Vef) - mu) / KbT)) + 1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = t_1 + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))
if (t_2 <= (-5d-264)) then
tmp = t_1 + (nachar / (1.0d0 + exp((eaccept / kbt))))
else if (t_2 <= 2d-178) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((-ec / kbt)))) + (nachar / (exp((((ev + vef) - mu) / kbt)) + 1.0d0))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -5e-264) {
tmp = t_1 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else if (t_2 <= 2e-178) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((-Ec / KbT)))) + (NaChar / (Math.exp((((Ev + Vef) - mu) / KbT)) + 1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = t_1 + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT)))) tmp = 0 if t_2 <= -5e-264: tmp = t_1 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) elif t_2 <= 2e-178: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((-Ec / KbT)))) + (NaChar / (math.exp((((Ev + Vef) - mu) / KbT)) + 1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_2 = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -5e-264) tmp = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); elseif (t_2 <= 2e-178) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Ec) / KbT)))) + Float64(NaChar / Float64(exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT)) + 1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -5e-264) tmp = t_1 + (NaChar / (1.0 + exp((EAccept / KbT)))); elseif (t_2 <= 2e-178) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (NaChar / (exp((((Ev + Vef) - mu) / KbT)) + 1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-264], N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-178], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-Ec) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_2 := t\_1 + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-264}:\\
\;\;\;\;t\_1 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-178}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-Ec}{KbT}}} + \frac{NaChar}{e^{\frac{\left(Ev + Vef\right) - mu}{KbT}} + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000001e-264Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
if -5.0000000000000001e-264 < (+.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.9999999999999999e-178Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 1.9999999999999999e-178 < (+.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 Ec around inf
mul-1-negN/A
lower-neg.f6469.0
Applied rewrites69.0%
Taylor expanded in EAccept around 0
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-+.f6462.8
Applied rewrites62.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (+ t_1 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))))
(if (<= t_2 -2e+154)
(+ t_1 (* 0.5 NaChar))
(if (<= t_2 -2e-226)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ (+ EAccept Vef) (- mu)) KbT)))))
(if (<= t_2 2e-178)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+
(/ NdChar (+ 1.0 (exp (/ (- Ec) KbT))))
(/ NaChar (+ (exp (/ (- (+ Ev Vef) mu) KbT)) 1.0))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -2e+154) {
tmp = t_1 + (0.5 * NaChar);
} else if (t_2 <= -2e-226) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((EAccept + Vef) + -mu) / KbT))));
} else if (t_2 <= 2e-178) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (NaChar / (exp((((Ev + Vef) - mu) / KbT)) + 1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = t_1 + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))
if (t_2 <= (-2d+154)) then
tmp = t_1 + (0.5d0 * nachar)
else if (t_2 <= (-2d-226)) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp((((eaccept + vef) + -mu) / kbt))))
else if (t_2 <= 2d-178) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((-ec / kbt)))) + (nachar / (exp((((ev + vef) - mu) / kbt)) + 1.0d0))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -2e+154) {
tmp = t_1 + (0.5 * NaChar);
} else if (t_2 <= -2e-226) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp((((EAccept + Vef) + -mu) / KbT))));
} else if (t_2 <= 2e-178) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((-Ec / KbT)))) + (NaChar / (Math.exp((((Ev + Vef) - mu) / KbT)) + 1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = t_1 + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT)))) tmp = 0 if t_2 <= -2e+154: tmp = t_1 + (0.5 * NaChar) elif t_2 <= -2e-226: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp((((EAccept + Vef) + -mu) / KbT)))) elif t_2 <= 2e-178: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((-Ec / KbT)))) + (NaChar / (math.exp((((Ev + Vef) - mu) / KbT)) + 1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_2 = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -2e+154) tmp = Float64(t_1 + Float64(0.5 * NaChar)); elseif (t_2 <= -2e-226) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Vef) + Float64(-mu)) / KbT))))); elseif (t_2 <= 2e-178) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Ec) / KbT)))) + Float64(NaChar / Float64(exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT)) + 1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -2e+154) tmp = t_1 + (0.5 * NaChar); elseif (t_2 <= -2e-226) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((((EAccept + Vef) + -mu) / KbT)))); elseif (t_2 <= 2e-178) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (NaChar / (exp((((Ev + Vef) - mu) / KbT)) + 1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+154], N[(t$95$1 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-226], 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[(EAccept + Vef), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-178], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-Ec) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_2 := t\_1 + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+154}:\\
\;\;\;\;t\_1 + 0.5 \cdot NaChar\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-226}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(EAccept + Vef\right) + \left(-mu\right)}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-178}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-Ec}{KbT}}} + \frac{NaChar}{e^{\frac{\left(Ev + Vef\right) - mu}{KbT}} + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2.00000000000000007e154Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
if -2.00000000000000007e154 < (+.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.99999999999999984e-226Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6469.8
Applied rewrites69.8%
Taylor expanded in Ev around 0
lower-+.f6464.8
Applied rewrites64.8%
if -1.99999999999999984e-226 < (+.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.9999999999999999e-178Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 1.9999999999999999e-178 < (+.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 Ec around inf
mul-1-negN/A
lower-neg.f6469.0
Applied rewrites69.0%
Taylor expanded in EAccept around 0
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-+.f6462.8
Applied rewrites62.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))))
(if (<= t_1 -2e-131)
(+
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
(if (<= t_1 2e-178)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+
(/ NdChar (+ 1.0 (exp (/ (- Ec) KbT))))
(/ NaChar (+ (exp (/ (- (+ Ev Vef) mu) KbT)) 1.0)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_1 <= -2e-131) {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((EAccept / KbT))));
} else if (t_1 <= 2e-178) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (NaChar / (exp((((Ev + Vef) - mu) / KbT)) + 1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))
if (t_1 <= (-2d-131)) then
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + exp((eaccept / kbt))))
else if (t_1 <= 2d-178) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((-ec / kbt)))) + (nachar / (exp((((ev + vef) - mu) / kbt)) + 1.0d0))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_1 <= -2e-131) {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else if (t_1 <= 2e-178) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((-Ec / KbT)))) + (NaChar / (Math.exp((((Ev + Vef) - mu) / KbT)) + 1.0));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT)))) tmp = 0 if t_1 <= -2e-131: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + math.exp((EAccept / KbT)))) elif t_1 <= 2e-178: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (NdChar / (1.0 + math.exp((-Ec / KbT)))) + (NaChar / (math.exp((((Ev + Vef) - mu) / KbT)) + 1.0)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) 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(t_0 + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_1 <= -2e-131) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); elseif (t_1 <= 2e-178) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Ec) / KbT)))) + Float64(NaChar / Float64(exp(Float64(Float64(Float64(Ev + Vef) - mu) / KbT)) + 1.0))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT)))); tmp = 0.0; if (t_1 <= -2e-131) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((EAccept / KbT)))); elseif (t_1 <= 2e-178) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (NaChar / (exp((((Ev + Vef) - mu) / KbT)) + 1.0)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-131], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-178], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-Ec) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(N[(N[(Ev + Vef), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-131}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-178}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-Ec}{KbT}}} + \frac{NaChar}{e^{\frac{\left(Ev + Vef\right) - mu}{KbT}} + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2e-131Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in EDonor around inf
lower-/.f6450.6
Applied rewrites50.6%
if -2e-131 < (+.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.9999999999999999e-178Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 1.9999999999999999e-178 < (+.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 Ec around inf
mul-1-negN/A
lower-neg.f6469.0
Applied rewrites69.0%
Taylor expanded in EAccept around 0
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-+.f6462.8
Applied rewrites62.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))
(t_1
(+
(/ NdChar (+ (exp (/ (- (+ mu Vef) Ec) KbT)) 1.0))
(/ NaChar (+ 2.0 t_0)))))
(if (<= NdChar -1.02e+98)
t_1
(if (<= NdChar -4.3e+26)
(+
(/ NdChar (+ 1.0 (exp (/ Vef KbT))))
(/ NaChar (+ 1.0 (exp (/ Ev KbT)))))
(if (<= NdChar 8e+117) (/ NaChar (+ (exp t_0) 1.0)) t_1)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (((Ev + Vef) + EAccept) - mu) / KbT;
double t_1 = (NdChar / (exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (NaChar / (2.0 + t_0));
double tmp;
if (NdChar <= -1.02e+98) {
tmp = t_1;
} else if (NdChar <= -4.3e+26) {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp((Ev / KbT))));
} else if (NdChar <= 8e+117) {
tmp = NaChar / (exp(t_0) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((ev + vef) + eaccept) - mu) / kbt
t_1 = (ndchar / (exp((((mu + vef) - ec) / kbt)) + 1.0d0)) + (nachar / (2.0d0 + t_0))
if (ndchar <= (-1.02d+98)) then
tmp = t_1
else if (ndchar <= (-4.3d+26)) then
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (nachar / (1.0d0 + exp((ev / kbt))))
else if (ndchar <= 8d+117) then
tmp = nachar / (exp(t_0) + 1.0d0)
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 = (((Ev + Vef) + EAccept) - mu) / KbT;
double t_1 = (NdChar / (Math.exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (NaChar / (2.0 + t_0));
double tmp;
if (NdChar <= -1.02e+98) {
tmp = t_1;
} else if (NdChar <= -4.3e+26) {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (NaChar / (1.0 + Math.exp((Ev / KbT))));
} else if (NdChar <= 8e+117) {
tmp = NaChar / (Math.exp(t_0) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (((Ev + Vef) + EAccept) - mu) / KbT t_1 = (NdChar / (math.exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (NaChar / (2.0 + t_0)) tmp = 0 if NdChar <= -1.02e+98: tmp = t_1 elif NdChar <= -4.3e+26: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (NaChar / (1.0 + math.exp((Ev / KbT)))) elif NdChar <= 8e+117: tmp = NaChar / (math.exp(t_0) + 1.0) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT) t_1 = Float64(Float64(NdChar / Float64(exp(Float64(Float64(Float64(mu + Vef) - Ec) / KbT)) + 1.0)) + Float64(NaChar / Float64(2.0 + t_0))) tmp = 0.0 if (NdChar <= -1.02e+98) tmp = t_1; elseif (NdChar <= -4.3e+26) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))); elseif (NdChar <= 8e+117) tmp = Float64(NaChar / Float64(exp(t_0) + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (((Ev + Vef) + EAccept) - mu) / KbT; t_1 = (NdChar / (exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (NaChar / (2.0 + t_0)); tmp = 0.0; if (NdChar <= -1.02e+98) tmp = t_1; elseif (NdChar <= -4.3e+26) tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (NaChar / (1.0 + exp((Ev / KbT)))); elseif (NdChar <= 8e+117) tmp = NaChar / (exp(t_0) + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(N[Exp[N[(N[(N[(mu + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(2.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NdChar, -1.02e+98], t$95$1, If[LessEqual[NdChar, -4.3e+26], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, 8e+117], N[(NaChar / N[(N[Exp[t$95$0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\\
t_1 := \frac{NdChar}{e^{\frac{\left(mu + Vef\right) - Ec}{KbT}} + 1} + \frac{NaChar}{2 + t\_0}\\
\mathbf{if}\;NdChar \leq -1.02 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;NdChar \leq -4.3 \cdot 10^{+26}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{elif}\;NdChar \leq 8 \cdot 10^{+117}:\\
\;\;\;\;\frac{NaChar}{e^{t\_0} + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if NdChar < -1.02000000000000007e98 or 8.0000000000000004e117 < NdChar Initial program 100.0%
Taylor expanded in KbT around inf
associate--l+N/A
div-add-revN/A
div-addN/A
div-subN/A
sub-flipN/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-neg.f64N/A
lift-+.f64N/A
lift-/.f6460.1
Applied rewrites60.1%
Taylor expanded in EDonor around 0
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6454.6
Applied rewrites54.6%
if -1.02000000000000007e98 < NdChar < -4.2999999999999998e26Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6469.3
Applied rewrites69.3%
Taylor expanded in Vef around inf
lower-/.f6449.1
Applied rewrites49.1%
if -4.2999999999999998e26 < NdChar < 8.0000000000000004e117Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -2e-131)
(+
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
(if (<= t_2 1e+15)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+ (* 0.5 NdChar) t_1)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-131) {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((EAccept / KbT))));
} else if (t_2 <= 1e+15) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (0.5 * NdChar) + t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = nachar / (1.0d0 + exp(((t_0 + -mu) / kbt)))
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-2d-131)) then
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + exp((eaccept / kbt))))
else if (t_2 <= 1d+15) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (0.5d0 * ndchar) + t_1
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT)));
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -2e-131) {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
} else if (t_2 <= 1e+15) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (0.5 * NdChar) + t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT))) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -2e-131: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + math.exp((EAccept / KbT)))) elif t_2 <= 1e+15: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (0.5 * NdChar) + t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) t_1 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 + Float64(-mu)) / KbT)))) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if (t_2 <= -2e-131) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); elseif (t_2 <= 1e+15) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(0.5 * NdChar) + t_1); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT))); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -2e-131) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((EAccept / KbT)))); elseif (t_2 <= 1e+15) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (0.5 * NdChar) + t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-131], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+15], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-131}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;t\_2 \leq 10^{+15}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2e-131Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in EDonor around inf
lower-/.f6450.6
Applied rewrites50.6%
if -2e-131 < (+.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))))) < 1e15Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 1e15 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.0
Applied rewrites47.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))
(t_3 (+ t_1 t_2)))
(if (<= t_3 -1e+63)
(+ t_1 (* 0.5 NaChar))
(if (<= t_3 1e+15)
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0))
(+ (* 0.5 NdChar) t_2)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT)));
double t_3 = t_1 + t_2;
double tmp;
if (t_3 <= -1e+63) {
tmp = t_1 + (0.5 * NaChar);
} else if (t_3 <= 1e+15) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (0.5 * NdChar) + t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = nachar / (1.0d0 + exp(((t_0 + -mu) / kbt)))
t_3 = t_1 + t_2
if (t_3 <= (-1d+63)) then
tmp = t_1 + (0.5d0 * nachar)
else if (t_3 <= 1d+15) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = (0.5d0 * ndchar) + t_2
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT)));
double t_3 = t_1 + t_2;
double tmp;
if (t_3 <= -1e+63) {
tmp = t_1 + (0.5 * NaChar);
} else if (t_3 <= 1e+15) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = (0.5 * NdChar) + t_2;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT))) t_3 = t_1 + t_2 tmp = 0 if t_3 <= -1e+63: tmp = t_1 + (0.5 * NaChar) elif t_3 <= 1e+15: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = (0.5 * NdChar) + t_2 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) 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(t_0 + Float64(-mu)) / KbT)))) t_3 = Float64(t_1 + t_2) tmp = 0.0 if (t_3 <= -1e+63) tmp = Float64(t_1 + Float64(0.5 * NaChar)); elseif (t_3 <= 1e+15) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = Float64(Float64(0.5 * NdChar) + t_2); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = NaChar / (1.0 + exp(((t_0 + -mu) / KbT))); t_3 = t_1 + t_2; tmp = 0.0; if (t_3 <= -1e+63) tmp = t_1 + (0.5 * NaChar); elseif (t_3 <= 1e+15) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = (0.5 * NdChar) + t_2; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+63], N[(t$95$1 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1e+15], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
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{t\_0 + \left(-mu\right)}{KbT}}}\\
t_3 := t\_1 + t\_2\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+63}:\\
\;\;\;\;t\_1 + 0.5 \cdot NaChar\\
\mathbf{elif}\;t\_3 \leq 10^{+15}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar + t\_2\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.00000000000000006e63Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
if -1.00000000000000006e63 < (+.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))))) < 1e15Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
if 1e15 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.0
Applied rewrites47.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_2 (+ t_1 (* 0.5 NaChar)))
(t_3 (+ t_1 (/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))))
(if (<= t_3 -1e+63)
t_2
(if (<= t_3 5e+171) (/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0)) t_2))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (0.5 * NaChar);
double t_3 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_3 <= -1e+63) {
tmp = t_2;
} else if (t_3 <= 5e+171) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_2 = t_1 + (0.5d0 * nachar)
t_3 = t_1 + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))
if (t_3 <= (-1d+63)) then
tmp = t_2
else if (t_3 <= 5d+171) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_2 = t_1 + (0.5 * NaChar);
double t_3 = t_1 + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_3 <= -1e+63) {
tmp = t_2;
} else if (t_3 <= 5e+171) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = t_2;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_2 = t_1 + (0.5 * NaChar) t_3 = t_1 + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT)))) tmp = 0 if t_3 <= -1e+63: tmp = t_2 elif t_3 <= 5e+171: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = t_2 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_2 = Float64(t_1 + Float64(0.5 * NaChar)) t_3 = Float64(t_1 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(t_0 + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_3 <= -1e+63) tmp = t_2; elseif (t_3 <= 5e+171) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = t_2; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_2 = t_1 + (0.5 * NaChar); t_3 = t_1 + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT)))); tmp = 0.0; if (t_3 <= -1e+63) tmp = t_2; elseif (t_3 <= 5e+171) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = t_2; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $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[(t$95$1 + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+63], t$95$2, If[LessEqual[t$95$3, 5e+171], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_2 := t\_1 + 0.5 \cdot NaChar\\
t_3 := t\_1 + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+63}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+171}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.00000000000000006e63 or 5.0000000000000004e171 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
if -1.00000000000000006e63 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 5.0000000000000004e171Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept))
(t_1
(+ (/ NdChar (+ (exp (/ (- (+ mu Vef) Ec) KbT)) 1.0)) (* 0.5 NaChar)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))))
(if (<= t_2 -1e+63)
t_1
(if (<= t_2 5e+171) (/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0)) t_1))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double t_1 = (NdChar / (exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (0.5 * NaChar);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -1e+63) {
tmp = t_1;
} else if (t_2 <= 5e+171) {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (ev + vef) + eaccept
t_1 = (ndchar / (exp((((mu + vef) - ec) / kbt)) + 1.0d0)) + (0.5d0 * nachar)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))
if (t_2 <= (-1d+63)) then
tmp = t_1
else if (t_2 <= 5d+171) then
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
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 = (Ev + Vef) + EAccept;
double t_1 = (NdChar / (Math.exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (0.5 * NaChar);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))));
double tmp;
if (t_2 <= -1e+63) {
tmp = t_1;
} else if (t_2 <= 5e+171) {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept t_1 = (NdChar / (math.exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (0.5 * NaChar) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT)))) tmp = 0 if t_2 <= -1e+63: tmp = t_1 elif t_2 <= 5e+171: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) else: tmp = t_1 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) t_1 = Float64(Float64(NdChar / Float64(exp(Float64(Float64(Float64(mu + Vef) - Ec) / KbT)) + 1.0)) + Float64(0.5 * NaChar)) 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(t_0 + Float64(-mu)) / KbT))))) tmp = 0.0 if (t_2 <= -1e+63) tmp = t_1; elseif (t_2 <= 5e+171) tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; t_1 = (NdChar / (exp((((mu + Vef) - Ec) / KbT)) + 1.0)) + (0.5 * NaChar); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT)))); tmp = 0.0; if (t_2 <= -1e+63) tmp = t_1; elseif (t_2 <= 5e+171) tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(N[Exp[N[(N[(N[(mu + Vef), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $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[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+63], t$95$1, If[LessEqual[t$95$2, 5e+171], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
t_1 := \frac{NdChar}{e^{\frac{\left(mu + Vef\right) - Ec}{KbT}} + 1} + 0.5 \cdot NaChar\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+171}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.00000000000000006e63 or 5.0000000000000004e171 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in EDonor around 0
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6444.0
Applied rewrites44.0%
if -1.00000000000000006e63 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 5.0000000000000004e171Initial program 100.0%
Taylor expanded in NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (+ Ev Vef) EAccept)))
(if (<=
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (+ t_0 (- mu)) KbT)))))
-1e+63)
(+ (/ NdChar (+ 1.0 (exp (/ Vef KbT)))) (* 0.5 NaChar))
(/ NaChar (+ (exp (/ (- t_0 mu) KbT)) 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double tmp;
if (((NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))))) <= -1e+63) {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (0.5 * NaChar);
} else {
tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ev + vef) + eaccept
if (((ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((t_0 + -mu) / kbt))))) <= (-1d+63)) then
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (0.5d0 * nachar)
else
tmp = nachar / (exp(((t_0 - mu) / kbt)) + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (Ev + Vef) + EAccept;
double tmp;
if (((NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((t_0 + -mu) / KbT))))) <= -1e+63) {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (0.5 * NaChar);
} else {
tmp = NaChar / (Math.exp(((t_0 - mu) / KbT)) + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (Ev + Vef) + EAccept tmp = 0 if ((NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((t_0 + -mu) / KbT))))) <= -1e+63: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (0.5 * NaChar) else: tmp = NaChar / (math.exp(((t_0 - mu) / KbT)) + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(Ev + Vef) + EAccept) tmp = 0.0 if (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(t_0 + Float64(-mu)) / KbT))))) <= -1e+63) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(0.5 * NaChar)); else tmp = Float64(NaChar / Float64(exp(Float64(Float64(t_0 - mu) / KbT)) + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (Ev + Vef) + EAccept; tmp = 0.0; if (((NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((t_0 + -mu) / KbT))))) <= -1e+63) tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (0.5 * NaChar); else tmp = NaChar / (exp(((t_0 - mu) / KbT)) + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision]}, If[LessEqual[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[(t$95$0 + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e+63], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(N[Exp[N[(N[(t$95$0 - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(Ev + Vef\right) + EAccept\\
\mathbf{if}\;\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{t\_0 + \left(-mu\right)}{KbT}}} \leq -1 \cdot 10^{+63}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{t\_0 - mu}{KbT}} + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.00000000000000006e63Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in Vef around inf
lower-/.f6435.2
Applied rewrites35.2%
if -1.00000000000000006e63 < (+.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 NdChar around 0
sub-flipN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= NdChar -3.5e-36)
(+ (/ NdChar (+ 1.0 (exp (/ Vef KbT)))) (* 0.5 NaChar))
(if (<= NdChar 1.65e+23)
(+ (/ NaChar (+ (exp (/ EAccept KbT)) 1.0)) (/ NdChar 2.0))
(+ (/ NdChar (+ 1.0 (exp (/ (- 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 <= -3.5e-36) {
tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (0.5 * NaChar);
} else if (NdChar <= 1.65e+23) {
tmp = (NaChar / (exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0);
} else {
tmp = (NdChar / (1.0 + exp((-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 <= (-3.5d-36)) then
tmp = (ndchar / (1.0d0 + exp((vef / kbt)))) + (0.5d0 * nachar)
else if (ndchar <= 1.65d+23) then
tmp = (nachar / (exp((eaccept / kbt)) + 1.0d0)) + (ndchar / 2.0d0)
else
tmp = (ndchar / (1.0d0 + exp((-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 <= -3.5e-36) {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (0.5 * NaChar);
} else if (NdChar <= 1.65e+23) {
tmp = (NaChar / (Math.exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((-Ec / KbT)))) + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if NdChar <= -3.5e-36: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (0.5 * NaChar) elif NdChar <= 1.65e+23: tmp = (NaChar / (math.exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0) else: tmp = (NdChar / (1.0 + math.exp((-Ec / KbT)))) + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (NdChar <= -3.5e-36) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))) + Float64(0.5 * NaChar)); elseif (NdChar <= 1.65e+23) tmp = Float64(Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)) + Float64(NdChar / 2.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-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 <= -3.5e-36) tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (0.5 * NaChar); elseif (NdChar <= 1.65e+23) tmp = (NaChar / (exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0); else tmp = (NdChar / (1.0 + exp((-Ec / KbT)))) + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NdChar, -3.5e-36], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, 1.65e+23], N[(N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(NdChar / 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[((-Ec) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -3.5 \cdot 10^{-36}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + 0.5 \cdot NaChar\\
\mathbf{elif}\;NdChar \leq 1.65 \cdot 10^{+23}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1} + \frac{NdChar}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{-Ec}{KbT}}} + 0.5 \cdot NaChar\\
\end{array}
\end{array}
if NdChar < -3.5e-36Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in Vef around inf
lower-/.f6435.2
Applied rewrites35.2%
if -3.5e-36 < NdChar < 1.65000000000000015e23Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in KbT around inf
Applied rewrites36.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6436.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6436.1
Applied rewrites36.1%
if 1.65000000000000015e23 < NdChar Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in Ec around inf
mul-1-negN/A
lower-neg.f6436.5
Applied rewrites36.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ (/ NaChar (+ (exp (/ EAccept KbT)) 1.0)) (/ NdChar 2.0))))
(if (<= NaChar -5.8e-22)
t_0
(if (<= NaChar 2.1e+53)
(+ (/ NdChar (+ 1.0 (exp (/ Vef 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 = (NaChar / (exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0);
double tmp;
if (NaChar <= -5.8e-22) {
tmp = t_0;
} else if (NaChar <= 2.1e+53) {
tmp = (NdChar / (1.0 + exp((Vef / 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 = (nachar / (exp((eaccept / kbt)) + 1.0d0)) + (ndchar / 2.0d0)
if (nachar <= (-5.8d-22)) then
tmp = t_0
else if (nachar <= 2.1d+53) then
tmp = (ndchar / (1.0d0 + exp((vef / 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 = (NaChar / (Math.exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0);
double tmp;
if (NaChar <= -5.8e-22) {
tmp = t_0;
} else if (NaChar <= 2.1e+53) {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (0.5 * NaChar);
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NaChar / (math.exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0) tmp = 0 if NaChar <= -5.8e-22: tmp = t_0 elif NaChar <= 2.1e+53: tmp = (NdChar / (1.0 + math.exp((Vef / 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(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)) + Float64(NdChar / 2.0)) tmp = 0.0 if (NaChar <= -5.8e-22) tmp = t_0; elseif (NaChar <= 2.1e+53) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / 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 = (NaChar / (exp((EAccept / KbT)) + 1.0)) + (NdChar / 2.0); tmp = 0.0; if (NaChar <= -5.8e-22) tmp = t_0; elseif (NaChar <= 2.1e+53) tmp = (NdChar / (1.0 + exp((Vef / 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[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(NdChar / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NaChar, -5.8e-22], t$95$0, If[LessEqual[NaChar, 2.1e+53], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1} + \frac{NdChar}{2}\\
\mathbf{if}\;NaChar \leq -5.8 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;NaChar \leq 2.1 \cdot 10^{+53}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if NaChar < -5.8000000000000003e-22 or 2.1000000000000002e53 < NaChar Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in KbT around inf
Applied rewrites36.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6436.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6436.1
Applied rewrites36.1%
if -5.8000000000000003e-22 < NaChar < 2.1000000000000002e53Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in Vef around inf
lower-/.f6435.2
Applied rewrites35.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= EDonor -2.6e+74) (+ (/ NdChar (+ 1.0 (exp (/ EDonor KbT)))) (* 0.5 NaChar)) (+ (/ NdChar (+ 1.0 (exp (/ Vef 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 (EDonor <= -2.6e+74) {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (0.5 * NaChar);
} else {
tmp = (NdChar / (1.0 + exp((Vef / 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 (edonor <= (-2.6d+74)) then
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (0.5d0 * nachar)
else
tmp = (ndchar / (1.0d0 + exp((vef / 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 (EDonor <= -2.6e+74) {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (0.5 * NaChar);
} else {
tmp = (NdChar / (1.0 + Math.exp((Vef / KbT)))) + (0.5 * NaChar);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if EDonor <= -2.6e+74: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (0.5 * NaChar) else: tmp = (NdChar / (1.0 + math.exp((Vef / KbT)))) + (0.5 * NaChar) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EDonor <= -2.6e+74) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(0.5 * NaChar)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Vef / 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 (EDonor <= -2.6e+74) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (0.5 * NaChar); else tmp = (NdChar / (1.0 + exp((Vef / KbT)))) + (0.5 * NaChar); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EDonor, -2.6e+74], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;EDonor \leq -2.6 \cdot 10^{+74}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + 0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}} + 0.5 \cdot NaChar\\
\end{array}
\end{array}
if EDonor < -2.6000000000000001e74Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in EDonor around inf
lower-/.f6436.4
Applied rewrites36.4%
if -2.6000000000000001e74 < EDonor Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in Vef around inf
lower-/.f6435.2
Applied rewrites35.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ EDonor KbT)))) (* 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 / (1.0 + exp((EDonor / KbT)))) + (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 / (1.0d0 + exp((edonor / kbt)))) + (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 / (1.0 + Math.exp((EDonor / KbT)))) + (0.5 * NaChar);
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (0.5 * NaChar)
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(0.5 * NaChar)) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (0.5 * NaChar); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + 0.5 \cdot NaChar
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6447.8
Applied rewrites47.8%
Taylor expanded in EDonor around inf
lower-/.f6436.4
Applied rewrites36.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 (+ NaChar NdChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * (NaChar + NdChar);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * (nachar + ndchar)
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * (NaChar + NdChar);
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * (NaChar + NdChar)
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * Float64(NaChar + NdChar)) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * (NaChar + NdChar); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * N[(NaChar + NdChar), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(NaChar + NdChar\right)
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.3
Applied rewrites28.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= NdChar -1.15e+30) (* 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 (NdChar <= -1.15e+30) {
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 (ndchar <= (-1.15d+30)) 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 (NdChar <= -1.15e+30) {
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 NdChar <= -1.15e+30: 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 (NdChar <= -1.15e+30) 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 (NdChar <= -1.15e+30) 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[NdChar, -1.15e+30], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -1.15 \cdot 10^{+30}:\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NaChar\\
\end{array}
\end{array}
if NdChar < -1.15e30Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.3
Applied rewrites28.3%
Taylor expanded in NdChar around inf
lower-*.f6419.0
Applied rewrites19.0%
if -1.15e30 < NdChar Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.3
Applied rewrites28.3%
Taylor expanded in NdChar around 0
Applied rewrites18.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 NdChar))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NdChar;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * ndchar
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NdChar;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * NdChar
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * NdChar) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * NdChar; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NdChar), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot NdChar
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.3
Applied rewrites28.3%
Taylor expanded in NdChar around inf
lower-*.f6419.0
Applied rewrites19.0%
herbie shell --seed 2025129
(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))))))