
(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 18 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 (fma 0.5 NaChar (* 0.5 NdChar)))
(t_1
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (<= t_1 -2e-203)
t_0
(if (<= t_1 0.0)
(*
NaChar
(/
NdChar
(fma 2.0 NaChar (/ (* NaChar (- (+ EDonor (+ Vef mu)) Ec)) KbT))))
(if (<= t_1 2e-17) (/ NaChar (+ 1.0 (exp (/ Ev 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 = fma(0.5, NaChar, (0.5 * NdChar));
double t_1 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if (t_1 <= -2e-203) {
tmp = t_0;
} else if (t_1 <= 0.0) {
tmp = NaChar * (NdChar / fma(2.0, NaChar, ((NaChar * ((EDonor + (Vef + mu)) - Ec)) / KbT)));
} else if (t_1 <= 2e-17) {
tmp = NaChar / (1.0 + exp((Ev / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = fma(0.5, NaChar, Float64(0.5 * NdChar)) t_1 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))) tmp = 0.0 if (t_1 <= -2e-203) tmp = t_0; elseif (t_1 <= 0.0) tmp = Float64(NaChar * Float64(NdChar / fma(2.0, NaChar, Float64(Float64(NaChar * Float64(Float64(EDonor + Float64(Vef + mu)) - Ec)) / KbT)))); elseif (t_1 <= 2e-17) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))); else tmp = t_0; end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-203], t$95$0, If[LessEqual[t$95$1, 0.0], N[(NaChar * N[(NdChar / N[(2.0 * NaChar + N[(N[(NaChar * N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-17], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
t_1 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-203}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;NaChar \cdot \frac{NdChar}{\mathsf{fma}\left(2, NaChar, \frac{NaChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT}\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2.0000000000000001e-203 or 2.00000000000000014e-17 < (+.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-*.f6441.5
Applied rewrites41.5%
if -2.0000000000000001e-203 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 0.0Initial program 100.0%
Taylor expanded in NaChar around inf
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites98.3%
Taylor expanded in NdChar around inf
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f6498.3
Applied rewrites98.3%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift--.f6464.1
Applied rewrites64.1%
if 0.0 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2.00000000000000014e-17Initial 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
lift-+.f6453.8
Applied rewrites53.8%
Taylor expanded in Ev around inf
Applied rewrites33.1%
Final simplification45.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 (or (<= t_0 -2e-203) (not (<= t_0 5e-95)))
(fma 0.5 NaChar (* 0.5 NdChar))
(*
NaChar
(/
NdChar
(fma 2.0 NaChar (/ (* NaChar (- (+ 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)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -2e-203) || !(t_0 <= 5e-95)) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = NaChar * (NdChar / fma(2.0, NaChar, ((NaChar * ((EDonor + (Vef + mu)) - Ec)) / 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 <= -2e-203) || !(t_0 <= 5e-95)) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(NaChar * Float64(NdChar / fma(2.0, NaChar, Float64(Float64(NaChar * Float64(Float64(EDonor + Float64(Vef + mu)) - Ec)) / KbT)))); 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[Or[LessEqual[t$95$0, -2e-203], N[Not[LessEqual[t$95$0, 5e-95]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NaChar * N[(NdChar / N[(2.0 * NaChar + N[(N[(NaChar * N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision]), $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}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-203} \lor \neg \left(t\_0 \leq 5 \cdot 10^{-95}\right):\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;NaChar \cdot \frac{NdChar}{\mathsf{fma}\left(2, NaChar, \frac{NaChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT}\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))))) < -2.0000000000000001e-203 or 4.9999999999999998e-95 < (+.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-*.f6441.1
Applied rewrites41.1%
if -2.0000000000000001e-203 < (+.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-95Initial program 100.0%
Taylor expanded in NaChar around inf
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites97.5%
Taylor expanded in NdChar around inf
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f6484.8
Applied rewrites84.8%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift--.f6448.9
Applied rewrites48.9%
Final simplification43.5%
(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 -2e-203) (not (<= t_0 5e-95)))
(fma 0.5 NaChar (* 0.5 NdChar))
(/ NdChar (- (+ 2.0 (/ (+ EDonor (+ Vef mu)) KbT)) (/ 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)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
double tmp;
if ((t_0 <= -2e-203) || !(t_0 <= 5e-95)) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = NdChar / ((2.0 + ((EDonor + (Vef + mu)) / KbT)) - (Ec / 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 <= -2e-203) || !(t_0 <= 5e-95)) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(NdChar / Float64(Float64(2.0 + Float64(Float64(EDonor + Float64(Vef + mu)) / KbT)) - Float64(Ec / KbT))); 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[Or[LessEqual[t$95$0, -2e-203], N[Not[LessEqual[t$95$0, 5e-95]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(N[(2.0 + N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] - N[(Ec / 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 -2 \cdot 10^{-203} \lor \neg \left(t\_0 \leq 5 \cdot 10^{-95}\right):\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{\left(2 + \frac{EDonor + \left(Vef + mu\right)}{KbT}\right) - \frac{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))))) < -2.0000000000000001e-203 or 4.9999999999999998e-95 < (+.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-*.f6441.1
Applied rewrites41.1%
if -2.0000000000000001e-203 < (+.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-95Initial 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-+.f6487.3
Applied rewrites87.3%
Taylor expanded in KbT around inf
lower--.f64N/A
div-add-revN/A
div-addN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f6441.5
Applied rewrites41.5%
Final simplification41.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 (or (<= t_0 -1e-163) (not (<= t_0 2e-267)))
(fma 0.5 NaChar (* 0.5 NdChar))
(/ NaChar (- (+ 2.0 (/ (+ EAccept (+ Ev 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-163) || !(t_0 <= 2e-267)) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = NaChar / ((2.0 + ((EAccept + (Ev + 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-163) || !(t_0 <= 2e-267)) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(NaChar / Float64(Float64(2.0 + Float64(Float64(EAccept + Float64(Ev + Vef)) / KbT)) - Float64(mu / KbT))); 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[Or[LessEqual[t$95$0, -1e-163], N[Not[LessEqual[t$95$0, 2e-267]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(N[(2.0 + N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] / KbT), $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^{-163} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-267}\right):\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\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.99999999999999923e-164 or 2e-267 < (+.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.9
Applied rewrites37.9%
if -9.99999999999999923e-164 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2e-267Initial 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
lift-+.f6489.7
Applied rewrites89.7%
Taylor expanded in KbT around inf
lower--.f64N/A
lower-+.f64N/A
div-add-revN/A
div-addN/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f6445.5
Applied rewrites45.5%
Final simplification39.7%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0
(+
(/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
(/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
(if (or (<= t_0 -4e-308) (not (<= t_0 2e-289)))
(fma 0.5 NaChar (* 0.5 NdChar))
(* -0.25 (/ (* EAccept NaChar) 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 <= -4e-308) || !(t_0 <= 2e-289)) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = -0.25 * ((EAccept * NaChar) / 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 <= -4e-308) || !(t_0 <= 2e-289)) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(-0.25 * Float64(Float64(EAccept * NaChar) / KbT)); 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[Or[LessEqual[t$95$0, -4e-308], N[Not[LessEqual[t$95$0, 2e-289]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(EAccept * NaChar), $MachinePrecision] / KbT), $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 -4 \cdot 10^{-308} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-289}\right):\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \frac{EAccept \cdot NaChar}{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.00000000000000013e-308 or 2e-289 < (+.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-*.f6436.4
Applied rewrites36.4%
if -4.00000000000000013e-308 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2e-289Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
Applied rewrites1.8%
Taylor expanded in EAccept around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6416.4
Applied rewrites16.4%
Final simplification32.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (or (<= NaChar -2.2e+78)
(not
(or (<= NaChar 4e-147)
(not (or (<= NaChar 2.1e+26) (not (<= NaChar 1.5e+104)))))))
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) 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 tmp;
if ((NaChar <= -2.2e+78) || !((NaChar <= 4e-147) || !((NaChar <= 2.1e+26) || !(NaChar <= 1.5e+104)))) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / 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) :: tmp
if ((nachar <= (-2.2d+78)) .or. (.not. (nachar <= 4d-147) .or. (.not. (nachar <= 2.1d+26) .or. (.not. (nachar <= 1.5d+104))))) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / 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 tmp;
if ((NaChar <= -2.2e+78) || !((NaChar <= 4e-147) || !((NaChar <= 2.1e+26) || !(NaChar <= 1.5e+104)))) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / 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): tmp = 0 if (NaChar <= -2.2e+78) or not ((NaChar <= 4e-147) or not ((NaChar <= 2.1e+26) or not (NaChar <= 1.5e+104))): tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / 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) tmp = 0.0 if ((NaChar <= -2.2e+78) || !((NaChar <= 4e-147) || !((NaChar <= 2.1e+26) || !(NaChar <= 1.5e+104)))) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / 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) tmp = 0.0; if ((NaChar <= -2.2e+78) || ~(((NaChar <= 4e-147) || ~(((NaChar <= 2.1e+26) || ~((NaChar <= 1.5e+104))))))) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / 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_] := If[Or[LessEqual[NaChar, -2.2e+78], N[Not[Or[LessEqual[NaChar, 4e-147], N[Not[Or[LessEqual[NaChar, 2.1e+26], N[Not[LessEqual[NaChar, 1.5e+104]], $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], 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}
\mathbf{if}\;NaChar \leq -2.2 \cdot 10^{+78} \lor \neg \left(NaChar \leq 4 \cdot 10^{-147} \lor \neg \left(NaChar \leq 2.1 \cdot 10^{+26} \lor \neg \left(NaChar \leq 1.5 \cdot 10^{+104}\right)\right)\right):\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\
\end{array}
\end{array}
if NaChar < -2.20000000000000014e78 or 3.9999999999999999e-147 < NaChar < 2.1000000000000001e26 or 1.49999999999999984e104 < NaChar 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
lift-+.f6477.1
Applied rewrites77.1%
if -2.20000000000000014e78 < NaChar < 3.9999999999999999e-147 or 2.1000000000000001e26 < NaChar < 1.49999999999999984e104Initial 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-+.f6481.7
Applied rewrites81.7%
Final simplification79.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (or (<= NaChar -1.5e+18)
(not
(or (<= NaChar -3.55e-124)
(not (or (<= NaChar -5.2e-232) (not (<= NaChar 3.8e-147)))))))
(/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
(/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NaChar <= -1.5e+18) || !((NaChar <= -3.55e-124) || !((NaChar <= -5.2e-232) || !(NaChar <= 3.8e-147)))) {
tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = NdChar / (1.0 + exp(((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) :: tmp
if ((nachar <= (-1.5d+18)) .or. (.not. (nachar <= (-3.55d-124)) .or. (.not. (nachar <= (-5.2d-232)) .or. (.not. (nachar <= 3.8d-147))))) then
tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
else
tmp = ndchar / (1.0d0 + exp(((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 tmp;
if ((NaChar <= -1.5e+18) || !((NaChar <= -3.55e-124) || !((NaChar <= -5.2e-232) || !(NaChar <= 3.8e-147)))) {
tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
} else {
tmp = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NaChar <= -1.5e+18) or not ((NaChar <= -3.55e-124) or not ((NaChar <= -5.2e-232) or not (NaChar <= 3.8e-147))): tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT))) else: tmp = NdChar / (1.0 + math.exp(((mu - Ec) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NaChar <= -1.5e+18) || !((NaChar <= -3.55e-124) || !((NaChar <= -5.2e-232) || !(NaChar <= 3.8e-147)))) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT)))); else tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NaChar <= -1.5e+18) || ~(((NaChar <= -3.55e-124) || ~(((NaChar <= -5.2e-232) || ~((NaChar <= 3.8e-147))))))) tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT))); else tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NaChar, -1.5e+18], N[Not[Or[LessEqual[NaChar, -3.55e-124], N[Not[Or[LessEqual[NaChar, -5.2e-232], N[Not[LessEqual[NaChar, 3.8e-147]], $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], N[(NdChar / N[(1.0 + N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NaChar \leq -1.5 \cdot 10^{+18} \lor \neg \left(NaChar \leq -3.55 \cdot 10^{-124} \lor \neg \left(NaChar \leq -5.2 \cdot 10^{-232} \lor \neg \left(NaChar \leq 3.8 \cdot 10^{-147}\right)\right)\right):\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
\end{array}
\end{array}
if NaChar < -1.5e18 or -3.55000000000000019e-124 < NaChar < -5.19999999999999992e-232 or 3.80000000000000028e-147 < NaChar 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
lift-+.f6472.2
Applied rewrites72.2%
if -1.5e18 < NaChar < -3.55000000000000019e-124 or -5.19999999999999992e-232 < NaChar < 3.80000000000000028e-147Initial 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-+.f6487.8
Applied rewrites87.8%
Taylor expanded in mu around inf
Applied rewrites73.0%
Final simplification72.5%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (or (<= NaChar -1.6e+106)
(not
(or (<= NaChar 4e-147)
(not (or (<= NaChar 3.1e+32) (not (<= NaChar 1.5e+104)))))))
(/ NaChar (+ 1.0 (exp (/ (- Vef mu) KbT))))
(/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NaChar <= -1.6e+106) || !((NaChar <= 4e-147) || !((NaChar <= 3.1e+32) || !(NaChar <= 1.5e+104)))) {
tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
} else {
tmp = NdChar / (1.0 + exp(((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) :: tmp
if ((nachar <= (-1.6d+106)) .or. (.not. (nachar <= 4d-147) .or. (.not. (nachar <= 3.1d+32) .or. (.not. (nachar <= 1.5d+104))))) then
tmp = nachar / (1.0d0 + exp(((vef - mu) / kbt)))
else
tmp = ndchar / (1.0d0 + exp(((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 tmp;
if ((NaChar <= -1.6e+106) || !((NaChar <= 4e-147) || !((NaChar <= 3.1e+32) || !(NaChar <= 1.5e+104)))) {
tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
} else {
tmp = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NaChar <= -1.6e+106) or not ((NaChar <= 4e-147) or not ((NaChar <= 3.1e+32) or not (NaChar <= 1.5e+104))): tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT))) else: tmp = NdChar / (1.0 + math.exp(((mu - Ec) / KbT))) return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NaChar <= -1.6e+106) || !((NaChar <= 4e-147) || !((NaChar <= 3.1e+32) || !(NaChar <= 1.5e+104)))) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT)))); else tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT)))); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NaChar <= -1.6e+106) || ~(((NaChar <= 4e-147) || ~(((NaChar <= 3.1e+32) || ~((NaChar <= 1.5e+104))))))) tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT))); else tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT))); end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NaChar, -1.6e+106], N[Not[Or[LessEqual[NaChar, 4e-147], N[Not[Or[LessEqual[NaChar, 3.1e+32], N[Not[LessEqual[NaChar, 1.5e+104]], $MachinePrecision]]], $MachinePrecision]]], $MachinePrecision]], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(1.0 + N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NaChar \leq -1.6 \cdot 10^{+106} \lor \neg \left(NaChar \leq 4 \cdot 10^{-147} \lor \neg \left(NaChar \leq 3.1 \cdot 10^{+32} \lor \neg \left(NaChar \leq 1.5 \cdot 10^{+104}\right)\right)\right):\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
\end{array}
\end{array}
if NaChar < -1.5999999999999999e106 or 3.9999999999999999e-147 < NaChar < 3.09999999999999993e32 or 1.49999999999999984e104 < NaChar 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
lift-+.f6476.5
Applied rewrites76.5%
Taylor expanded in Vef around inf
Applied rewrites63.7%
if -1.5999999999999999e106 < NaChar < 3.9999999999999999e-147 or 3.09999999999999993e32 < NaChar < 1.49999999999999984e104Initial 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-+.f6480.7
Applied rewrites80.7%
Taylor expanded in mu around inf
Applied rewrites64.2%
Final simplification64.0%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (/ NaChar (+ 1.0 (exp (/ (- Vef mu) KbT))))))
(if (<= NaChar -1.95e+77)
t_0
(if (<= NaChar -1.75e-88)
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(if (<= NaChar 9e-152) (/ NdChar (+ 1.0 (exp (/ Vef KbT)))) t_0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
double tmp;
if (NaChar <= -1.95e+77) {
tmp = t_0;
} else if (NaChar <= -1.75e-88) {
tmp = NdChar / (1.0 + exp((mu / KbT)));
} else if (NaChar <= 9e-152) {
tmp = NdChar / (1.0 + exp((Vef / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: t_0
real(8) :: tmp
t_0 = nachar / (1.0d0 + exp(((vef - mu) / kbt)))
if (nachar <= (-1.95d+77)) then
tmp = t_0
else if (nachar <= (-1.75d-88)) then
tmp = ndchar / (1.0d0 + exp((mu / kbt)))
else if (nachar <= 9d-152) then
tmp = ndchar / (1.0d0 + exp((vef / kbt)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double t_0 = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
double tmp;
if (NaChar <= -1.95e+77) {
tmp = t_0;
} else if (NaChar <= -1.75e-88) {
tmp = NdChar / (1.0 + Math.exp((mu / KbT)));
} else if (NaChar <= 9e-152) {
tmp = NdChar / (1.0 + Math.exp((Vef / KbT)));
} else {
tmp = t_0;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): t_0 = NaChar / (1.0 + math.exp(((Vef - mu) / KbT))) tmp = 0 if NaChar <= -1.95e+77: tmp = t_0 elif NaChar <= -1.75e-88: tmp = NdChar / (1.0 + math.exp((mu / KbT))) elif NaChar <= 9e-152: tmp = NdChar / (1.0 + math.exp((Vef / KbT))) else: tmp = t_0 return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT)))) tmp = 0.0 if (NaChar <= -1.95e+77) tmp = t_0; elseif (NaChar <= -1.75e-88) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))); elseif (NaChar <= 9e-152) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT)))); else tmp = t_0; end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) t_0 = NaChar / (1.0 + exp(((Vef - mu) / KbT))); tmp = 0.0; if (NaChar <= -1.95e+77) tmp = t_0; elseif (NaChar <= -1.75e-88) tmp = NdChar / (1.0 + exp((mu / KbT))); elseif (NaChar <= 9e-152) tmp = NdChar / (1.0 + exp((Vef / KbT))); else tmp = t_0; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NaChar, -1.95e+77], t$95$0, If[LessEqual[NaChar, -1.75e-88], N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, 9e-152], N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
\mathbf{if}\;NaChar \leq -1.95 \cdot 10^{+77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;NaChar \leq -1.75 \cdot 10^{-88}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\
\mathbf{elif}\;NaChar \leq 9 \cdot 10^{-152}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if NaChar < -1.9499999999999999e77 or 9.0000000000000008e-152 < NaChar 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
lift-+.f6469.7
Applied rewrites69.7%
Taylor expanded in Vef around inf
Applied rewrites57.2%
if -1.9499999999999999e77 < NaChar < -1.7500000000000001e-88Initial 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-+.f6480.5
Applied rewrites80.5%
Taylor expanded in mu around inf
Applied rewrites63.6%
if -1.7500000000000001e-88 < NaChar < 9.0000000000000008e-152Initial 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-+.f6485.1
Applied rewrites85.1%
Taylor expanded in Vef around inf
Applied rewrites62.2%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (/ Vef KbT)))))
(if (<= NaChar -9.5e+77)
(/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
(if (<= NaChar -1.75e-88)
(/ NdChar (+ 1.0 (exp (/ mu KbT))))
(if (<= NaChar 1.5e+104) (/ NdChar t_0) (/ 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 = 1.0 + exp((Vef / KbT));
double tmp;
if (NaChar <= -9.5e+77) {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
} else if (NaChar <= -1.75e-88) {
tmp = NdChar / (1.0 + exp((mu / KbT)));
} else if (NaChar <= 1.5e+104) {
tmp = NdChar / t_0;
} else {
tmp = NaChar / 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 (nachar <= (-9.5d+77)) then
tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
else if (nachar <= (-1.75d-88)) then
tmp = ndchar / (1.0d0 + exp((mu / kbt)))
else if (nachar <= 1.5d+104) then
tmp = ndchar / t_0
else
tmp = nachar / 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 (NaChar <= -9.5e+77) {
tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
} else if (NaChar <= -1.75e-88) {
tmp = NdChar / (1.0 + Math.exp((mu / KbT)));
} else if (NaChar <= 1.5e+104) {
tmp = NdChar / t_0;
} else {
tmp = NaChar / 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 NaChar <= -9.5e+77: tmp = NaChar / (1.0 + math.exp((EAccept / KbT))) elif NaChar <= -1.75e-88: tmp = NdChar / (1.0 + math.exp((mu / KbT))) elif NaChar <= 1.5e+104: tmp = NdChar / t_0 else: tmp = NaChar / 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 (NaChar <= -9.5e+77) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); elseif (NaChar <= -1.75e-88) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT)))); elseif (NaChar <= 1.5e+104) tmp = Float64(NdChar / t_0); else tmp = Float64(NaChar / 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 (NaChar <= -9.5e+77) tmp = NaChar / (1.0 + exp((EAccept / KbT))); elseif (NaChar <= -1.75e-88) tmp = NdChar / (1.0 + exp((mu / KbT))); elseif (NaChar <= 1.5e+104) tmp = NdChar / t_0; else tmp = NaChar / 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[NaChar, -9.5e+77], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, -1.75e-88], N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, 1.5e+104], N[(NdChar / t$95$0), $MachinePrecision], N[(NaChar / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + e^{\frac{Vef}{KbT}}\\
\mathbf{if}\;NaChar \leq -9.5 \cdot 10^{+77}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;NaChar \leq -1.75 \cdot 10^{-88}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\
\mathbf{elif}\;NaChar \leq 1.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\
\end{array}
\end{array}
if NaChar < -9.4999999999999998e77Initial 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
lift-+.f6470.9
Applied rewrites70.9%
Taylor expanded in EAccept around inf
Applied rewrites48.7%
if -9.4999999999999998e77 < NaChar < -1.7500000000000001e-88Initial 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-+.f6480.5
Applied rewrites80.5%
Taylor expanded in mu around inf
Applied rewrites63.6%
if -1.7500000000000001e-88 < NaChar < 1.49999999999999984e104Initial 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-+.f6472.5
Applied rewrites72.5%
Taylor expanded in Vef around inf
Applied rewrites52.5%
if 1.49999999999999984e104 < NaChar 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
lift-+.f6493.8
Applied rewrites93.8%
Taylor expanded in Vef around inf
Applied rewrites63.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (/ Vef KbT)))))
(if (<= NaChar -8.5e+152)
(/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
(if (<= NaChar -1.56e-87)
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(if (<= NaChar 1.5e+104) (/ NdChar t_0) (/ 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 = 1.0 + exp((Vef / KbT));
double tmp;
if (NaChar <= -8.5e+152) {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
} else if (NaChar <= -1.56e-87) {
tmp = NdChar / (1.0 + exp((EDonor / KbT)));
} else if (NaChar <= 1.5e+104) {
tmp = NdChar / t_0;
} else {
tmp = NaChar / 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 (nachar <= (-8.5d+152)) then
tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
else if (nachar <= (-1.56d-87)) then
tmp = ndchar / (1.0d0 + exp((edonor / kbt)))
else if (nachar <= 1.5d+104) then
tmp = ndchar / t_0
else
tmp = nachar / 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 (NaChar <= -8.5e+152) {
tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
} else if (NaChar <= -1.56e-87) {
tmp = NdChar / (1.0 + Math.exp((EDonor / KbT)));
} else if (NaChar <= 1.5e+104) {
tmp = NdChar / t_0;
} else {
tmp = NaChar / 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 NaChar <= -8.5e+152: tmp = NaChar / (1.0 + math.exp((EAccept / KbT))) elif NaChar <= -1.56e-87: tmp = NdChar / (1.0 + math.exp((EDonor / KbT))) elif NaChar <= 1.5e+104: tmp = NdChar / t_0 else: tmp = NaChar / 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 (NaChar <= -8.5e+152) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); elseif (NaChar <= -1.56e-87) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))); elseif (NaChar <= 1.5e+104) tmp = Float64(NdChar / t_0); else tmp = Float64(NaChar / 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 (NaChar <= -8.5e+152) tmp = NaChar / (1.0 + exp((EAccept / KbT))); elseif (NaChar <= -1.56e-87) tmp = NdChar / (1.0 + exp((EDonor / KbT))); elseif (NaChar <= 1.5e+104) tmp = NdChar / t_0; else tmp = NaChar / 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[NaChar, -8.5e+152], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, -1.56e-87], N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, 1.5e+104], N[(NdChar / t$95$0), $MachinePrecision], N[(NaChar / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + e^{\frac{Vef}{KbT}}\\
\mathbf{if}\;NaChar \leq -8.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\mathbf{elif}\;NaChar \leq -1.56 \cdot 10^{-87}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\mathbf{elif}\;NaChar \leq 1.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\
\end{array}
\end{array}
if NaChar < -8.4999999999999993e152Initial 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
lift-+.f6473.3
Applied rewrites73.3%
Taylor expanded in EAccept around inf
Applied rewrites50.5%
if -8.4999999999999993e152 < NaChar < -1.55999999999999997e-87Initial 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-+.f6476.6
Applied rewrites76.6%
Taylor expanded in EDonor around inf
Applied rewrites49.8%
if -1.55999999999999997e-87 < NaChar < 1.49999999999999984e104Initial 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-+.f6472.5
Applied rewrites72.5%
Taylor expanded in Vef around inf
Applied rewrites52.5%
if 1.49999999999999984e104 < NaChar 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
lift-+.f6493.8
Applied rewrites93.8%
Taylor expanded in Vef around inf
Applied rewrites63.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= EAccept 2.6e-253)
(/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
(if (<= EAccept 5.1e-26)
(/ NaChar (+ 1.0 (exp (/ Vef KbT))))
(if (<= EAccept 6.2e+33)
(fma 0.5 NaChar (* 0.5 NdChar))
(/ 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 <= 2.6e-253) {
tmp = NdChar / (1.0 + exp((EDonor / KbT)));
} else if (EAccept <= 5.1e-26) {
tmp = NaChar / (1.0 + exp((Vef / KbT)));
} else if (EAccept <= 6.2e+33) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EAccept <= 2.6e-253) tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT)))); elseif (EAccept <= 5.1e-26) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))); elseif (EAccept <= 6.2e+33) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, 2.6e-253], N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 5.1e-26], N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 6.2e+33], N[(0.5 * NaChar + N[(0.5 * NdChar), $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 2.6 \cdot 10^{-253}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 5.1 \cdot 10^{-26}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 6.2 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if EAccept < 2.6e-253Initial 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-+.f6466.3
Applied rewrites66.3%
Taylor expanded in EDonor around inf
Applied rewrites39.0%
if 2.6e-253 < EAccept < 5.09999999999999991e-26Initial 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
lift-+.f6470.0
Applied rewrites70.0%
Taylor expanded in Vef around inf
Applied rewrites55.4%
if 5.09999999999999991e-26 < EAccept < 6.2e33Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6433.3
Applied rewrites33.3%
if 6.2e33 < 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
lift-+.f6459.1
Applied rewrites59.1%
Taylor expanded in EAccept around inf
Applied rewrites50.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
:precision binary64
(if (<= EAccept -7e-107)
(/ NaChar (+ 1.0 (exp (/ Ev KbT))))
(if (<= EAccept 5.1e-26)
(/ NaChar (+ 1.0 (exp (/ Vef KbT))))
(if (<= EAccept 6.2e+33)
(fma 0.5 NaChar (* 0.5 NdChar))
(/ 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 <= -7e-107) {
tmp = NaChar / (1.0 + exp((Ev / KbT)));
} else if (EAccept <= 5.1e-26) {
tmp = NaChar / (1.0 + exp((Vef / KbT)));
} else if (EAccept <= 6.2e+33) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if (EAccept <= -7e-107) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))); elseif (EAccept <= 5.1e-26) tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT)))); elseif (EAccept <= 6.2e+33) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, -7e-107], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 5.1e-26], N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 6.2e+33], N[(0.5 * NaChar + N[(0.5 * NdChar), $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 -7 \cdot 10^{-107}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 5.1 \cdot 10^{-26}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
\mathbf{elif}\;EAccept \leq 6.2 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if EAccept < -6.99999999999999971e-107Initial 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
lift-+.f6448.2
Applied rewrites48.2%
Taylor expanded in Ev around inf
Applied rewrites29.3%
if -6.99999999999999971e-107 < EAccept < 5.09999999999999991e-26Initial 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
lift-+.f6465.2
Applied rewrites65.2%
Taylor expanded in Vef around inf
Applied rewrites49.0%
if 5.09999999999999991e-26 < EAccept < 6.2e33Initial program 100.0%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6433.3
Applied rewrites33.3%
if 6.2e33 < 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
lift-+.f6459.1
Applied rewrites59.1%
Taylor expanded in EAccept around inf
Applied rewrites50.6%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= KbT -1.85e+142) (not (<= KbT 3.3e+112))) (fma 0.5 NaChar (* 0.5 NdChar)) (/ 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 ((KbT <= -1.85e+142) || !(KbT <= 3.3e+112)) {
tmp = fma(0.5, NaChar, (0.5 * NdChar));
} else {
tmp = NaChar / (1.0 + exp((EAccept / KbT)));
}
return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((KbT <= -1.85e+142) || !(KbT <= 3.3e+112)) tmp = fma(0.5, NaChar, Float64(0.5 * NdChar)); else tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))); end return tmp end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[KbT, -1.85e+142], N[Not[LessEqual[KbT, 3.3e+112]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;KbT \leq -1.85 \cdot 10^{+142} \lor \neg \left(KbT \leq 3.3 \cdot 10^{+112}\right):\\
\;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
\end{array}
\end{array}
if KbT < -1.8499999999999999e142 or 3.2999999999999999e112 < KbT Initial program 99.9%
Taylor expanded in KbT around inf
lower-fma.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
if -1.8499999999999999e142 < KbT < 3.2999999999999999e112Initial 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
lift-+.f6461.1
Applied rewrites61.1%
Taylor expanded in EAccept around inf
Applied rewrites33.6%
Final simplification43.4%
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept) :precision binary64 (if (or (<= NaChar -1.95e+139) (not (<= NaChar 1.05e+103))) (* 0.5 NaChar) (* 0.5 NdChar)))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NaChar <= -1.95e+139) || !(NaChar <= 1.05e+103)) {
tmp = 0.5 * NaChar;
} else {
tmp = 0.5 * NdChar;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
real(8) :: tmp
if ((nachar <= (-1.95d+139)) .or. (.not. (nachar <= 1.05d+103))) then
tmp = 0.5d0 * nachar
else
tmp = 0.5d0 * ndchar
end if
code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
double tmp;
if ((NaChar <= -1.95e+139) || !(NaChar <= 1.05e+103)) {
tmp = 0.5 * NaChar;
} else {
tmp = 0.5 * NdChar;
}
return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): tmp = 0 if (NaChar <= -1.95e+139) or not (NaChar <= 1.05e+103): tmp = 0.5 * NaChar else: tmp = 0.5 * NdChar return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0 if ((NaChar <= -1.95e+139) || !(NaChar <= 1.05e+103)) tmp = Float64(0.5 * NaChar); else tmp = Float64(0.5 * NdChar); end return tmp end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.0; if ((NaChar <= -1.95e+139) || ~((NaChar <= 1.05e+103))) tmp = 0.5 * NaChar; else tmp = 0.5 * NdChar; end tmp_2 = tmp; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NaChar, -1.95e+139], N[Not[LessEqual[NaChar, 1.05e+103]], $MachinePrecision]], N[(0.5 * NaChar), $MachinePrecision], N[(0.5 * NdChar), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;NaChar \leq -1.95 \cdot 10^{+139} \lor \neg \left(NaChar \leq 1.05 \cdot 10^{+103}\right):\\
\;\;\;\;0.5 \cdot NaChar\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot NdChar\\
\end{array}
\end{array}
if NaChar < -1.95000000000000003e139 or 1.0500000000000001e103 < NaChar 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
lift-+.f6480.8
Applied rewrites80.8%
Taylor expanded in KbT around inf
lower-*.f6432.1
Applied rewrites32.1%
if -1.95000000000000003e139 < NaChar < 1.0500000000000001e103Initial 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.6
Applied rewrites73.6%
Taylor expanded in KbT around inf
lift-*.f6425.4
Applied rewrites25.4%
Final simplification27.4%
(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-*.f6429.9
Applied rewrites29.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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
real(8), intent (in) :: ndchar
real(8), intent (in) :: ec
real(8), intent (in) :: vef
real(8), intent (in) :: edonor
real(8), intent (in) :: mu
real(8), intent (in) :: kbt
real(8), intent (in) :: nachar
real(8), intent (in) :: ev
real(8), intent (in) :: eaccept
code = 0.5d0 * nachar
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
return 0.5 * NaChar;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept): return 0.5 * NaChar
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) return Float64(0.5 * NaChar) end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept) tmp = 0.5 * NaChar; end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot NaChar
\end{array}
Initial program 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
lift-+.f6457.7
Applied rewrites57.7%
Taylor expanded in KbT around inf
lower-*.f6418.8
Applied rewrites18.8%
herbie shell --seed 2025051
(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))))))