
(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))));
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 17 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))));
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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))));
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_2 (/ NaChar (+ 1.0 t_1)))
(t_3 (+ t_0 t_2)))
(if (<= t_3 -4e-294)
(+ (/ NdChar (+ 1.0 (exp (/ mu KbT)))) t_2)
(if (<= t_3 1e-189)
(/ NaChar (+ t_1 1.0))
(+ t_0 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_2 = NaChar / (1.0 + t_1);
double t_3 = t_0 + t_2;
double tmp;
if (t_3 <= -4e-294) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_2;
} else if (t_3 <= 1e-189) {
tmp = NaChar / (t_1 + 1.0);
} else {
tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT))));
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
t_1 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_2 = nachar / (1.0d0 + t_1)
t_3 = t_0 + t_2
if (t_3 <= (-4d-294)) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + t_2
else if (t_3 <= 1d-189) then
tmp = nachar / (t_1 + 1.0d0)
else
tmp = t_0 + (nachar / (1.0d0 + exp((eaccept / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
double t_1 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_2 = NaChar / (1.0 + t_1);
double t_3 = t_0 + t_2;
double tmp;
if (t_3 <= -4e-294) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_2;
} else if (t_3 <= 1e-189) {
tmp = NaChar / (t_1 + 1.0);
} else {
tmp = t_0 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT))) t_1 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_2 = NaChar / (1.0 + t_1) t_3 = t_0 + t_2 tmp = 0 if t_3 <= -4e-294: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_2 elif t_3 <= 1e-189: tmp = NaChar / (t_1 + 1.0) else: tmp = t_0 + (NaChar / (1.0 + math.exp((EAccept / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) t_1 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_2 = Float64(NaChar / Float64(1.0 + t_1)) t_3 = Float64(t_0 + t_2) tmp = 0.0 if (t_3 <= -4e-294) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_2); elseif (t_3 <= 1e-189) tmp = Float64(NaChar / Float64(t_1 + 1.0)); else tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT))); t_1 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_2 = NaChar / (1.0 + t_1); t_3 = t_0 + t_2; tmp = 0.0; if (t_3 <= -4e-294) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_2; elseif (t_3 <= 1e-189) tmp = NaChar / (t_1 + 1.0); else tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(NaChar / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-294], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 1e-189], N[(NaChar / N[(t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\
t_1 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_2 := \frac{NaChar}{1 + t\_1}\\
t_3 := t\_0 + t\_2\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{-294}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{-189}:\\
\;\;\;\;\frac{NaChar}{t\_1 + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.00000000000000007e-294Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6484.2
Applied rewrites84.2%
if -4.00000000000000007e-294 < (+.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.00000000000000007e-189Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6486.1
Applied rewrites86.1%
if 1.00000000000000007e-189 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in EAccept around inf
lower-/.f6474.2
Applied rewrites74.2%
Final simplification81.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (or (<= t_2 -4e-294) (not (<= t_2 1e-170)))
(+ (/ NdChar (+ 1.0 (exp (/ mu KbT)))) t_1)
(/ NaChar (+ t_0 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -4e-294) || !(t_2 <= 1e-170)) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if ((t_2 <= (-4d-294)) .or. (.not. (t_2 <= 1d-170))) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + t_1
else
tmp = nachar / (t_0 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -4e-294) || !(t_2 <= 1e-170)) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if (t_2 <= -4e-294) or not (t_2 <= 1e-170): tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + t_1 else: tmp = NaChar / (t_0 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if ((t_2 <= -4e-294) || !(t_2 <= 1e-170)) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + t_1); else tmp = Float64(NaChar / Float64(t_0 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if ((t_2 <= -4e-294) || ~((t_2 <= 1e-170))) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + t_1; else tmp = NaChar / (t_0 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -4e-294], N[Not[LessEqual[t$95$2, 1e-170]], $MachinePrecision]], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{-294} \lor \neg \left(t\_2 \leq 10^{-170}\right):\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.00000000000000007e-294 or 9.99999999999999983e-171 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6480.0
Applied rewrites80.0%
if -4.00000000000000007e-294 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 9.99999999999999983e-171Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6484.3
Applied rewrites84.3%
Final simplification81.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 t_0)))))
(if (<= t_1 -2e-268)
(+
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(/ NaChar (+ 1.0 (exp (/ (- mu) KbT)))))
(if (<= t_1 1e+139)
(/ NaChar (+ t_0 1.0))
(+
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ Ev KbT)))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0));
double tmp;
if (t_1 <= -2e-268) {
tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((-mu / KbT))));
} else if (t_1 <= 1e+139) {
tmp = NaChar / (t_0 + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((Ev / KbT))));
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + t_0))
if (t_1 <= (-2d-268)) then
tmp = (ndchar / (1.0d0 + exp((mu / kbt)))) + (nachar / (1.0d0 + exp((-mu / kbt))))
else if (t_1 <= 1d+139) then
tmp = nachar / (t_0 + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + exp((ev / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0));
double tmp;
if (t_1 <= -2e-268) {
tmp = (NdChar / (1.0 + Math.exp((mu / KbT)))) + (NaChar / (1.0 + Math.exp((-mu / KbT))));
} else if (t_1 <= 1e+139) {
tmp = NaChar / (t_0 + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + Math.exp((Ev / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0)) tmp = 0 if t_1 <= -2e-268: tmp = (NdChar / (1.0 + math.exp((mu / KbT)))) + (NaChar / (1.0 + math.exp((-mu / KbT)))) elif t_1 <= 1e+139: tmp = NaChar / (t_0 + 1.0) else: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + math.exp((Ev / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + t_0))) tmp = 0.0 if (t_1 <= -2e-268) tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(-mu) / KbT))))); elseif (t_1 <= 1e+139) tmp = Float64(NaChar / Float64(t_0 + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0)); tmp = 0.0; if (t_1 <= -2e-268) tmp = (NdChar / (1.0 + exp((mu / KbT)))) + (NaChar / (1.0 + exp((-mu / KbT)))); elseif (t_1 <= 1e+139) tmp = NaChar / (t_0 + 1.0); else tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((Ev / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-268], N[(N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+139], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + t\_0}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-268}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}} + \frac{NaChar}{1 + e^{\frac{-mu}{KbT}}}\\
\mathbf{elif}\;t\_1 \leq 10^{+139}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.99999999999999992e-268Initial program 100.0%
Taylor expanded in mu around inf
lower-/.f6484.6
Applied rewrites84.6%
Taylor expanded in mu around inf
mul-1-negN/A
lower-neg.f6468.1
Applied rewrites68.1%
if -1.99999999999999992e-268 < (+.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.00000000000000003e139Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6475.2
Applied rewrites75.2%
if 1.00000000000000003e139 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6484.8
Applied rewrites84.8%
Taylor expanded in EDonor around inf
lower-/.f6470.0
Applied rewrites70.0%
Final simplification71.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (<= t_2 -5e-14)
(+ (* 0.5 NdChar) t_1)
(if (<= t_2 1e+139)
(/ NaChar (+ t_0 1.0))
(+
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(/ NaChar (+ 1.0 (exp (/ Ev KbT)))))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -5e-14) {
tmp = (0.5 * NdChar) + t_1;
} else if (t_2 <= 1e+139) {
tmp = NaChar / (t_0 + 1.0);
} else {
tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((Ev / KbT))));
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if (t_2 <= (-5d-14)) then
tmp = (0.5d0 * ndchar) + t_1
else if (t_2 <= 1d+139) then
tmp = nachar / (t_0 + 1.0d0)
else
tmp = (ndchar / (1.0d0 + exp((edonor / kbt)))) + (nachar / (1.0d0 + exp((ev / kbt))))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if (t_2 <= -5e-14) {
tmp = (0.5 * NdChar) + t_1;
} else if (t_2 <= 1e+139) {
tmp = NaChar / (t_0 + 1.0);
} else {
tmp = (NdChar / (1.0 + Math.exp((EDonor / KbT)))) + (NaChar / (1.0 + Math.exp((Ev / KbT))));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if t_2 <= -5e-14: tmp = (0.5 * NdChar) + t_1 elif t_2 <= 1e+139: tmp = NaChar / (t_0 + 1.0) else: tmp = (NdChar / (1.0 + math.exp((EDonor / KbT)))) + (NaChar / (1.0 + math.exp((Ev / KbT)))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if (t_2 <= -5e-14) tmp = Float64(Float64(0.5 * NdChar) + t_1); elseif (t_2 <= 1e+139) tmp = Float64(NaChar / Float64(t_0 + 1.0)); else tmp = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if (t_2 <= -5e-14) tmp = (0.5 * NdChar) + t_1; elseif (t_2 <= 1e+139) tmp = NaChar / (t_0 + 1.0); else tmp = (NdChar / (1.0 + exp((EDonor / KbT)))) + (NaChar / (1.0 + exp((Ev / KbT)))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-14], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1e+139], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-14}:\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+139}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-14Initial program 100.0%
Taylor expanded in KbT around inf
lower-*.f6466.9
Applied rewrites66.9%
if -5.0000000000000002e-14 < (+.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.00000000000000003e139Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6470.0
Applied rewrites70.0%
if 1.00000000000000003e139 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) Initial program 100.0%
Taylor expanded in Ev around inf
lower-/.f6484.8
Applied rewrites84.8%
Taylor expanded in EDonor around inf
lower-/.f6470.0
Applied rewrites70.0%
Final simplification69.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1 (/ NaChar (+ 1.0 t_0)))
(t_2
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
t_1)))
(if (or (<= t_2 -5e-14) (not (<= t_2 5e+109)))
(+ (* 0.5 NdChar) t_1)
(/ NaChar (+ t_0 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -5e-14) || !(t_2 <= 5e+109)) {
tmp = (0.5 * NdChar) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = nachar / (1.0d0 + t_0)
t_2 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + t_1
if ((t_2 <= (-5d-14)) .or. (.not. (t_2 <= 5d+109))) then
tmp = (0.5d0 * ndchar) + t_1
else
tmp = nachar / (t_0 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = NaChar / (1.0 + t_0);
double t_2 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1;
double tmp;
if ((t_2 <= -5e-14) || !(t_2 <= 5e+109)) {
tmp = (0.5 * NdChar) + t_1;
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = NaChar / (1.0 + t_0) t_2 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1 tmp = 0 if (t_2 <= -5e-14) or not (t_2 <= 5e+109): tmp = (0.5 * NdChar) + t_1 else: tmp = NaChar / (t_0 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(NaChar / Float64(1.0 + t_0)) t_2 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + t_1) tmp = 0.0 if ((t_2 <= -5e-14) || !(t_2 <= 5e+109)) tmp = Float64(Float64(0.5 * NdChar) + t_1); else tmp = Float64(NaChar / Float64(t_0 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = NaChar / (1.0 + t_0); t_2 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + t_1; tmp = 0.0; if ((t_2 <= -5e-14) || ~((t_2 <= 5e+109))) tmp = (0.5 * NdChar) + t_1; else tmp = NaChar / (t_0 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(NaChar / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-14], N[Not[LessEqual[t$95$2, 5e+109]], $MachinePrecision]], N[(N[(0.5 * NdChar), $MachinePrecision] + t$95$1), $MachinePrecision], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NaChar}{1 + t\_0}\\
t_2 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + t\_1\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-14} \lor \neg \left(t\_2 \leq 5 \cdot 10^{+109}\right):\\
\;\;\;\;0.5 \cdot NdChar + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000002e-14 or 5.0000000000000001e109 < (+.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-*.f6468.1
Applied rewrites68.1%
if -5.0000000000000002e-14 < (+.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.0000000000000001e109Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6470.0
Applied rewrites70.0%
Final simplification69.1%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 t_0)))))
(if (or (<= t_1 -5e+121) (not (<= t_1 1e+139)))
(+ (* 0.5 NdChar) (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept Ev) mu) KbT)))))
(/ NaChar (+ t_0 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0));
double tmp;
if ((t_1 <= -5e+121) || !(t_1 <= 1e+139)) {
tmp = (0.5 * NdChar) + (NaChar / (1.0 + exp((((EAccept + Ev) - mu) / KbT))));
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + t_0))
if ((t_1 <= (-5d+121)) .or. (.not. (t_1 <= 1d+139))) then
tmp = (0.5d0 * ndchar) + (nachar / (1.0d0 + exp((((eaccept + ev) - mu) / kbt))))
else
tmp = nachar / (t_0 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0));
double tmp;
if ((t_1 <= -5e+121) || !(t_1 <= 1e+139)) {
tmp = (0.5 * NdChar) + (NaChar / (1.0 + Math.exp((((EAccept + Ev) - mu) / KbT))));
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0)) tmp = 0 if (t_1 <= -5e+121) or not (t_1 <= 1e+139): tmp = (0.5 * NdChar) + (NaChar / (1.0 + math.exp((((EAccept + Ev) - mu) / KbT)))) else: tmp = NaChar / (t_0 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + t_0))) tmp = 0.0 if ((t_1 <= -5e+121) || !(t_1 <= 1e+139)) tmp = Float64(Float64(0.5 * NdChar) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Ev) - mu) / KbT))))); else tmp = Float64(NaChar / Float64(t_0 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0)); tmp = 0.0; if ((t_1 <= -5e+121) || ~((t_1 <= 1e+139))) tmp = (0.5 * NdChar) + (NaChar / (1.0 + exp((((EAccept + Ev) - mu) / KbT)))); else tmp = NaChar / (t_0 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(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 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+121], N[Not[LessEqual[t$95$1, 1e+139]], $MachinePrecision]], N[(N[(0.5 * NdChar), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + Ev), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + t\_0}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+121} \lor \neg \left(t\_1 \leq 10^{+139}\right):\\
\;\;\;\;0.5 \cdot NdChar + \frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.00000000000000007e121 or 1.00000000000000003e139 < (+.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-*.f6466.5
Applied rewrites66.5%
Taylor expanded in Vef around 0
lower--.f64N/A
lower-+.f6464.4
Applied rewrites64.4%
if -5.00000000000000007e121 < (+.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.00000000000000003e139Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6469.2
Applied rewrites69.2%
Final simplification67.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 t_0)))))
(if (or (<= t_1 -1e+251) (not (<= t_1 1e+139)))
(+ (* 0.5 NdChar) (/ NaChar (+ 1.0 (exp (/ (- mu) KbT)))))
(/ NaChar (+ t_0 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0));
double tmp;
if ((t_1 <= -1e+251) || !(t_1 <= 1e+139)) {
tmp = (0.5 * NdChar) + (NaChar / (1.0 + exp((-mu / KbT))));
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 = exp(((((ev + vef) + eaccept) - mu) / kbt))
t_1 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + t_0))
if ((t_1 <= (-1d+251)) .or. (.not. (t_1 <= 1d+139))) then
tmp = (0.5d0 * ndchar) + (nachar / (1.0d0 + exp((-mu / kbt))))
else
tmp = nachar / (t_0 + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT));
double t_1 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0));
double tmp;
if ((t_1 <= -1e+251) || !(t_1 <= 1e+139)) {
tmp = (0.5 * NdChar) + (NaChar / (1.0 + Math.exp((-mu / KbT))));
} else {
tmp = NaChar / (t_0 + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) t_1 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0)) tmp = 0 if (t_1 <= -1e+251) or not (t_1 <= 1e+139): tmp = (0.5 * NdChar) + (NaChar / (1.0 + math.exp((-mu / KbT)))) else: tmp = NaChar / (t_0 + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + t_0))) tmp = 0.0 if ((t_1 <= -1e+251) || !(t_1 <= 1e+139)) tmp = Float64(Float64(0.5 * NdChar) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(-mu) / KbT))))); else tmp = Float64(NaChar / Float64(t_0 + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = exp(((((Ev + Vef) + EAccept) - mu) / KbT)); t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + t_0)); tmp = 0.0; if ((t_1 <= -1e+251) || ~((t_1 <= 1e+139))) tmp = (0.5 * NdChar) + (NaChar / (1.0 + exp((-mu / KbT)))); else tmp = NaChar / (t_0 + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(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 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+251], N[Not[LessEqual[t$95$1, 1e+139]], $MachinePrecision]], N[(N[(0.5 * NdChar), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + t\_0}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+251} \lor \neg \left(t\_1 \leq 10^{+139}\right):\\
\;\;\;\;0.5 \cdot NdChar + \frac{NaChar}{1 + e^{\frac{-mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0 + 1}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1e251 or 1.00000000000000003e139 < (+.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-*.f6470.8
Applied rewrites70.8%
Taylor expanded in mu around inf
mul-1-negN/A
lower-neg.f6461.6
Applied rewrites61.6%
if -1e251 < (+.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.00000000000000003e139Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6466.4
Applied rewrites66.4%
Final simplification65.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_0 -1e-304) (not (<= t_0 1e-242)))
(* 0.5 (+ NdChar NaChar))
(/
NaChar
(- (+ (+ 2.0 (/ EAccept KbT)) (+ (/ Ev KbT) (/ Vef KbT))) (/ mu KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -1e-304) || !(t_0 <= 1e-242)) {
tmp = 0.5 * (NdChar + NaChar);
} else {
tmp = NaChar / (((2.0 + (EAccept / KbT)) + ((Ev / KbT) + (Vef / KbT))) - (mu / KbT));
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
if ((t_0 <= (-1d-304)) .or. (.not. (t_0 <= 1d-242))) then
tmp = 0.5d0 * (ndchar + nachar)
else
tmp = nachar / (((2.0d0 + (eaccept / kbt)) + ((ev / kbt) + (vef / kbt))) - (mu / kbt))
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -1e-304) || !(t_0 <= 1e-242)) {
tmp = 0.5 * (NdChar + NaChar);
} else {
tmp = NaChar / (((2.0 + (EAccept / KbT)) + ((Ev / KbT) + (Vef / KbT))) - (mu / KbT));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) tmp = 0 if (t_0 <= -1e-304) or not (t_0 <= 1e-242): tmp = 0.5 * (NdChar + NaChar) else: tmp = NaChar / (((2.0 + (EAccept / KbT)) + ((Ev / KbT) + (Vef / KbT))) - (mu / KbT)) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if ((t_0 <= -1e-304) || !(t_0 <= 1e-242)) tmp = Float64(0.5 * Float64(NdChar + NaChar)); else tmp = Float64(NaChar / Float64(Float64(Float64(2.0 + Float64(EAccept / KbT)) + Float64(Float64(Ev / KbT) + Float64(Vef / KbT))) - Float64(mu / KbT))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))); tmp = 0.0; if ((t_0 <= -1e-304) || ~((t_0 <= 1e-242))) tmp = 0.5 * (NdChar + NaChar); else tmp = NaChar / (((2.0 + (EAccept / KbT)) + ((Ev / KbT) + (Vef / KbT))) - (mu / KbT)); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -1e-304], N[Not[LessEqual[t$95$0, 1e-242]], $MachinePrecision]], N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(N[(N[(2.0 + N[(EAccept / KbT), $MachinePrecision]), $MachinePrecision] + N[(N[(Ev / KbT), $MachinePrecision] + N[(Vef / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(mu / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304} \lor \neg \left(t\_0 \leq 10^{-242}\right):\\
\;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{\left(\left(2 + \frac{EAccept}{KbT}\right) + \left(\frac{Ev}{KbT} + \frac{Vef}{KbT}\right)\right) - \frac{mu}{KbT}}\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999971e-305 or 1e-242 < (+.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
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6434.2
Applied rewrites34.2%
if -9.99999999999999971e-305 < (+.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-242Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6491.6
Applied rewrites91.6%
Taylor expanded in KbT around inf
Applied rewrites43.2%
Final simplification35.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NaChar (+ (exp (/ (- mu) KbT)) 1.0))))
(if (<= mu -3.7e+118)
t_0
(if (<= mu 1.5e-200)
(/ NaChar (+ (exp (/ EAccept KbT)) 1.0))
(if (<= mu 6e-40)
(fma -0.25 (* NdChar (/ mu KbT)) (* 0.5 (+ NdChar NaChar)))
t_0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NaChar / (exp((-mu / KbT)) + 1.0);
double tmp;
if (mu <= -3.7e+118) {
tmp = t_0;
} else if (mu <= 1.5e-200) {
tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
} else if (mu <= 6e-40) {
tmp = fma(-0.25, (NdChar * (mu / KbT)), (0.5 * (NdChar + NaChar)));
} else {
tmp = t_0;
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NaChar / Float64(exp(Float64(Float64(-mu) / KbT)) + 1.0)) tmp = 0.0 if (mu <= -3.7e+118) tmp = t_0; elseif (mu <= 1.5e-200) tmp = Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)); elseif (mu <= 6e-40) tmp = fma(-0.25, Float64(NdChar * Float64(mu / KbT)), Float64(0.5 * Float64(NdChar + NaChar))); else tmp = t_0; end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NaChar / N[(N[Exp[N[((-mu) / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[mu, -3.7e+118], t$95$0, If[LessEqual[mu, 1.5e-200], N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[mu, 6e-40], N[(-0.25 * N[(NdChar * N[(mu / KbT), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NaChar}{e^{\frac{-mu}{KbT}} + 1}\\
\mathbf{if}\;mu \leq -3.7 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;mu \leq 1.5 \cdot 10^{-200}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\
\mathbf{elif}\;mu \leq 6 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, NdChar \cdot \frac{mu}{KbT}, 0.5 \cdot \left(NdChar + NaChar\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if mu < -3.69999999999999987e118 or 6.00000000000000039e-40 < mu Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6463.0
Applied rewrites63.0%
Taylor expanded in mu around inf
Applied rewrites54.3%
if -3.69999999999999987e118 < mu < 1.49999999999999997e-200Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6463.2
Applied rewrites63.2%
Taylor expanded in EAccept around inf
Applied rewrites37.8%
if 1.49999999999999997e-200 < mu < 6.00000000000000039e-40Initial program 100.0%
Taylor expanded in KbT around -inf
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
Applied rewrites37.9%
Taylor expanded in mu around inf
Applied rewrites45.3%
Taylor expanded in NdChar around inf
Applied rewrites46.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= EAccept 1.26e-58)
(/ NaChar (+ (exp (/ Ev KbT)) 1.0))
(if (<= EAccept 1.05e+75)
(/ NaChar (+ (exp (/ Vef KbT)) 1.0))
(/ NaChar (+ (exp (/ EAccept KbT)) 1.0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= 1.26e-58) {
tmp = NaChar / (exp((Ev / KbT)) + 1.0);
} else if (EAccept <= 1.05e+75) {
tmp = NaChar / (exp((Vef / KbT)) + 1.0);
} else {
tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 <= 1.26d-58) then
tmp = nachar / (exp((ev / kbt)) + 1.0d0)
else if (eaccept <= 1.05d+75) then
tmp = nachar / (exp((vef / kbt)) + 1.0d0)
else
tmp = nachar / (exp((eaccept / kbt)) + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= 1.26e-58) {
tmp = NaChar / (Math.exp((Ev / KbT)) + 1.0);
} else if (EAccept <= 1.05e+75) {
tmp = NaChar / (Math.exp((Vef / KbT)) + 1.0);
} else {
tmp = NaChar / (Math.exp((EAccept / KbT)) + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if EAccept <= 1.26e-58: tmp = NaChar / (math.exp((Ev / KbT)) + 1.0) elif EAccept <= 1.05e+75: tmp = NaChar / (math.exp((Vef / KbT)) + 1.0) else: tmp = NaChar / (math.exp((EAccept / KbT)) + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EAccept <= 1.26e-58) tmp = Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0)); elseif (EAccept <= 1.05e+75) tmp = Float64(NaChar / Float64(exp(Float64(Vef / KbT)) + 1.0)); else tmp = Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (EAccept <= 1.26e-58) tmp = NaChar / (exp((Ev / KbT)) + 1.0); elseif (EAccept <= 1.05e+75) tmp = NaChar / (exp((Vef / KbT)) + 1.0); else tmp = NaChar / (exp((EAccept / KbT)) + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, 1.26e-58], N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 1.05e+75], N[(NaChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;EAccept \leq 1.26 \cdot 10^{-58}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\
\mathbf{elif}\;EAccept \leq 1.05 \cdot 10^{+75}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\
\end{array}
\end{array}
if EAccept < 1.2600000000000001e-58Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6462.1
Applied rewrites62.1%
Taylor expanded in Ev around inf
Applied rewrites43.1%
if 1.2600000000000001e-58 < EAccept < 1.04999999999999999e75Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6451.6
Applied rewrites51.6%
Taylor expanded in Vef around inf
Applied rewrites44.0%
if 1.04999999999999999e75 < EAccept Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6459.3
Applied rewrites59.3%
Taylor expanded in EAccept around inf
Applied rewrites43.3%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (* 0.5 (+ NdChar NaChar))))
(if (<= KbT -1.35e+122)
(fma -0.25 (* (/ NaChar KbT) Vef) t_0)
(if (<= KbT 4.4e+91)
(/ NaChar (+ (exp (/ EAccept KbT)) 1.0))
(fma -0.25 (* Ev (/ NaChar KbT)) t_0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = 0.5 * (NdChar + NaChar);
double tmp;
if (KbT <= -1.35e+122) {
tmp = fma(-0.25, ((NaChar / KbT) * Vef), t_0);
} else if (KbT <= 4.4e+91) {
tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
} else {
tmp = fma(-0.25, (Ev * (NaChar / KbT)), t_0);
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(0.5 * Float64(NdChar + NaChar)) tmp = 0.0 if (KbT <= -1.35e+122) tmp = fma(-0.25, Float64(Float64(NaChar / KbT) * Vef), t_0); elseif (KbT <= 4.4e+91) tmp = Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)); else tmp = fma(-0.25, Float64(Ev * Float64(NaChar / KbT)), t_0); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -1.35e+122], N[(-0.25 * N[(N[(NaChar / KbT), $MachinePrecision] * Vef), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[KbT, 4.4e+91], N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(Ev * N[(NaChar / KbT), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -1.35 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, \frac{NaChar}{KbT} \cdot Vef, t\_0\right)\\
\mathbf{elif}\;KbT \leq 4.4 \cdot 10^{+91}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, Ev \cdot \frac{NaChar}{KbT}, t\_0\right)\\
\end{array}
\end{array}
if KbT < -1.3499999999999999e122Initial program 100.0%
Taylor expanded in KbT around -inf
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
Applied rewrites61.5%
Taylor expanded in Vef around inf
Applied rewrites66.8%
Taylor expanded in NdChar around 0
Applied rewrites66.8%
if -1.3499999999999999e122 < KbT < 4.39999999999999999e91Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6463.6
Applied rewrites63.6%
Taylor expanded in EAccept around inf
Applied rewrites33.4%
if 4.39999999999999999e91 < KbT Initial program 100.0%
Taylor expanded in KbT around -inf
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
Applied rewrites49.5%
Taylor expanded in Ev around inf
Applied rewrites52.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (/ NaChar (+ (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)) 1.0)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return NaChar / (exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0);
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = nachar / (exp(((((ev + vef) + eaccept) - mu) / kbt)) + 1.0d0)
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return NaChar / (Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0);
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return NaChar / (math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0)
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(NaChar / Float64(exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)) + 1.0)) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = NaChar / (exp(((((Ev + Vef) + EAccept) - mu) / KbT)) + 1.0); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(NaChar / N[(N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{NaChar}{e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}} + 1}
\end{array}
Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6460.6
Applied rewrites60.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (<= EAccept 1e-57) (/ NaChar (+ (exp (/ Ev KbT)) 1.0)) (/ NaChar (+ (exp (/ EAccept KbT)) 1.0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= 1e-57) {
tmp = NaChar / (exp((Ev / KbT)) + 1.0);
} else {
tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 <= 1d-57) then
tmp = nachar / (exp((ev / kbt)) + 1.0d0)
else
tmp = nachar / (exp((eaccept / kbt)) + 1.0d0)
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if (EAccept <= 1e-57) {
tmp = NaChar / (Math.exp((Ev / KbT)) + 1.0);
} else {
tmp = NaChar / (Math.exp((EAccept / KbT)) + 1.0);
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if EAccept <= 1e-57: tmp = NaChar / (math.exp((Ev / KbT)) + 1.0) else: tmp = NaChar / (math.exp((EAccept / KbT)) + 1.0) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EAccept <= 1e-57) tmp = Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0)); else tmp = Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if (EAccept <= 1e-57) tmp = NaChar / (exp((Ev / KbT)) + 1.0); else tmp = NaChar / (exp((EAccept / KbT)) + 1.0); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, 1e-57], N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;EAccept \leq 10^{-57}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\
\end{array}
\end{array}
if EAccept < 9.99999999999999955e-58Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6462.1
Applied rewrites62.1%
Taylor expanded in Ev around inf
Applied rewrites43.1%
if 9.99999999999999955e-58 < EAccept Initial program 100.0%
Taylor expanded in NdChar around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6456.7
Applied rewrites56.7%
Taylor expanded in EAccept around inf
Applied rewrites38.8%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NdChar -2.35e+84) (not (<= NdChar 7.2e+139))) (* 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 <= -2.35e+84) || !(NdChar <= 7.2e+139)) {
tmp = 0.5 * NdChar;
} else {
tmp = 0.5 * NaChar;
}
return tmp;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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.35d+84)) .or. (.not. (ndchar <= 7.2d+139))) 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 <= -2.35e+84) || !(NdChar <= 7.2e+139)) {
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 <= -2.35e+84) or not (NdChar <= 7.2e+139): 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 <= -2.35e+84) || !(NdChar <= 7.2e+139)) 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 <= -2.35e+84) || ~((NdChar <= 7.2e+139))) 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, -2.35e+84], N[Not[LessEqual[NdChar, 7.2e+139]], $MachinePrecision]], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -2.35 \cdot 10^{+84} \lor \neg \left(NdChar \leq 7.2 \cdot 10^{+139}\right):\\
\;\;\;\;0.5 \cdot NdChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NaChar\\
\end{array}
\end{array}
if NdChar < -2.3499999999999999e84 or 7.19999999999999971e139 < NdChar Initial program 100.0%
Taylor expanded in KbT around inf
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6431.3
Applied rewrites31.3%
Taylor expanded in NdChar around 0
Applied rewrites8.1%
Taylor expanded in NdChar around inf
Applied rewrites29.8%
if -2.3499999999999999e84 < NdChar < 7.19999999999999971e139Initial program 100.0%
Taylor expanded in KbT around inf
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6427.6
Applied rewrites27.6%
Taylor expanded in NdChar around 0
Applied rewrites25.1%
Final simplification26.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 (+ NdChar NaChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * (NdChar + NaChar);
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
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 + nachar)
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * (NdChar + NaChar);
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * (NdChar + NaChar)
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * Float64(NdChar + NaChar)) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * (NdChar + NaChar); end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(NdChar + NaChar\right)
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.9
Applied rewrites28.9%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (* 0.5 NaChar))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * nachar
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * NaChar
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * NaChar) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * NaChar; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot NaChar
\end{array}
Initial program 100.0%
Taylor expanded in KbT around inf
+-commutativeN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6428.9
Applied rewrites28.9%
Taylor expanded in NdChar around 0
Applied rewrites19.4%
herbie shell --seed 2024322
(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))))))