
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}
\end{array}
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (+ (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
(t_1
(+
t_0
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_1 -5e-235) (not (<= t_1 4e-235)))
(+ t_0 (/ NaChar (+ 1.0 (exp (/ Ev KbT)))))
(/ NdChar (+ 1.0 (exp (/ (- (+ EDonor (+ Vef mu)) Ec) KbT)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_1 <= -5e-235) || !(t_1 <= 4e-235)) {
tmp = t_0 + (NaChar / (1.0 + exp((Ev / KbT))));
} else {
tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
if ((t_1 <= (-5d-235)) .or. (.not. (t_1 <= 4d-235))) then
tmp = t_0 + (nachar / (1.0d0 + exp((ev / kbt))))
else
tmp = ndchar / (1.0d0 + exp((((edonor + (vef + mu)) - ec) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_1 <= -5e-235) || !(t_1 <= 4e-235)) {
tmp = t_0 + (NaChar / (1.0 + Math.exp((Ev / KbT))));
} else {
tmp = NdChar / (1.0 + Math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) tmp = 0 if (t_1 <= -5e-235) or not (t_1 <= 4e-235): tmp = t_0 + (NaChar / (1.0 + math.exp((Ev / KbT)))) else: tmp = NdChar / (1.0 + math.exp((((EDonor + (Vef + mu)) - Ec) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if ((t_1 <= -5e-235) || !(t_1 <= 4e-235)) tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))); else tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Float64(Vef + mu)) - Ec) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); tmp = 0.0; if ((t_1 <= -5e-235) || ~((t_1 <= 4e-235))) tmp = t_0 + (NaChar / (1.0 + exp((Ev / KbT)))); else tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-235], N[Not[LessEqual[t$95$1, 4e-235]], $MachinePrecision]], N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-235} \lor \neg \left(t\_1 \leq 4 \cdot 10^{-235}\right):\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.9999999999999998e-235 or 3.9999999999999998e-235 < (+.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
Applied rewrites78.9%
if -4.9999999999999998e-235 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 3.9999999999999998e-235Initial program 100.0%
Taylor expanded in NdChar around inf
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Final simplification82.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_0 -1e-230)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= t_0 5e-246)
(/
NdChar
(-
(+
2.0
(/
(/
(- (* EDonor EDonor) (* (+ Vef mu) (+ Vef mu)))
(- EDonor (+ Vef mu)))
KbT))
(/ Ec KbT)))
(fma 0.5 NaChar (* 0.5 NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_0 <= -1e-230) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (t_0 <= 5e-246) {
tmp = NdChar / ((2.0 + ((((EDonor * EDonor) - ((Vef + mu) * (Vef + mu))) / (EDonor - (Vef + mu))) / KbT)) - (Ec / KbT));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_0 <= -1e-230) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (t_0 <= 5e-246) tmp = Float64(NdChar / Float64(Float64(2.0 + Float64(Float64(Float64(Float64(EDonor * EDonor) - Float64(Float64(Vef + mu) * Float64(Vef + mu))) / Float64(EDonor - Float64(Vef + mu))) / KbT)) - Float64(Ec / KbT))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-230], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-246], N[(NdChar / N[(N[(2.0 + N[(N[(N[(N[(EDonor * EDonor), $MachinePrecision] - N[(N[(Vef + mu), $MachinePrecision] * N[(Vef + mu), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(EDonor - N[(Vef + mu), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-230}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-246}:\\
\;\;\;\;\frac{NdChar}{\left(2 + \frac{\frac{EDonor \cdot EDonor - \left(Vef + mu\right) \cdot \left(Vef + mu\right)}{EDonor - \left(Vef + mu\right)}}{KbT}\right) - \frac{Ec}{KbT}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\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.00000000000000005e-230Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites52.6%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
if -1.00000000000000005e-230 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 4.9999999999999997e-246Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites56.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6492.7
Applied rewrites92.7%
Taylor expanded in KbT around inf
div-add-revN/A
div-addN/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
flip-+N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower--.f64N/A
lower-+.f6449.5
Applied rewrites49.5%
if 4.9999999999999997e-246 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6437.4
Applied rewrites37.4%
Final simplification39.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_0 -1e-230)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= t_0 5e-246)
(/
NdChar
(-
(+ 2.0 (/ (+ EDonor (/ (- (* Vef Vef) (* mu mu)) (- Vef mu))) KbT))
(/ Ec KbT)))
(fma 0.5 NaChar (* 0.5 NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_0 <= -1e-230) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (t_0 <= 5e-246) {
tmp = NdChar / ((2.0 + ((EDonor + (((Vef * Vef) - (mu * mu)) / (Vef - mu))) / KbT)) - (Ec / KbT));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_0 <= -1e-230) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (t_0 <= 5e-246) tmp = Float64(NdChar / Float64(Float64(2.0 + Float64(Float64(EDonor + Float64(Float64(Float64(Vef * Vef) - Float64(mu * mu)) / Float64(Vef - mu))) / KbT)) - Float64(Ec / KbT))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-230], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-246], N[(NdChar / N[(N[(2.0 + N[(N[(EDonor + N[(N[(N[(Vef * Vef), $MachinePrecision] - N[(mu * mu), $MachinePrecision]), $MachinePrecision] / N[(Vef - mu), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-230}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-246}:\\
\;\;\;\;\frac{NdChar}{\left(2 + \frac{EDonor + \frac{Vef \cdot Vef - mu \cdot mu}{Vef - mu}}{KbT}\right) - \frac{Ec}{KbT}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\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.00000000000000005e-230Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites52.6%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
if -1.00000000000000005e-230 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 4.9999999999999997e-246Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites56.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6492.7
Applied rewrites92.7%
Taylor expanded in KbT around inf
div-add-revN/A
div-addN/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
flip-+N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower--.f6447.9
Applied rewrites47.9%
if 4.9999999999999997e-246 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6437.4
Applied rewrites37.4%
Final simplification38.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_0 -5e-154)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= t_0 1e-173)
(/ NaChar (- (+ 2.0 (/ (+ EAccept (+ Ev Vef)) KbT)) (/ mu KbT)))
(fma 0.5 NaChar (* 0.5 NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_0 <= -5e-154) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (t_0 <= 1e-173) {
tmp = NaChar / ((2.0 + ((EAccept + (Ev + Vef)) / KbT)) - (mu / KbT));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_0 <= -5e-154) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (t_0 <= 1e-173) tmp = Float64(NaChar / Float64(Float64(2.0 + Float64(Float64(EAccept + Float64(Ev + Vef)) / KbT)) - Float64(mu / KbT))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-154], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-173], N[(NaChar / N[(N[(2.0 + N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] - N[(mu / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-154}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;t\_0 \leq 10^{-173}:\\
\;\;\;\;\frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-154Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites55.5%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6434.4
Applied rewrites34.4%
if -5.0000000000000002e-154 < (+.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))))) < 1e-173Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6482.9
Applied rewrites82.9%
Taylor expanded in KbT around inf
lower--.f64N/A
div-add-revN/A
div-addN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f6441.4
Applied rewrites41.4%
if 1e-173 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6439.2
Applied rewrites39.2%
Final simplification38.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_0 -1e-230)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= t_0 5e-246)
(/ NdChar (- (+ 2.0 (/ Vef KbT)) (/ Ec KbT)))
(fma 0.5 NaChar (* 0.5 NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_0 <= -1e-230) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (t_0 <= 5e-246) {
tmp = NdChar / ((2.0 + (Vef / KbT)) - (Ec / KbT));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_0 <= -1e-230) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (t_0 <= 5e-246) tmp = Float64(NdChar / Float64(Float64(2.0 + Float64(Vef / KbT)) - Float64(Ec / KbT))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-230], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-246], N[(NdChar / N[(N[(2.0 + N[(Vef / KbT), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-230}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-246}:\\
\;\;\;\;\frac{NdChar}{\left(2 + \frac{Vef}{KbT}\right) - \frac{Ec}{KbT}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\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.00000000000000005e-230Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites52.6%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
if -1.00000000000000005e-230 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 4.9999999999999997e-246Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites56.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6492.7
Applied rewrites92.7%
Taylor expanded in KbT around inf
div-add-revN/A
div-addN/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
Taylor expanded in Vef around inf
lower-/.f6438.8
Applied rewrites38.8%
if 4.9999999999999997e-246 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6437.4
Applied rewrites37.4%
Final simplification36.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_0 -1e-230)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= t_0 5e-246)
(/ NdChar (- (+ 2.0 (/ EDonor KbT)) (/ Ec KbT)))
(fma 0.5 NaChar (* 0.5 NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_0 <= -1e-230) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (t_0 <= 5e-246) {
tmp = NdChar / ((2.0 + (EDonor / KbT)) - (Ec / KbT));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_0 <= -1e-230) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (t_0 <= 5e-246) tmp = Float64(NdChar / Float64(Float64(2.0 + Float64(EDonor / KbT)) - Float64(Ec / KbT))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-230], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-246], N[(NdChar / N[(N[(2.0 + N[(EDonor / KbT), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-230}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-246}:\\
\;\;\;\;\frac{NdChar}{\left(2 + \frac{EDonor}{KbT}\right) - \frac{Ec}{KbT}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\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.00000000000000005e-230Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites52.6%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
if -1.00000000000000005e-230 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 4.9999999999999997e-246Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites56.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6492.7
Applied rewrites92.7%
Taylor expanded in KbT around inf
div-add-revN/A
div-addN/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f6436.1
Applied rewrites36.1%
Taylor expanded in EDonor around inf
lower-/.f6425.2
Applied rewrites25.2%
if 4.9999999999999997e-246 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6437.4
Applied rewrites37.4%
Final simplification33.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_0 -5e-154)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= t_0 1e-173)
(* NdChar (* 0.5 (/ NaChar NdChar)))
(fma 0.5 NaChar (* 0.5 NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_0 <= -5e-154) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (t_0 <= 1e-173) {
tmp = NdChar * (0.5 * (NaChar / NdChar));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_0 <= -5e-154) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (t_0 <= 1e-173) tmp = Float64(NdChar * Float64(0.5 * Float64(NaChar / NdChar))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-154], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-173], N[(NdChar * N[(0.5 * N[(NaChar / NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-154}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;t\_0 \leq 10^{-173}:\\
\;\;\;\;NdChar \cdot \left(0.5 \cdot \frac{NaChar}{NdChar}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-154Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites55.5%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6434.4
Applied rewrites34.4%
if -5.0000000000000002e-154 < (+.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))))) < 1e-173Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f648.5
Applied rewrites8.5%
Taylor expanded in NdChar around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f648.4
Applied rewrites8.4%
Taylor expanded in NdChar around 0
lower-*.f64N/A
lower-/.f6421.8
Applied rewrites21.8%
if 1e-173 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6439.2
Applied rewrites39.2%
Final simplification32.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (/ Vef KbT)))))
(if (<= EDonor -2.9e+108)
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(if (<= EDonor -4.5e-294)
(/ NaChar t_0)
(if (<= EDonor 1.75e-218)
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(if (or (<= EDonor 5.2e-168) (not (<= EDonor 2.65e+132)))
(/ NaChar (+ 1.0 (exp (/ Ev KbT))))
(/ NdChar 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 = 1.0 + exp((Vef / KbT));
double tmp;
if (EDonor <= -2.9e+108) {
tmp = NdChar / (1.0 + exp((EDonor / KbT)));
} else if (EDonor <= -4.5e-294) {
tmp = NaChar / t_0;
} else if (EDonor <= 1.75e-218) {
tmp = NdChar / (1.0 + exp((mu / KbT)));
} else if ((EDonor <= 5.2e-168) || !(EDonor <= 2.65e+132)) {
tmp = NaChar / (1.0 + exp((Ev / KbT)));
} else {
tmp = NdChar / 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 = 1.0d0 + exp((vef / kbt))
if (edonor <= (-2.9d+108)) then
tmp = ndchar / (1.0d0 + exp((edonor / kbt)))
else if (edonor <= (-4.5d-294)) then
tmp = nachar / t_0
else if (edonor <= 1.75d-218) then
tmp = ndchar / (1.0d0 + exp((mu / kbt)))
else if ((edonor <= 5.2d-168) .or. (.not. (edonor <= 2.65d+132))) then
tmp = nachar / (1.0d0 + exp((ev / kbt)))
else
tmp = ndchar / 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 = 1.0 + Math.exp((Vef / KbT));
double tmp;
if (EDonor <= -2.9e+108) {
tmp = NdChar / (1.0 + Math.exp((EDonor / KbT)));
} else if (EDonor <= -4.5e-294) {
tmp = NaChar / t_0;
} else if (EDonor <= 1.75e-218) {
tmp = NdChar / (1.0 + Math.exp((mu / KbT)));
} else if ((EDonor <= 5.2e-168) || !(EDonor <= 2.65e+132)) {
tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
} else {
tmp = NdChar / t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = 1.0 + math.exp((Vef / KbT)) tmp = 0 if EDonor <= -2.9e+108: tmp = NdChar / (1.0 + math.exp((EDonor / KbT))) elif EDonor <= -4.5e-294: tmp = NaChar / t_0 elif EDonor <= 1.75e-218: tmp = NdChar / (1.0 + math.exp((mu / KbT))) elif (EDonor <= 5.2e-168) or not (EDonor <= 2.65e+132): tmp = NaChar / (1.0 + math.exp((Ev / KbT))) else: tmp = NdChar / t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(1.0 + exp(Float64(Vef / KbT))) tmp = 0.0 if (EDonor <= -2.9e+108) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))); elseif (EDonor <= -4.5e-294) tmp = Float64(NaChar / t_0); elseif (EDonor <= 1.75e-218) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))); elseif ((EDonor <= 5.2e-168) || !(EDonor <= 2.65e+132)) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))); else tmp = Float64(NdChar / t_0); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = 1.0 + exp((Vef / KbT)); tmp = 0.0; if (EDonor <= -2.9e+108) tmp = NdChar / (1.0 + exp((EDonor / KbT))); elseif (EDonor <= -4.5e-294) tmp = NaChar / t_0; elseif (EDonor <= 1.75e-218) tmp = NdChar / (1.0 + exp((mu / KbT))); elseif ((EDonor <= 5.2e-168) || ~((EDonor <= 2.65e+132))) tmp = NaChar / (1.0 + exp((Ev / KbT))); else tmp = NdChar / t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[EDonor, -2.9e+108], N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EDonor, -4.5e-294], N[(NaChar / t$95$0), $MachinePrecision], If[LessEqual[EDonor, 1.75e-218], N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[EDonor, 5.2e-168], N[Not[LessEqual[EDonor, 2.65e+132]], $MachinePrecision]], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + e^{\frac{Vef}{KbT}}\\
\mathbf{if}\;EDonor \leq -2.9 \cdot 10^{+108}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\mathbf{elif}\;EDonor \leq -4.5 \cdot 10^{-294}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\
\mathbf{elif}\;EDonor \leq 1.75 \cdot 10^{-218}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\
\mathbf{elif}\;EDonor \leq 5.2 \cdot 10^{-168} \lor \neg \left(EDonor \leq 2.65 \cdot 10^{+132}\right):\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\
\end{array}
\end{array}
if EDonor < -2.90000000000000007e108Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites70.5%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
Taylor expanded in EDonor around inf
Applied rewrites56.1%
if -2.90000000000000007e108 < EDonor < -4.49999999999999981e-294Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6475.9
Applied rewrites75.9%
Taylor expanded in Vef around inf
Applied rewrites52.3%
if -4.49999999999999981e-294 < EDonor < 1.75e-218Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites88.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6480.2
Applied rewrites80.2%
Taylor expanded in mu around inf
Applied rewrites70.2%
if 1.75e-218 < EDonor < 5.2000000000000002e-168 or 2.65e132 < EDonor Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6470.2
Applied rewrites70.2%
Taylor expanded in Ev around inf
Applied rewrites50.4%
if 5.2000000000000002e-168 < EDonor < 2.65e132Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites70.5%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6472.2
Applied rewrites72.2%
Taylor expanded in Vef around inf
Applied rewrites51.6%
Final simplification54.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (/ Vef KbT)))))
(if (<= EAccept -1.3e-257)
(/ NaChar (+ 1.0 (exp (/ Ev KbT))))
(if (<= EAccept 1.7e-187)
(/ NdChar t_0)
(if (<= EAccept 2.2e-34)
(/ NaChar t_0)
(if (<= EAccept 7e+45)
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = 1.0 + exp((Vef / KbT));
double tmp;
if (EAccept <= -1.3e-257) {
tmp = NaChar / (1.0 + exp((Ev / KbT)));
} else if (EAccept <= 1.7e-187) {
tmp = NdChar / t_0;
} else if (EAccept <= 2.2e-34) {
tmp = NaChar / t_0;
} else if (EAccept <= 7e+45) {
tmp = NdChar / (1.0 + exp((EDonor / KbT)));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + exp((vef / kbt))
if (eaccept <= (-1.3d-257)) then
tmp = nachar / (1.0d0 + exp((ev / kbt)))
else if (eaccept <= 1.7d-187) then
tmp = ndchar / t_0
else if (eaccept <= 2.2d-34) then
tmp = nachar / t_0
else if (eaccept <= 7d+45) then
tmp = ndchar / (1.0d0 + exp((edonor / kbt)))
else
tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = 1.0 + Math.exp((Vef / KbT));
double tmp;
if (EAccept <= -1.3e-257) {
tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
} else if (EAccept <= 1.7e-187) {
tmp = NdChar / t_0;
} else if (EAccept <= 2.2e-34) {
tmp = NaChar / t_0;
} else if (EAccept <= 7e+45) {
tmp = NdChar / (1.0 + Math.exp((EDonor / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = 1.0 + math.exp((Vef / KbT)) tmp = 0 if EAccept <= -1.3e-257: tmp = NaChar / (1.0 + math.exp((Ev / KbT))) elif EAccept <= 1.7e-187: tmp = NdChar / t_0 elif EAccept <= 2.2e-34: tmp = NaChar / t_0 elif EAccept <= 7e+45: tmp = NdChar / (1.0 + math.exp((EDonor / KbT))) else: tmp = NaChar / (1.0 + math.exp((EAccept / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(1.0 + exp(Float64(Vef / KbT))) tmp = 0.0 if (EAccept <= -1.3e-257) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))); elseif (EAccept <= 1.7e-187) tmp = Float64(NdChar / t_0); elseif (EAccept <= 2.2e-34) tmp = Float64(NaChar / t_0); elseif (EAccept <= 7e+45) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = 1.0 + exp((Vef / KbT)); tmp = 0.0; if (EAccept <= -1.3e-257) tmp = NaChar / (1.0 + exp((Ev / KbT))); elseif (EAccept <= 1.7e-187) tmp = NdChar / t_0; elseif (EAccept <= 2.2e-34) tmp = NaChar / t_0; elseif (EAccept <= 7e+45) tmp = NdChar / (1.0 + exp((EDonor / KbT))); else tmp = NaChar / (1.0 + exp((EAccept / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[EAccept, -1.3e-257], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 1.7e-187], N[(NdChar / t$95$0), $MachinePrecision], If[LessEqual[EAccept, 2.2e-34], N[(NaChar / t$95$0), $MachinePrecision], If[LessEqual[EAccept, 7e+45], 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]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + e^{\frac{Vef}{KbT}}\\
\mathbf{if}\;EAccept \leq -1.3 \cdot 10^{-257}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 1.7 \cdot 10^{-187}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\
\mathbf{elif}\;EAccept \leq 2.2 \cdot 10^{-34}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\
\mathbf{elif}\;EAccept \leq 7 \cdot 10^{+45}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if EAccept < -1.3e-257Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.2
Applied rewrites60.2%
Taylor expanded in Ev around inf
Applied rewrites36.5%
if -1.3e-257 < EAccept < 1.7000000000000001e-187Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites73.1%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6466.8
Applied rewrites66.8%
Taylor expanded in Vef around inf
Applied rewrites39.9%
if 1.7000000000000001e-187 < EAccept < 2.1999999999999999e-34Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6464.1
Applied rewrites64.1%
Taylor expanded in Vef around inf
Applied rewrites49.3%
if 2.1999999999999999e-34 < EAccept < 7.00000000000000046e45Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites71.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6469.5
Applied rewrites69.5%
Taylor expanded in EDonor around inf
Applied rewrites53.8%
if 7.00000000000000046e45 < EAccept Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6472.8
Applied rewrites72.8%
Taylor expanded in EAccept around inf
Applied rewrites54.4%
Final simplification43.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NdChar -2.9e-59) (not (<= NdChar 1.4e-36))) (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor (+ Vef mu)) Ec) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -2.9e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((ndchar <= (-2.9d-59)) .or. (.not. (ndchar <= 1.4d-36))) then
tmp = ndchar / (1.0d0 + exp((((edonor + (vef + mu)) - ec) / kbt)))
else
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -2.9e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + Math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NdChar <= -2.9e-59) or not (NdChar <= 1.4e-36): tmp = NdChar / (1.0 + math.exp((((EDonor + (Vef + mu)) - Ec) / KbT))) else: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NdChar <= -2.9e-59) || !(NdChar <= 1.4e-36)) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Float64(Vef + mu)) - Ec) / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NdChar <= -2.9e-59) || ~((NdChar <= 1.4e-36))) tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT))); else tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -2.9e-59], N[Not[LessEqual[NdChar, 1.4e-36]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -2.9 \cdot 10^{-59} \lor \neg \left(NdChar \leq 1.4 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\end{array}
\end{array}
if NdChar < -2.90000000000000016e-59 or 1.4000000000000001e-36 < NdChar Initial program 100.0%
Taylor expanded in NdChar around inf
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
if -2.90000000000000016e-59 < NdChar < 1.4000000000000001e-36Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6478.0
Applied rewrites78.0%
Final simplification75.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NdChar -3.2e-59) (not (<= NdChar 1.4e-36))) (/ NdChar (+ 1.0 (exp (/ (- (+ Vef mu) Ec) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -3.2e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((ndchar <= (-3.2d-59)) .or. (.not. (ndchar <= 1.4d-36))) then
tmp = ndchar / (1.0d0 + exp((((vef + mu) - ec) / kbt)))
else
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -3.2e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + Math.exp((((Vef + mu) - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NdChar <= -3.2e-59) or not (NdChar <= 1.4e-36): tmp = NdChar / (1.0 + math.exp((((Vef + mu) - Ec) / KbT))) else: tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NdChar <= -3.2e-59) || !(NdChar <= 1.4e-36)) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(Vef + mu) - Ec) / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NdChar <= -3.2e-59) || ~((NdChar <= 1.4e-36))) tmp = NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT))); else tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -3.2e-59], N[Not[LessEqual[NdChar, 1.4e-36]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(Vef + mu), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -3.2 \cdot 10^{-59} \lor \neg \left(NdChar \leq 1.4 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(Vef + mu\right) - Ec}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\end{array}
\end{array}
if NdChar < -3.1999999999999999e-59 or 1.4000000000000001e-36 < NdChar Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites75.5%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
Taylor expanded in EDonor around 0
lower-+.f6468.6
Applied rewrites68.6%
if -3.1999999999999999e-59 < NdChar < 1.4000000000000001e-36Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6478.0
Applied rewrites78.0%
Final simplification72.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NdChar -2.9e-59) (not (<= NdChar 1.4e-36))) (/ NdChar (+ 1.0 (exp (/ (- (+ Vef mu) Ec) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- Vef mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -2.9e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((ndchar <= (-2.9d-59)) .or. (.not. (ndchar <= 1.4d-36))) then
tmp = ndchar / (1.0d0 + exp((((vef + mu) - ec) / kbt)))
else
tmp = nachar / (1.0d0 + exp(((vef - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -2.9e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + Math.exp((((Vef + mu) - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NdChar <= -2.9e-59) or not (NdChar <= 1.4e-36): tmp = NdChar / (1.0 + math.exp((((Vef + mu) - Ec) / KbT))) else: tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NdChar <= -2.9e-59) || !(NdChar <= 1.4e-36)) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(Vef + mu) - Ec) / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NdChar <= -2.9e-59) || ~((NdChar <= 1.4e-36))) tmp = NdChar / (1.0 + exp((((Vef + mu) - Ec) / KbT))); else tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -2.9e-59], N[Not[LessEqual[NdChar, 1.4e-36]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(Vef + mu), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -2.9 \cdot 10^{-59} \lor \neg \left(NdChar \leq 1.4 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(Vef + mu\right) - Ec}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
\end{array}
\end{array}
if NdChar < -2.90000000000000016e-59 or 1.4000000000000001e-36 < NdChar Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites75.5%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
Taylor expanded in EDonor around 0
lower-+.f6468.6
Applied rewrites68.6%
if -2.90000000000000016e-59 < NdChar < 1.4000000000000001e-36Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6478.0
Applied rewrites78.0%
Taylor expanded in Vef around inf
Applied rewrites64.7%
Final simplification66.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= EAccept -6e-215)
(/ NaChar (+ 1.0 (exp (/ Ev KbT))))
(if (<= EAccept 2.2e-34)
(/ NaChar (+ 1.0 (exp (/ Vef KbT))))
(if (<= EAccept 7e+45)
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= -6e-215) {
tmp = NaChar / (1.0 + exp((Ev / KbT)));
} else if (EAccept <= 2.2e-34) {
tmp = NaChar / (1.0 + exp((Vef / KbT)));
} else if (EAccept <= 7e+45) {
tmp = NdChar / (1.0 + exp((EDonor / KbT)));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (eaccept <= (-6d-215)) then
tmp = nachar / (1.0d0 + exp((ev / kbt)))
else if (eaccept <= 2.2d-34) then
tmp = nachar / (1.0d0 + exp((vef / kbt)))
else if (eaccept <= 7d+45) then
tmp = ndchar / (1.0d0 + exp((edonor / kbt)))
else
tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= -6e-215) {
tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
} else if (EAccept <= 2.2e-34) {
tmp = NaChar / (1.0 + Math.exp((Vef / KbT)));
} else if (EAccept <= 7e+45) {
tmp = NdChar / (1.0 + Math.exp((EDonor / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if EAccept <= -6e-215: tmp = NaChar / (1.0 + math.exp((Ev / KbT))) elif EAccept <= 2.2e-34: tmp = NaChar / (1.0 + math.exp((Vef / KbT))) elif EAccept <= 7e+45: tmp = NdChar / (1.0 + math.exp((EDonor / KbT))) else: tmp = NaChar / (1.0 + math.exp((EAccept / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EAccept <= -6e-215) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))); elseif (EAccept <= 2.2e-34) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))); elseif (EAccept <= 7e+45) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (EAccept <= -6e-215) tmp = NaChar / (1.0 + exp((Ev / KbT))); elseif (EAccept <= 2.2e-34) tmp = NaChar / (1.0 + exp((Vef / KbT))); elseif (EAccept <= 7e+45) tmp = NdChar / (1.0 + exp((EDonor / KbT))); else tmp = NaChar / (1.0 + exp((EAccept / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, -6e-215], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 2.2e-34], N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 7e+45], 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]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;EAccept \leq -6 \cdot 10^{-215}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 2.2 \cdot 10^{-34}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 7 \cdot 10^{+45}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if EAccept < -6.00000000000000051e-215Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6459.8
Applied rewrites59.8%
Taylor expanded in Ev around inf
Applied rewrites36.1%
if -6.00000000000000051e-215 < EAccept < 2.1999999999999999e-34Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6461.4
Applied rewrites61.4%
Taylor expanded in Vef around inf
Applied rewrites45.2%
if 2.1999999999999999e-34 < EAccept < 7.00000000000000046e45Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites71.8%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6469.5
Applied rewrites69.5%
Taylor expanded in EDonor around inf
Applied rewrites53.8%
if 7.00000000000000046e45 < EAccept Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6472.8
Applied rewrites72.8%
Taylor expanded in EAccept around inf
Applied rewrites54.4%
Final simplification43.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NdChar -3.4e-59) (not (<= NdChar 1.4e-36))) (/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT)))) (/ NaChar (+ 1.0 (exp (/ (- Vef mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -3.4e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((ndchar <= (-3.4d-59)) .or. (.not. (ndchar <= 1.4d-36))) then
tmp = ndchar / (1.0d0 + exp(((mu - ec) / kbt)))
else
tmp = nachar / (1.0d0 + exp(((vef - mu) / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -3.4e-59) || !(NdChar <= 1.4e-36)) {
tmp = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NdChar <= -3.4e-59) or not (NdChar <= 1.4e-36): tmp = NdChar / (1.0 + math.exp(((mu - Ec) / KbT))) else: tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NdChar <= -3.4e-59) || !(NdChar <= 1.4e-36)) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NdChar <= -3.4e-59) || ~((NdChar <= 1.4e-36))) tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT))); else tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -3.4e-59], N[Not[LessEqual[NdChar, 1.4e-36]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -3.4 \cdot 10^{-59} \lor \neg \left(NdChar \leq 1.4 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
\end{array}
\end{array}
if NdChar < -3.40000000000000018e-59 or 1.4000000000000001e-36 < NdChar Initial program 100.0%
Taylor expanded in Ev around inf
Applied rewrites75.5%
Taylor expanded in NdChar around inf
frac-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
Taylor expanded in mu around inf
Applied rewrites56.7%
if -3.40000000000000018e-59 < NdChar < 1.4000000000000001e-36Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6478.0
Applied rewrites78.0%
Taylor expanded in Vef around inf
Applied rewrites64.7%
Final simplification60.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= KbT -1.3e+164)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= KbT 5.6e+202)
(/ NaChar (+ 1.0 (exp (/ (- Vef mu) KbT))))
(+ (/ NdChar (- 2.0 (/ 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 (KbT <= -1.3e+164) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (KbT <= 5.6e+202) {
tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
} else {
tmp = (NdChar / (2.0 - (Ec / KbT))) + (0.5 * NaChar);
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -1.3e+164) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (KbT <= 5.6e+202) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT)))); else tmp = Float64(Float64(NdChar / Float64(2.0 - Float64(Ec / KbT))) + Float64(0.5 * NaChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -1.3e+164], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 5.6e+202], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(2.0 - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * NaChar), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -1.3 \cdot 10^{+164}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;KbT \leq 5.6 \cdot 10^{+202}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{2 - \frac{Ec}{KbT}} + 0.5 \cdot NaChar\\
\end{array}
\end{array}
if KbT < -1.3e164Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites72.7%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6465.1
Applied rewrites65.1%
if -1.3e164 < KbT < 5.60000000000000032e202Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6463.7
Applied rewrites63.7%
Taylor expanded in Vef around inf
Applied rewrites52.8%
if 5.60000000000000032e202 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in KbT around inf
lower--.f64N/A
lower-+.f64N/A
div-add-revN/A
div-addN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
Taylor expanded in KbT around inf
Applied rewrites97.7%
Final simplification57.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= Vef -1.5e+37) (not (<= Vef 1.18e+36))) (/ NaChar (+ 1.0 (exp (/ Vef KbT)))) (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((Vef <= -1.5e+37) || !(Vef <= 1.18e+36)) {
tmp = NaChar / (1.0 + exp((Vef / KbT)));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((vef <= (-1.5d+37)) .or. (.not. (vef <= 1.18d+36))) then
tmp = nachar / (1.0d0 + exp((vef / kbt)))
else
tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((Vef <= -1.5e+37) || !(Vef <= 1.18e+36)) {
tmp = NaChar / (1.0 + Math.exp((Vef / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (Vef <= -1.5e+37) or not (Vef <= 1.18e+36): tmp = NaChar / (1.0 + math.exp((Vef / KbT))) else: tmp = NaChar / (1.0 + math.exp((EAccept / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((Vef <= -1.5e+37) || !(Vef <= 1.18e+36)) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((Vef <= -1.5e+37) || ~((Vef <= 1.18e+36))) tmp = NaChar / (1.0 + exp((Vef / KbT))); else tmp = NaChar / (1.0 + exp((EAccept / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[Vef, -1.5e+37], N[Not[LessEqual[Vef, 1.18e+36]], $MachinePrecision]], N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;Vef \leq -1.5 \cdot 10^{+37} \lor \neg \left(Vef \leq 1.18 \cdot 10^{+36}\right):\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if Vef < -1.50000000000000011e37 or 1.17999999999999997e36 < Vef Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6467.7
Applied rewrites67.7%
Taylor expanded in Vef around inf
Applied rewrites55.3%
if -1.50000000000000011e37 < Vef < 1.17999999999999997e36Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6456.8
Applied rewrites56.8%
Taylor expanded in EAccept around inf
Applied rewrites34.9%
Final simplification43.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= KbT -8.5e+163)
(* 0.25 (fma 2.0 NaChar (* 2.0 NdChar)))
(if (<= KbT 4.2e+23)
(/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
(fma 0.5 NaChar (* 0.5 NdChar)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (KbT <= -8.5e+163) {
tmp = 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
} else if (KbT <= 4.2e+23) {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
} else {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (KbT <= -8.5e+163) tmp = Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))); elseif (KbT <= 4.2e+23) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); else tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[KbT, -8.5e+163], N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 4.2e+23], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -8.5 \cdot 10^{+163}:\\
\;\;\;\;0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)\\
\mathbf{elif}\;KbT \leq 4.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\end{array}
\end{array}
if KbT < -8.5000000000000003e163Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites72.7%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6465.1
Applied rewrites65.1%
if -8.5000000000000003e163 < KbT < 4.2000000000000003e23Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6466.4
Applied rewrites66.4%
Taylor expanded in EAccept around inf
Applied rewrites35.6%
if 4.2000000000000003e23 < KbT Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Final simplification41.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= Ev -0.0048) (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (Ev <= -0.0048) {
tmp = NaChar / (1.0 + exp((Ev / KbT)));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if (ev <= (-0.0048d0)) then
tmp = nachar / (1.0d0 + exp((ev / kbt)))
else
tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (Ev <= -0.0048) {
tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
} else {
tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if Ev <= -0.0048: tmp = NaChar / (1.0 + math.exp((Ev / KbT))) else: tmp = NaChar / (1.0 + math.exp((EAccept / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (Ev <= -0.0048) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (Ev <= -0.0048) tmp = NaChar / (1.0 + exp((Ev / KbT))); else tmp = NaChar / (1.0 + exp((EAccept / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[Ev, -0.0048], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;Ev \leq -0.0048:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if Ev < -0.00479999999999999958Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6460.2
Applied rewrites60.2%
Taylor expanded in Ev around inf
Applied rewrites51.9%
if -0.00479999999999999958 < Ev Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6462.0
Applied rewrites62.0%
Taylor expanded in EAccept around inf
Applied rewrites37.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NdChar -8.5e-62) (not (<= NdChar 1.4e-36))) (* 0.5 NdChar) (* 0.5 NaChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -8.5e-62) || !(NdChar <= 1.4e-36)) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((ndchar <= (-8.5d-62)) .or. (.not. (ndchar <= 1.4d-36))) then
tmp = 0.5d0 * ndchar
else
tmp = 0.5d0 * nachar
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NdChar <= -8.5e-62) || !(NdChar <= 1.4e-36)) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NdChar <= -8.5e-62) or not (NdChar <= 1.4e-36): tmp = 0.5 * NdChar else: tmp = 0.5 * NaChar return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NdChar <= -8.5e-62) || !(NdChar <= 1.4e-36)) tmp = Float64(0.5 * NdChar); else tmp = Float64(0.5 * NaChar); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NdChar <= -8.5e-62) || ~((NdChar <= 1.4e-36))) tmp = 0.5 * NdChar; else tmp = 0.5 * NaChar; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -8.5e-62], N[Not[LessEqual[NdChar, 1.4e-36]], $MachinePrecision]], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -8.5 \cdot 10^{-62} \lor \neg \left(NdChar \leq 1.4 \cdot 10^{-36}\right):\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NaChar\\
\end{array}
\end{array}
if NdChar < -8.4999999999999995e-62 or 1.4000000000000001e-36 < NdChar Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
Taylor expanded in NdChar around inf
lower-*.f6422.9
Applied rewrites22.9%
if -8.4999999999999995e-62 < NdChar < 1.4000000000000001e-36Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f6477.8
Applied rewrites77.8%
Taylor expanded in KbT around inf
lower-*.f6429.0
Applied rewrites29.0%
Final simplification25.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.25 (fma 2.0 NaChar (* 2.0 NdChar))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.25 * fma(2.0, NaChar, (2.0 * NdChar));
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.25 * fma(2.0, NaChar, Float64(2.0 * NdChar))) end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.25 * N[(2.0 * NaChar + N[(2.0 * NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.25 \cdot \mathsf{fma}\left(2, NaChar, 2 \cdot NdChar\right)
\end{array}
Initial program 100.0%
frac-addN/A
lower-/.f64N/A
Applied rewrites40.2%
Taylor expanded in KbT around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f6427.8
Applied rewrites27.8%
Final simplification27.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (fma 0.5 NaChar (* 0.5 NdChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return fma(0.5, NaChar, (0.5 * NdChar));
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return fma(0.5, NaChar, Float64(0.5 * NdChar)) end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6427.8
Applied rewrites27.8%
(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
lower-fma.f64N/A
lower-*.f6427.8
Applied rewrites27.8%
Taylor expanded in NdChar around inf
lower-*.f6417.1
Applied rewrites17.1%
herbie shell --seed 2025044
(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))))))