Bulmash initializePoisson

Percentage Accurate: 100.0% → 100.0%
Time: 20.5s
Alternatives: 23
Speedup: 1.0×

Specification

?
\[\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) + 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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 23 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\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) + 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}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} - \frac{NaChar}{-1 - e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (-
  (/ NdChar (+ (exp (/ (+ EDonor (+ mu (- Vef Ec))) KbT)) 1.0))
  (/ NaChar (- -1.0 (exp (/ (+ Vef (+ EAccept (- Ev mu))) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) - (NaChar / (-1.0 - exp(((Vef + (EAccept + (Ev - 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 / (exp(((edonor + (mu + (vef - ec))) / kbt)) + 1.0d0)) - (nachar / ((-1.0d0) - exp(((vef + (eaccept + (ev - 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 / (Math.exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) - (NaChar / (-1.0 - Math.exp(((Vef + (EAccept + (Ev - mu))) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	return (NdChar / (math.exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) - (NaChar / (-1.0 - math.exp(((Vef + (EAccept + (Ev - mu))) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	return Float64(Float64(NdChar / Float64(exp(Float64(Float64(EDonor + Float64(mu + Float64(Vef - Ec))) / KbT)) + 1.0)) - Float64(NaChar / Float64(-1.0 - exp(Float64(Float64(Vef + Float64(EAccept + Float64(Ev - mu))) / KbT)))))
end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = (NdChar / (exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) - (NaChar / (-1.0 - exp(((Vef + (EAccept + (Ev - mu))) / KbT))));
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(N[Exp[N[(N[(EDonor + N[(mu + N[(Vef - Ec), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(NaChar / N[(-1.0 - N[Exp[N[(N[(Vef + N[(EAccept + N[(Ev - mu), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} - \frac{NaChar}{-1 - e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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}}} \]
  2. Step-by-step derivation
    1. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
  4. Add Preprocessing
  5. Final simplification99.6%

    \[\leadsto \frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} - \frac{NaChar}{-1 - e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}} \]
  6. Add Preprocessing

Alternative 2: 69.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1}\\ \mathbf{if}\;Ev \leq -6.2 \cdot 10^{-5}:\\ \;\;\;\;t\_0 + \frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{elif}\;Ev \leq -4.2 \cdot 10^{-116}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\ \mathbf{elif}\;Ev \leq -7 \cdot 10^{-239}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NdChar (+ (exp (/ (+ EDonor (+ mu (- Vef Ec))) KbT)) 1.0))))
   (if (<= Ev -6.2e-5)
     (+ t_0 (/ NaChar (+ (exp (/ Ev KbT)) 1.0)))
     (if (<= Ev -4.2e-116)
       (/ NdChar (+ (exp (/ (+ (+ EDonor Vef) (- mu Ec)) KbT)) 1.0))
       (if (<= Ev -7e-239)
         (/ NaChar (+ (exp (/ (+ (- Vef mu) (+ EAccept Ev)) KbT)) 1.0))
         (+ t_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 t_0 = NdChar / (exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0);
	double tmp;
	if (Ev <= -6.2e-5) {
		tmp = t_0 + (NaChar / (exp((Ev / KbT)) + 1.0));
	} else if (Ev <= -4.2e-116) {
		tmp = NdChar / (exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	} else if (Ev <= -7e-239) {
		tmp = NaChar / (exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	} else {
		tmp = t_0 + (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) :: t_0
    real(8) :: tmp
    t_0 = ndchar / (exp(((edonor + (mu + (vef - ec))) / kbt)) + 1.0d0)
    if (ev <= (-6.2d-5)) then
        tmp = t_0 + (nachar / (exp((ev / kbt)) + 1.0d0))
    else if (ev <= (-4.2d-116)) then
        tmp = ndchar / (exp((((edonor + vef) + (mu - ec)) / kbt)) + 1.0d0)
    else if (ev <= (-7d-239)) then
        tmp = nachar / (exp((((vef - mu) + (eaccept + ev)) / kbt)) + 1.0d0)
    else
        tmp = t_0 + (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 t_0 = NdChar / (Math.exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0);
	double tmp;
	if (Ev <= -6.2e-5) {
		tmp = t_0 + (NaChar / (Math.exp((Ev / KbT)) + 1.0));
	} else if (Ev <= -4.2e-116) {
		tmp = NdChar / (Math.exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	} else if (Ev <= -7e-239) {
		tmp = NaChar / (Math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	} else {
		tmp = t_0 + (NaChar / (Math.exp((EAccept / KbT)) + 1.0));
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NdChar / (math.exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)
	tmp = 0
	if Ev <= -6.2e-5:
		tmp = t_0 + (NaChar / (math.exp((Ev / KbT)) + 1.0))
	elif Ev <= -4.2e-116:
		tmp = NdChar / (math.exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0)
	elif Ev <= -7e-239:
		tmp = NaChar / (math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0)
	else:
		tmp = t_0 + (NaChar / (math.exp((EAccept / KbT)) + 1.0))
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(NdChar / Float64(exp(Float64(Float64(EDonor + Float64(mu + Float64(Vef - Ec))) / KbT)) + 1.0))
	tmp = 0.0
	if (Ev <= -6.2e-5)
		tmp = Float64(t_0 + Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0)));
	elseif (Ev <= -4.2e-116)
		tmp = Float64(NdChar / Float64(exp(Float64(Float64(Float64(EDonor + Vef) + Float64(mu - Ec)) / KbT)) + 1.0));
	elseif (Ev <= -7e-239)
		tmp = Float64(NaChar / Float64(exp(Float64(Float64(Float64(Vef - mu) + Float64(EAccept + Ev)) / KbT)) + 1.0));
	else
		tmp = Float64(t_0 + 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)
	t_0 = NdChar / (exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0);
	tmp = 0.0;
	if (Ev <= -6.2e-5)
		tmp = t_0 + (NaChar / (exp((Ev / KbT)) + 1.0));
	elseif (Ev <= -4.2e-116)
		tmp = NdChar / (exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	elseif (Ev <= -7e-239)
		tmp = NaChar / (exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	else
		tmp = t_0 + (NaChar / (exp((EAccept / KbT)) + 1.0));
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(N[Exp[N[(N[(EDonor + N[(mu + N[(Vef - Ec), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[Ev, -6.2e-5], N[(t$95$0 + N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[Ev, -4.2e-116], N[(NdChar / N[(N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] + N[(mu - Ec), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Ev, -7e-239], N[(NaChar / N[(N[Exp[N[(N[(N[(Vef - mu), $MachinePrecision] + N[(EAccept + Ev), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1}\\
\mathbf{if}\;Ev \leq -6.2 \cdot 10^{-5}:\\
\;\;\;\;t\_0 + \frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\

\mathbf{elif}\;Ev \leq -4.2 \cdot 10^{-116}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\

\mathbf{elif}\;Ev \leq -7 \cdot 10^{-239}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if Ev < -6.20000000000000027e-5

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in Ev around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Ev}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6490.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right)\right) \]
    7. Simplified90.2%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{Ev}{KbT}}}} \]

    if -6.20000000000000027e-5 < Ev < -4.1999999999999998e-116

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6482.7%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified82.7%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]

    if -4.1999999999999998e-116 < Ev < -7.00000000000000011e-239

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6467.8%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified67.8%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]

    if -7.00000000000000011e-239 < Ev

    1. Initial program 99.3%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in EAccept around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EAccept}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6465.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EAccept, KbT\right)\right)\right)\right)\right) \]
    7. Simplified65.9%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{EAccept}{KbT}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Ev \leq -6.2 \cdot 10^{-5}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} + \frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{elif}\;Ev \leq -4.2 \cdot 10^{-116}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\ \mathbf{elif}\;Ev \leq -7 \cdot 10^{-239}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} + \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 71.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{if}\;NaChar \leq -1.5 \cdot 10^{+27}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NaChar \leq 8 \cdot 10^{-230}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\ \mathbf{elif}\;NaChar \leq 1.5 \cdot 10^{+29}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} + \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NaChar (+ (exp (/ (+ (- Vef mu) (+ EAccept Ev)) KbT)) 1.0))))
   (if (<= NaChar -1.5e+27)
     t_0
     (if (<= NaChar 8e-230)
       (/ NdChar (+ (exp (/ (+ (+ EDonor Vef) (- mu Ec)) KbT)) 1.0))
       (if (<= NaChar 1.5e+29)
         (+
          (/ NdChar (+ (exp (/ (+ EDonor (+ mu (- Vef Ec))) KbT)) 1.0))
          (/ NaChar (+ (exp (/ EAccept KbT)) 1.0)))
         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((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	double tmp;
	if (NaChar <= -1.5e+27) {
		tmp = t_0;
	} else if (NaChar <= 8e-230) {
		tmp = NdChar / (exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	} else if (NaChar <= 1.5e+29) {
		tmp = (NdChar / (exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) + (NaChar / (exp((EAccept / KbT)) + 1.0));
	} else {
		tmp = t_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) :: tmp
    t_0 = nachar / (exp((((vef - mu) + (eaccept + ev)) / kbt)) + 1.0d0)
    if (nachar <= (-1.5d+27)) then
        tmp = t_0
    else if (nachar <= 8d-230) then
        tmp = ndchar / (exp((((edonor + vef) + (mu - ec)) / kbt)) + 1.0d0)
    else if (nachar <= 1.5d+29) then
        tmp = (ndchar / (exp(((edonor + (mu + (vef - ec))) / kbt)) + 1.0d0)) + (nachar / (exp((eaccept / kbt)) + 1.0d0))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NaChar / (Math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	double tmp;
	if (NaChar <= -1.5e+27) {
		tmp = t_0;
	} else if (NaChar <= 8e-230) {
		tmp = NdChar / (Math.exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	} else if (NaChar <= 1.5e+29) {
		tmp = (NdChar / (Math.exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) + (NaChar / (Math.exp((EAccept / KbT)) + 1.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NaChar / (math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0)
	tmp = 0
	if NaChar <= -1.5e+27:
		tmp = t_0
	elif NaChar <= 8e-230:
		tmp = NdChar / (math.exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0)
	elif NaChar <= 1.5e+29:
		tmp = (NdChar / (math.exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) + (NaChar / (math.exp((EAccept / KbT)) + 1.0))
	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(Float64(Vef - mu) + Float64(EAccept + Ev)) / KbT)) + 1.0))
	tmp = 0.0
	if (NaChar <= -1.5e+27)
		tmp = t_0;
	elseif (NaChar <= 8e-230)
		tmp = Float64(NdChar / Float64(exp(Float64(Float64(Float64(EDonor + Vef) + Float64(mu - Ec)) / KbT)) + 1.0));
	elseif (NaChar <= 1.5e+29)
		tmp = Float64(Float64(NdChar / Float64(exp(Float64(Float64(EDonor + Float64(mu + Float64(Vef - Ec))) / KbT)) + 1.0)) + Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = NaChar / (exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	tmp = 0.0;
	if (NaChar <= -1.5e+27)
		tmp = t_0;
	elseif (NaChar <= 8e-230)
		tmp = NdChar / (exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	elseif (NaChar <= 1.5e+29)
		tmp = (NdChar / (exp(((EDonor + (mu + (Vef - Ec))) / KbT)) + 1.0)) + (NaChar / (exp((EAccept / KbT)) + 1.0));
	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[(N[Exp[N[(N[(N[(Vef - mu), $MachinePrecision] + N[(EAccept + Ev), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NaChar, -1.5e+27], t$95$0, If[LessEqual[NaChar, 8e-230], N[(NdChar / N[(N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] + N[(mu - Ec), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[NaChar, 1.5e+29], N[(N[(NdChar / N[(N[Exp[N[(N[(EDonor + N[(mu + N[(Vef - Ec), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\
\mathbf{if}\;NaChar \leq -1.5 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;NaChar \leq 8 \cdot 10^{-230}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\

\mathbf{elif}\;NaChar \leq 1.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} + \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if NaChar < -1.49999999999999988e27 or 1.5e29 < NaChar

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6475.9%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.9%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]

    if -1.49999999999999988e27 < NaChar < 8.00000000000000037e-230

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6482.7%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified82.7%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]

    if 8.00000000000000037e-230 < NaChar < 1.5e29

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in EAccept around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EAccept}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6483.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EAccept, KbT\right)\right)\right)\right)\right) \]
    7. Simplified83.2%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{EAccept}{KbT}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;NaChar \leq -1.5 \cdot 10^{+27}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{elif}\;NaChar \leq 8 \cdot 10^{-230}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\ \mathbf{elif}\;NaChar \leq 1.5 \cdot 10^{+29}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor + \left(mu + \left(Vef - Ec\right)\right)}{KbT}} + 1} + \frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 44.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{Vef}{KbT}} + 1\\ \mathbf{if}\;Vef \leq -7.2 \cdot 10^{+120}:\\ \;\;\;\;\frac{NaChar}{t\_0}\\ \mathbf{elif}\;Vef \leq 8 \cdot 10^{-167}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 2.25 \cdot 10^{-94}:\\ \;\;\;\;\frac{NaChar}{e^{0 - \frac{mu}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 7.8 \cdot 10^{+115}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{t\_0}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (+ (exp (/ Vef KbT)) 1.0)))
   (if (<= Vef -7.2e+120)
     (/ NaChar t_0)
     (if (<= Vef 8e-167)
       (/ NdChar (+ (exp (/ EDonor KbT)) 1.0))
       (if (<= Vef 2.25e-94)
         (/ NaChar (+ (exp (- 0.0 (/ mu KbT))) 1.0))
         (if (<= Vef 7.8e+115)
           (/ NdChar (+ (exp (/ mu KbT)) 1.0))
           (/ NdChar t_0)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = exp((Vef / KbT)) + 1.0;
	double tmp;
	if (Vef <= -7.2e+120) {
		tmp = NaChar / t_0;
	} else if (Vef <= 8e-167) {
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	} else if (Vef <= 2.25e-94) {
		tmp = NaChar / (exp((0.0 - (mu / KbT))) + 1.0);
	} else if (Vef <= 7.8e+115) {
		tmp = NdChar / (exp((mu / KbT)) + 1.0);
	} else {
		tmp = NdChar / t_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) :: tmp
    t_0 = exp((vef / kbt)) + 1.0d0
    if (vef <= (-7.2d+120)) then
        tmp = nachar / t_0
    else if (vef <= 8d-167) then
        tmp = ndchar / (exp((edonor / kbt)) + 1.0d0)
    else if (vef <= 2.25d-94) then
        tmp = nachar / (exp((0.0d0 - (mu / kbt))) + 1.0d0)
    else if (vef <= 7.8d+115) then
        tmp = ndchar / (exp((mu / kbt)) + 1.0d0)
    else
        tmp = ndchar / t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = Math.exp((Vef / KbT)) + 1.0;
	double tmp;
	if (Vef <= -7.2e+120) {
		tmp = NaChar / t_0;
	} else if (Vef <= 8e-167) {
		tmp = NdChar / (Math.exp((EDonor / KbT)) + 1.0);
	} else if (Vef <= 2.25e-94) {
		tmp = NaChar / (Math.exp((0.0 - (mu / KbT))) + 1.0);
	} else if (Vef <= 7.8e+115) {
		tmp = NdChar / (Math.exp((mu / KbT)) + 1.0);
	} else {
		tmp = NdChar / t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = math.exp((Vef / KbT)) + 1.0
	tmp = 0
	if Vef <= -7.2e+120:
		tmp = NaChar / t_0
	elif Vef <= 8e-167:
		tmp = NdChar / (math.exp((EDonor / KbT)) + 1.0)
	elif Vef <= 2.25e-94:
		tmp = NaChar / (math.exp((0.0 - (mu / KbT))) + 1.0)
	elif Vef <= 7.8e+115:
		tmp = NdChar / (math.exp((mu / KbT)) + 1.0)
	else:
		tmp = NdChar / t_0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(exp(Float64(Vef / KbT)) + 1.0)
	tmp = 0.0
	if (Vef <= -7.2e+120)
		tmp = Float64(NaChar / t_0);
	elseif (Vef <= 8e-167)
		tmp = Float64(NdChar / Float64(exp(Float64(EDonor / KbT)) + 1.0));
	elseif (Vef <= 2.25e-94)
		tmp = Float64(NaChar / Float64(exp(Float64(0.0 - Float64(mu / KbT))) + 1.0));
	elseif (Vef <= 7.8e+115)
		tmp = Float64(NdChar / Float64(exp(Float64(mu / KbT)) + 1.0));
	else
		tmp = Float64(NdChar / t_0);
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = exp((Vef / KbT)) + 1.0;
	tmp = 0.0;
	if (Vef <= -7.2e+120)
		tmp = NaChar / t_0;
	elseif (Vef <= 8e-167)
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	elseif (Vef <= 2.25e-94)
		tmp = NaChar / (exp((0.0 - (mu / KbT))) + 1.0);
	elseif (Vef <= 7.8e+115)
		tmp = NdChar / (exp((mu / KbT)) + 1.0);
	else
		tmp = NdChar / t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[Vef, -7.2e+120], N[(NaChar / t$95$0), $MachinePrecision], If[LessEqual[Vef, 8e-167], N[(NdChar / N[(N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 2.25e-94], N[(NaChar / N[(N[Exp[N[(0.0 - N[(mu / KbT), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 7.8e+115], N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(NdChar / t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{Vef}{KbT}} + 1\\
\mathbf{if}\;Vef \leq -7.2 \cdot 10^{+120}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\

\mathbf{elif}\;Vef \leq 8 \cdot 10^{-167}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\

\mathbf{elif}\;Vef \leq 2.25 \cdot 10^{-94}:\\
\;\;\;\;\frac{NaChar}{e^{0 - \frac{mu}{KbT}} + 1}\\

\mathbf{elif}\;Vef \leq 7.8 \cdot 10^{+115}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if Vef < -7.20000000000000031e120

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6482.1%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified82.1%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6466.8%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified66.8%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]

    if -7.20000000000000031e120 < Vef < 8.00000000000000002e-167

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6463.5%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified63.5%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in EDonor around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EDonor}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6448.5%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EDonor, KbT\right)\right)\right)\right) \]
    10. Simplified48.5%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{EDonor}{KbT}}}} \]

    if 8.00000000000000002e-167 < Vef < 2.2500000000000001e-94

    1. Initial program 99.9%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6470.5%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified70.5%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in mu around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \frac{mu}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\frac{mu}{KbT}\right)\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(0 - \frac{mu}{KbT}\right)\right)\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{mu}{KbT}\right)\right)\right)\right)\right) \]
      4. /-lowering-/.f6455.3%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(mu, KbT\right)\right)\right)\right)\right) \]
    10. Simplified55.3%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{0 - \frac{mu}{KbT}}}} \]
    11. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\frac{mu}{KbT}\right)\right)\right)\right)\right) \]
      2. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{neg.f64}\left(\left(\frac{mu}{KbT}\right)\right)\right)\right)\right) \]
      3. /-lowering-/.f6455.3%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{neg.f64}\left(\mathsf{/.f64}\left(mu, KbT\right)\right)\right)\right)\right) \]
    12. Applied egg-rr55.3%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{-\frac{mu}{KbT}}}} \]

    if 2.2500000000000001e-94 < Vef < 7.80000000000000012e115

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6475.3%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.3%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in mu around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{mu}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6459.1%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(mu, KbT\right)\right)\right)\right) \]
    10. Simplified59.1%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{mu}{KbT}}}} \]

    if 7.80000000000000012e115 < Vef

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6475.6%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6467.9%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified67.9%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification56.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq -7.2 \cdot 10^{+120}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 8 \cdot 10^{-167}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 2.25 \cdot 10^{-94}:\\ \;\;\;\;\frac{NaChar}{e^{0 - \frac{mu}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 7.8 \cdot 10^{+115}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 44.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{Vef}{KbT}} + 1\\ \mathbf{if}\;Vef \leq -3.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{NaChar}{t\_0}\\ \mathbf{elif}\;Vef \leq -4.6 \cdot 10^{-273}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 7.5 \cdot 10^{-122}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 1.15 \cdot 10^{+113}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{t\_0}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (+ (exp (/ Vef KbT)) 1.0)))
   (if (<= Vef -3.5e+122)
     (/ NaChar t_0)
     (if (<= Vef -4.6e-273)
       (/ NdChar (+ (exp (/ EDonor KbT)) 1.0))
       (if (<= Vef 7.5e-122)
         (/ NaChar (+ (exp (/ Ev KbT)) 1.0))
         (if (<= Vef 1.15e+113)
           (/ NdChar (+ (exp (/ mu KbT)) 1.0))
           (/ NdChar t_0)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = exp((Vef / KbT)) + 1.0;
	double tmp;
	if (Vef <= -3.5e+122) {
		tmp = NaChar / t_0;
	} else if (Vef <= -4.6e-273) {
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	} else if (Vef <= 7.5e-122) {
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	} else if (Vef <= 1.15e+113) {
		tmp = NdChar / (exp((mu / KbT)) + 1.0);
	} else {
		tmp = NdChar / t_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) :: tmp
    t_0 = exp((vef / kbt)) + 1.0d0
    if (vef <= (-3.5d+122)) then
        tmp = nachar / t_0
    else if (vef <= (-4.6d-273)) then
        tmp = ndchar / (exp((edonor / kbt)) + 1.0d0)
    else if (vef <= 7.5d-122) then
        tmp = nachar / (exp((ev / kbt)) + 1.0d0)
    else if (vef <= 1.15d+113) then
        tmp = ndchar / (exp((mu / kbt)) + 1.0d0)
    else
        tmp = ndchar / t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = Math.exp((Vef / KbT)) + 1.0;
	double tmp;
	if (Vef <= -3.5e+122) {
		tmp = NaChar / t_0;
	} else if (Vef <= -4.6e-273) {
		tmp = NdChar / (Math.exp((EDonor / KbT)) + 1.0);
	} else if (Vef <= 7.5e-122) {
		tmp = NaChar / (Math.exp((Ev / KbT)) + 1.0);
	} else if (Vef <= 1.15e+113) {
		tmp = NdChar / (Math.exp((mu / KbT)) + 1.0);
	} else {
		tmp = NdChar / t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = math.exp((Vef / KbT)) + 1.0
	tmp = 0
	if Vef <= -3.5e+122:
		tmp = NaChar / t_0
	elif Vef <= -4.6e-273:
		tmp = NdChar / (math.exp((EDonor / KbT)) + 1.0)
	elif Vef <= 7.5e-122:
		tmp = NaChar / (math.exp((Ev / KbT)) + 1.0)
	elif Vef <= 1.15e+113:
		tmp = NdChar / (math.exp((mu / KbT)) + 1.0)
	else:
		tmp = NdChar / t_0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(exp(Float64(Vef / KbT)) + 1.0)
	tmp = 0.0
	if (Vef <= -3.5e+122)
		tmp = Float64(NaChar / t_0);
	elseif (Vef <= -4.6e-273)
		tmp = Float64(NdChar / Float64(exp(Float64(EDonor / KbT)) + 1.0));
	elseif (Vef <= 7.5e-122)
		tmp = Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0));
	elseif (Vef <= 1.15e+113)
		tmp = Float64(NdChar / Float64(exp(Float64(mu / KbT)) + 1.0));
	else
		tmp = Float64(NdChar / t_0);
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = exp((Vef / KbT)) + 1.0;
	tmp = 0.0;
	if (Vef <= -3.5e+122)
		tmp = NaChar / t_0;
	elseif (Vef <= -4.6e-273)
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	elseif (Vef <= 7.5e-122)
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	elseif (Vef <= 1.15e+113)
		tmp = NdChar / (exp((mu / KbT)) + 1.0);
	else
		tmp = NdChar / t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[Vef, -3.5e+122], N[(NaChar / t$95$0), $MachinePrecision], If[LessEqual[Vef, -4.6e-273], N[(NdChar / N[(N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 7.5e-122], N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 1.15e+113], N[(NdChar / N[(N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(NdChar / t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{Vef}{KbT}} + 1\\
\mathbf{if}\;Vef \leq -3.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\

\mathbf{elif}\;Vef \leq -4.6 \cdot 10^{-273}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\

\mathbf{elif}\;Vef \leq 7.5 \cdot 10^{-122}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\

\mathbf{elif}\;Vef \leq 1.15 \cdot 10^{+113}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if Vef < -3.50000000000000014e122

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6482.1%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified82.1%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6466.8%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified66.8%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]

    if -3.50000000000000014e122 < Vef < -4.59999999999999961e-273

    1. Initial program 98.9%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6464.2%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified64.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in EDonor around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EDonor}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6449.7%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EDonor, KbT\right)\right)\right)\right) \]
    10. Simplified49.7%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{EDonor}{KbT}}}} \]

    if -4.59999999999999961e-273 < Vef < 7.4999999999999998e-122

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in Ev around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Ev}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6470.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right)\right) \]
    7. Simplified70.5%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{Ev}{KbT}}}} \]
    8. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{Ev}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{Ev}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{Ev}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f6441.9%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right) \]
    10. Simplified41.9%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]

    if 7.4999999999999998e-122 < Vef < 1.14999999999999998e113

    1. Initial program 99.9%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6473.2%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified73.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in mu around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{mu}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6455.9%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(mu, KbT\right)\right)\right)\right) \]
    10. Simplified55.9%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{mu}{KbT}}}} \]

    if 1.14999999999999998e113 < Vef

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6475.6%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6467.9%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified67.9%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification55.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq -3.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq -4.6 \cdot 10^{-273}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 7.5 \cdot 10^{-122}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 1.15 \cdot 10^{+113}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{mu}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 39.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -3.3 \cdot 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq -1.3 \cdot 10^{+119}:\\ \;\;\;\;\frac{NdChar}{\left(\left(\frac{EDonor}{KbT} + 2\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}\\ \mathbf{elif}\;KbT \leq 1.6 \cdot 10^{-269}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \mathbf{elif}\;KbT \leq 4.5 \cdot 10^{+201}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -3.3e+171)
     t_0
     (if (<= KbT -1.3e+119)
       (/
        NdChar
        (- (+ (+ (/ EDonor KbT) 2.0) (+ (/ Vef KbT) (/ mu KbT))) (/ Ec KbT)))
       (if (<= KbT 1.6e-269)
         (/ NaChar (+ (exp (/ EAccept KbT)) 1.0))
         (if (<= KbT 4.5e+201) (/ NaChar (+ (exp (/ Ev KbT)) 1.0)) 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 <= -3.3e+171) {
		tmp = t_0;
	} else if (KbT <= -1.3e+119) {
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT));
	} else if (KbT <= 1.6e-269) {
		tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
	} else if (KbT <= 4.5e+201) {
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-3.3d+171)) then
        tmp = t_0
    else if (kbt <= (-1.3d+119)) then
        tmp = ndchar / ((((edonor / kbt) + 2.0d0) + ((vef / kbt) + (mu / kbt))) - (ec / kbt))
    else if (kbt <= 1.6d-269) then
        tmp = nachar / (exp((eaccept / kbt)) + 1.0d0)
    else if (kbt <= 4.5d+201) then
        tmp = nachar / (exp((ev / kbt)) + 1.0d0)
    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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -3.3e+171) {
		tmp = t_0;
	} else if (KbT <= -1.3e+119) {
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT));
	} else if (KbT <= 1.6e-269) {
		tmp = NaChar / (Math.exp((EAccept / KbT)) + 1.0);
	} else if (KbT <= 4.5e+201) {
		tmp = NaChar / (Math.exp((Ev / KbT)) + 1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -3.3e+171:
		tmp = t_0
	elif KbT <= -1.3e+119:
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT))
	elif KbT <= 1.6e-269:
		tmp = NaChar / (math.exp((EAccept / KbT)) + 1.0)
	elif KbT <= 4.5e+201:
		tmp = NaChar / (math.exp((Ev / KbT)) + 1.0)
	else:
		tmp = 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 <= -3.3e+171)
		tmp = t_0;
	elseif (KbT <= -1.3e+119)
		tmp = Float64(NdChar / Float64(Float64(Float64(Float64(EDonor / KbT) + 2.0) + Float64(Float64(Vef / KbT) + Float64(mu / KbT))) - Float64(Ec / KbT)));
	elseif (KbT <= 1.6e-269)
		tmp = Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0));
	elseif (KbT <= 4.5e+201)
		tmp = Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -3.3e+171)
		tmp = t_0;
	elseif (KbT <= -1.3e+119)
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT));
	elseif (KbT <= 1.6e-269)
		tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
	elseif (KbT <= 4.5e+201)
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	else
		tmp = t_0;
	end
	tmp_2 = 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, -3.3e+171], t$95$0, If[LessEqual[KbT, -1.3e+119], N[(NdChar / N[(N[(N[(N[(EDonor / KbT), $MachinePrecision] + 2.0), $MachinePrecision] + N[(N[(Vef / KbT), $MachinePrecision] + N[(mu / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 1.6e-269], N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 4.5e+201], N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -3.3 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq -1.3 \cdot 10^{+119}:\\
\;\;\;\;\frac{NdChar}{\left(\left(\frac{EDonor}{KbT} + 2\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}\\

\mathbf{elif}\;KbT \leq 1.6 \cdot 10^{-269}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\

\mathbf{elif}\;KbT \leq 4.5 \cdot 10^{+201}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if KbT < -3.29999999999999991e171 or 4.5000000000000001e201 < KbT

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6468.4%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified68.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -3.29999999999999991e171 < KbT < -1.3e119

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in KbT around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(\left(2 + \left(\frac{EDonor}{KbT} + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right)\right) - \frac{Ec}{KbT}\right)}\right) \]
    9. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\left(2 + \left(\frac{EDonor}{KbT} + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right)\right), \color{blue}{\left(\frac{Ec}{KbT}\right)}\right)\right) \]
      2. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\left(\left(2 + \frac{EDonor}{KbT}\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{\color{blue}{Ec}}{KbT}\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\left(2 + \frac{EDonor}{KbT}\right), \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{\color{blue}{Ec}}{KbT}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{EDonor}{KbT}\right)\right), \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\left(\frac{Vef}{KbT}\right), \left(\frac{mu}{KbT}\right)\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right), \left(\frac{mu}{KbT}\right)\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right), \mathsf{/.f64}\left(mu, KbT\right)\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      9. /-lowering-/.f6464.9%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right), \mathsf{/.f64}\left(mu, KbT\right)\right)\right), \mathsf{/.f64}\left(Ec, \color{blue}{KbT}\right)\right)\right) \]
    10. Simplified64.9%

      \[\leadsto \frac{NdChar}{\color{blue}{\left(\left(2 + \frac{EDonor}{KbT}\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}} \]

    if -1.3e119 < KbT < 1.6000000000000001e-269

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6460.8%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified60.8%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in EAccept around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EAccept}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6431.1%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EAccept, KbT\right)\right)\right)\right) \]
    10. Simplified31.1%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{EAccept}{KbT}}}} \]

    if 1.6000000000000001e-269 < KbT < 4.5000000000000001e201

    1. Initial program 99.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in Ev around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Ev}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6465.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right)\right) \]
    7. Simplified65.0%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{Ev}{KbT}}}} \]
    8. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{Ev}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{Ev}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{Ev}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f6438.4%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right) \]
    10. Simplified38.4%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification42.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -3.3 \cdot 10^{+171}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq -1.3 \cdot 10^{+119}:\\ \;\;\;\;\frac{NdChar}{\left(\left(\frac{EDonor}{KbT} + 2\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}\\ \mathbf{elif}\;KbT \leq 1.6 \cdot 10^{-269}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \mathbf{elif}\;KbT \leq 4.5 \cdot 10^{+201}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 70.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{if}\;NaChar \leq -3.9 \cdot 10^{+32}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NaChar \leq 3.3 \cdot 10^{+28}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NaChar (+ (exp (/ (+ (- Vef mu) (+ EAccept Ev)) KbT)) 1.0))))
   (if (<= NaChar -3.9e+32)
     t_0
     (if (<= NaChar 3.3e+28)
       (/ NdChar (+ (exp (/ (+ (+ EDonor Vef) (- mu Ec)) KbT)) 1.0))
       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((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	double tmp;
	if (NaChar <= -3.9e+32) {
		tmp = t_0;
	} else if (NaChar <= 3.3e+28) {
		tmp = NdChar / (exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	} else {
		tmp = t_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) :: tmp
    t_0 = nachar / (exp((((vef - mu) + (eaccept + ev)) / kbt)) + 1.0d0)
    if (nachar <= (-3.9d+32)) then
        tmp = t_0
    else if (nachar <= 3.3d+28) then
        tmp = ndchar / (exp((((edonor + vef) + (mu - ec)) / kbt)) + 1.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NaChar / (Math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	double tmp;
	if (NaChar <= -3.9e+32) {
		tmp = t_0;
	} else if (NaChar <= 3.3e+28) {
		tmp = NdChar / (Math.exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NaChar / (math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0)
	tmp = 0
	if NaChar <= -3.9e+32:
		tmp = t_0
	elif NaChar <= 3.3e+28:
		tmp = NdChar / (math.exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0)
	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(Float64(Vef - mu) + Float64(EAccept + Ev)) / KbT)) + 1.0))
	tmp = 0.0
	if (NaChar <= -3.9e+32)
		tmp = t_0;
	elseif (NaChar <= 3.3e+28)
		tmp = Float64(NdChar / Float64(exp(Float64(Float64(Float64(EDonor + Vef) + Float64(mu - Ec)) / KbT)) + 1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = NaChar / (exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	tmp = 0.0;
	if (NaChar <= -3.9e+32)
		tmp = t_0;
	elseif (NaChar <= 3.3e+28)
		tmp = NdChar / (exp((((EDonor + Vef) + (mu - Ec)) / KbT)) + 1.0);
	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[(N[Exp[N[(N[(N[(Vef - mu), $MachinePrecision] + N[(EAccept + Ev), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NaChar, -3.9e+32], t$95$0, If[LessEqual[NaChar, 3.3e+28], N[(NdChar / N[(N[Exp[N[(N[(N[(EDonor + Vef), $MachinePrecision] + N[(mu - Ec), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\
\mathbf{if}\;NaChar \leq -3.9 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;NaChar \leq 3.3 \cdot 10^{+28}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if NaChar < -3.8999999999999999e32 or 3.3e28 < NaChar

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6475.9%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.9%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]

    if -3.8999999999999999e32 < NaChar < 3.3e28

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6481.6%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified81.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;NaChar \leq -3.9 \cdot 10^{+32}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{elif}\;NaChar \leq 3.3 \cdot 10^{+28}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(EDonor + Vef\right) + \left(mu - Ec\right)}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 58.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{if}\;NdChar \leq -4 \cdot 10^{+70}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NdChar \leq 2.8 \cdot 10^{+80}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{elif}\;NdChar \leq 1.7 \cdot 10^{+168}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NdChar (+ (exp (/ EDonor KbT)) 1.0))))
   (if (<= NdChar -4e+70)
     t_0
     (if (<= NdChar 2.8e+80)
       (/ NaChar (+ (exp (/ (+ (- Vef mu) (+ EAccept Ev)) KbT)) 1.0))
       (if (<= NdChar 1.7e+168) (/ NdChar (+ (exp (/ Vef KbT)) 1.0)) t_0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NdChar / (exp((EDonor / KbT)) + 1.0);
	double tmp;
	if (NdChar <= -4e+70) {
		tmp = t_0;
	} else if (NdChar <= 2.8e+80) {
		tmp = NaChar / (exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	} else if (NdChar <= 1.7e+168) {
		tmp = NdChar / (exp((Vef / KbT)) + 1.0);
	} else {
		tmp = t_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) :: tmp
    t_0 = ndchar / (exp((edonor / kbt)) + 1.0d0)
    if (ndchar <= (-4d+70)) then
        tmp = t_0
    else if (ndchar <= 2.8d+80) then
        tmp = nachar / (exp((((vef - mu) + (eaccept + ev)) / kbt)) + 1.0d0)
    else if (ndchar <= 1.7d+168) then
        tmp = ndchar / (exp((vef / kbt)) + 1.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NdChar / (Math.exp((EDonor / KbT)) + 1.0);
	double tmp;
	if (NdChar <= -4e+70) {
		tmp = t_0;
	} else if (NdChar <= 2.8e+80) {
		tmp = NaChar / (Math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	} else if (NdChar <= 1.7e+168) {
		tmp = NdChar / (Math.exp((Vef / KbT)) + 1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NdChar / (math.exp((EDonor / KbT)) + 1.0)
	tmp = 0
	if NdChar <= -4e+70:
		tmp = t_0
	elif NdChar <= 2.8e+80:
		tmp = NaChar / (math.exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0)
	elif NdChar <= 1.7e+168:
		tmp = NdChar / (math.exp((Vef / KbT)) + 1.0)
	else:
		tmp = t_0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(NdChar / Float64(exp(Float64(EDonor / KbT)) + 1.0))
	tmp = 0.0
	if (NdChar <= -4e+70)
		tmp = t_0;
	elseif (NdChar <= 2.8e+80)
		tmp = Float64(NaChar / Float64(exp(Float64(Float64(Float64(Vef - mu) + Float64(EAccept + Ev)) / KbT)) + 1.0));
	elseif (NdChar <= 1.7e+168)
		tmp = Float64(NdChar / Float64(exp(Float64(Vef / KbT)) + 1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = NdChar / (exp((EDonor / KbT)) + 1.0);
	tmp = 0.0;
	if (NdChar <= -4e+70)
		tmp = t_0;
	elseif (NdChar <= 2.8e+80)
		tmp = NaChar / (exp((((Vef - mu) + (EAccept + Ev)) / KbT)) + 1.0);
	elseif (NdChar <= 1.7e+168)
		tmp = NdChar / (exp((Vef / KbT)) + 1.0);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NdChar, -4e+70], t$95$0, If[LessEqual[NdChar, 2.8e+80], N[(NaChar / N[(N[Exp[N[(N[(N[(Vef - mu), $MachinePrecision] + N[(EAccept + Ev), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, 1.7e+168], N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\
\mathbf{if}\;NdChar \leq -4 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;NdChar \leq 2.8 \cdot 10^{+80}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\

\mathbf{elif}\;NdChar \leq 1.7 \cdot 10^{+168}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if NdChar < -4.00000000000000029e70 or 1.70000000000000001e168 < NdChar

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6483.6%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified83.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in EDonor around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EDonor}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6459.0%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EDonor, KbT\right)\right)\right)\right) \]
    10. Simplified59.0%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{EDonor}{KbT}}}} \]

    if -4.00000000000000029e70 < NdChar < 2.79999999999999984e80

    1. Initial program 99.3%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6473.3%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified73.3%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]

    if 2.79999999999999984e80 < NdChar < 1.70000000000000001e168

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6479.1%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified79.1%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6464.3%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified64.3%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;NdChar \leq -4 \cdot 10^{+70}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;NdChar \leq 2.8 \cdot 10^{+80}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{\left(Vef - mu\right) + \left(EAccept + Ev\right)}{KbT}} + 1}\\ \mathbf{elif}\;NdChar \leq 1.7 \cdot 10^{+168}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 44.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{Vef}{KbT}} + 1\\ \mathbf{if}\;Vef \leq -1.3 \cdot 10^{+123}:\\ \;\;\;\;\frac{NaChar}{t\_0}\\ \mathbf{elif}\;Vef \leq -4.6 \cdot 10^{-273}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 5.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{t\_0}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (+ (exp (/ Vef KbT)) 1.0)))
   (if (<= Vef -1.3e+123)
     (/ NaChar t_0)
     (if (<= Vef -4.6e-273)
       (/ NdChar (+ (exp (/ EDonor KbT)) 1.0))
       (if (<= Vef 5.5e-94)
         (/ NaChar (+ (exp (/ Ev KbT)) 1.0))
         (/ NdChar t_0))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = exp((Vef / KbT)) + 1.0;
	double tmp;
	if (Vef <= -1.3e+123) {
		tmp = NaChar / t_0;
	} else if (Vef <= -4.6e-273) {
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	} else if (Vef <= 5.5e-94) {
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	} else {
		tmp = NdChar / t_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) :: tmp
    t_0 = exp((vef / kbt)) + 1.0d0
    if (vef <= (-1.3d+123)) then
        tmp = nachar / t_0
    else if (vef <= (-4.6d-273)) then
        tmp = ndchar / (exp((edonor / kbt)) + 1.0d0)
    else if (vef <= 5.5d-94) then
        tmp = nachar / (exp((ev / kbt)) + 1.0d0)
    else
        tmp = ndchar / t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = Math.exp((Vef / KbT)) + 1.0;
	double tmp;
	if (Vef <= -1.3e+123) {
		tmp = NaChar / t_0;
	} else if (Vef <= -4.6e-273) {
		tmp = NdChar / (Math.exp((EDonor / KbT)) + 1.0);
	} else if (Vef <= 5.5e-94) {
		tmp = NaChar / (Math.exp((Ev / KbT)) + 1.0);
	} else {
		tmp = NdChar / t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = math.exp((Vef / KbT)) + 1.0
	tmp = 0
	if Vef <= -1.3e+123:
		tmp = NaChar / t_0
	elif Vef <= -4.6e-273:
		tmp = NdChar / (math.exp((EDonor / KbT)) + 1.0)
	elif Vef <= 5.5e-94:
		tmp = NaChar / (math.exp((Ev / KbT)) + 1.0)
	else:
		tmp = NdChar / t_0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(exp(Float64(Vef / KbT)) + 1.0)
	tmp = 0.0
	if (Vef <= -1.3e+123)
		tmp = Float64(NaChar / t_0);
	elseif (Vef <= -4.6e-273)
		tmp = Float64(NdChar / Float64(exp(Float64(EDonor / KbT)) + 1.0));
	elseif (Vef <= 5.5e-94)
		tmp = Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0));
	else
		tmp = Float64(NdChar / t_0);
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = exp((Vef / KbT)) + 1.0;
	tmp = 0.0;
	if (Vef <= -1.3e+123)
		tmp = NaChar / t_0;
	elseif (Vef <= -4.6e-273)
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	elseif (Vef <= 5.5e-94)
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	else
		tmp = NdChar / t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[Vef, -1.3e+123], N[(NaChar / t$95$0), $MachinePrecision], If[LessEqual[Vef, -4.6e-273], N[(NdChar / N[(N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 5.5e-94], N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(NdChar / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{Vef}{KbT}} + 1\\
\mathbf{if}\;Vef \leq -1.3 \cdot 10^{+123}:\\
\;\;\;\;\frac{NaChar}{t\_0}\\

\mathbf{elif}\;Vef \leq -4.6 \cdot 10^{-273}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\

\mathbf{elif}\;Vef \leq 5.5 \cdot 10^{-94}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if Vef < -1.29999999999999993e123

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6482.1%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified82.1%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6466.8%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified66.8%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]

    if -1.29999999999999993e123 < Vef < -4.59999999999999961e-273

    1. Initial program 98.9%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6464.2%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified64.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in EDonor around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EDonor}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6449.7%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EDonor, KbT\right)\right)\right)\right) \]
    10. Simplified49.7%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{EDonor}{KbT}}}} \]

    if -4.59999999999999961e-273 < Vef < 5.49999999999999989e-94

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in Ev around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Ev}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6470.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right)\right) \]
    7. Simplified70.7%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{Ev}{KbT}}}} \]
    8. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{Ev}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{Ev}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{Ev}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f6440.9%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right) \]
    10. Simplified40.9%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]

    if 5.49999999999999989e-94 < Vef

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6475.5%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.5%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6457.8%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified57.8%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification53.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq -1.3 \cdot 10^{+123}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq -4.6 \cdot 10^{-273}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 5.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 42.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{if}\;Vef \leq -2.7 \cdot 10^{-74}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;Vef \leq 2.62 \cdot 10^{-48}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 5.6 \cdot 10^{+130}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NaChar (+ (exp (/ Vef KbT)) 1.0))))
   (if (<= Vef -2.7e-74)
     t_0
     (if (<= Vef 2.62e-48)
       (/ NaChar (+ (exp (/ Ev KbT)) 1.0))
       (if (<= Vef 5.6e+130)
         (*
          0.5
          (/
           -1.0
           (/
            (+ (/ (- NaChar (/ (* NaChar NaChar) NdChar)) NdChar) -1.0)
            NdChar)))
         t_0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NaChar / (exp((Vef / KbT)) + 1.0);
	double tmp;
	if (Vef <= -2.7e-74) {
		tmp = t_0;
	} else if (Vef <= 2.62e-48) {
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	} else if (Vef <= 5.6e+130) {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	} else {
		tmp = t_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) :: tmp
    t_0 = nachar / (exp((vef / kbt)) + 1.0d0)
    if (vef <= (-2.7d-74)) then
        tmp = t_0
    else if (vef <= 2.62d-48) then
        tmp = nachar / (exp((ev / kbt)) + 1.0d0)
    else if (vef <= 5.6d+130) then
        tmp = 0.5d0 * ((-1.0d0) / ((((nachar - ((nachar * nachar) / ndchar)) / ndchar) + (-1.0d0)) / ndchar))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NaChar / (Math.exp((Vef / KbT)) + 1.0);
	double tmp;
	if (Vef <= -2.7e-74) {
		tmp = t_0;
	} else if (Vef <= 2.62e-48) {
		tmp = NaChar / (Math.exp((Ev / KbT)) + 1.0);
	} else if (Vef <= 5.6e+130) {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NaChar / (math.exp((Vef / KbT)) + 1.0)
	tmp = 0
	if Vef <= -2.7e-74:
		tmp = t_0
	elif Vef <= 2.62e-48:
		tmp = NaChar / (math.exp((Ev / KbT)) + 1.0)
	elif Vef <= 5.6e+130:
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar))
	else:
		tmp = t_0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(NaChar / Float64(exp(Float64(Vef / KbT)) + 1.0))
	tmp = 0.0
	if (Vef <= -2.7e-74)
		tmp = t_0;
	elseif (Vef <= 2.62e-48)
		tmp = Float64(NaChar / Float64(exp(Float64(Ev / KbT)) + 1.0));
	elseif (Vef <= 5.6e+130)
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(Float64(Float64(NaChar - Float64(Float64(NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = NaChar / (exp((Vef / KbT)) + 1.0);
	tmp = 0.0;
	if (Vef <= -2.7e-74)
		tmp = t_0;
	elseif (Vef <= 2.62e-48)
		tmp = NaChar / (exp((Ev / KbT)) + 1.0);
	elseif (Vef <= 5.6e+130)
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	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[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[Vef, -2.7e-74], t$95$0, If[LessEqual[Vef, 2.62e-48], N[(NaChar / N[(N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 5.6e+130], N[(0.5 * N[(-1.0 / N[(N[(N[(N[(NaChar - N[(N[(NaChar * NaChar), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision] / NdChar), $MachinePrecision] + -1.0), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\
\mathbf{if}\;Vef \leq -2.7 \cdot 10^{-74}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;Vef \leq 2.62 \cdot 10^{-48}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\

\mathbf{elif}\;Vef \leq 5.6 \cdot 10^{+130}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if Vef < -2.70000000000000018e-74 or 5.5999999999999997e130 < Vef

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6466.7%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified66.7%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6453.4%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified53.4%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]

    if -2.70000000000000018e-74 < Vef < 2.6200000000000001e-48

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in Ev around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Ev}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6474.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right)\right) \]
    7. Simplified74.6%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{Ev}{KbT}}}} \]
    8. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{Ev}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{Ev}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{Ev}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f6438.3%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right) \]
    10. Simplified38.3%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]

    if 2.6200000000000001e-48 < Vef < 5.5999999999999997e130

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6430.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified30.2%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f6411.0%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr11.0%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around -inf

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1}{NdChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1\right)}{\color{blue}{NdChar}}\right)\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + \left(\mathsf{neg}\left(1\right)\right)\right)}{NdChar}\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1\right)}{NdChar}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right) + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}\right)}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      6. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(-1 \cdot NaChar\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(NaChar\right)\right)\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + 1}{NdChar}\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}}{NdChar}\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right), \color{blue}{NdChar}\right)\right)\right) \]
    12. Simplified34.3%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 - \frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar}}{NdChar}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq -2.7 \cdot 10^{-74}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 2.62 \cdot 10^{-48}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Ev}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 5.6 \cdot 10^{+130}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 39.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -3.1 \cdot 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq -2.05 \cdot 10^{+119}:\\ \;\;\;\;\frac{NdChar}{\left(\left(\frac{EDonor}{KbT} + 2\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}\\ \mathbf{elif}\;KbT \leq 1.2 \cdot 10^{+201}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -3.1e+171)
     t_0
     (if (<= KbT -2.05e+119)
       (/
        NdChar
        (- (+ (+ (/ EDonor KbT) 2.0) (+ (/ Vef KbT) (/ mu KbT))) (/ Ec KbT)))
       (if (<= KbT 1.2e+201) (/ NaChar (+ (exp (/ EAccept KbT)) 1.0)) 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 <= -3.1e+171) {
		tmp = t_0;
	} else if (KbT <= -2.05e+119) {
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT));
	} else if (KbT <= 1.2e+201) {
		tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-3.1d+171)) then
        tmp = t_0
    else if (kbt <= (-2.05d+119)) then
        tmp = ndchar / ((((edonor / kbt) + 2.0d0) + ((vef / kbt) + (mu / kbt))) - (ec / kbt))
    else if (kbt <= 1.2d+201) then
        tmp = nachar / (exp((eaccept / kbt)) + 1.0d0)
    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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -3.1e+171) {
		tmp = t_0;
	} else if (KbT <= -2.05e+119) {
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT));
	} else if (KbT <= 1.2e+201) {
		tmp = NaChar / (Math.exp((EAccept / KbT)) + 1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -3.1e+171:
		tmp = t_0
	elif KbT <= -2.05e+119:
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT))
	elif KbT <= 1.2e+201:
		tmp = NaChar / (math.exp((EAccept / KbT)) + 1.0)
	else:
		tmp = 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 <= -3.1e+171)
		tmp = t_0;
	elseif (KbT <= -2.05e+119)
		tmp = Float64(NdChar / Float64(Float64(Float64(Float64(EDonor / KbT) + 2.0) + Float64(Float64(Vef / KbT) + Float64(mu / KbT))) - Float64(Ec / KbT)));
	elseif (KbT <= 1.2e+201)
		tmp = Float64(NaChar / Float64(exp(Float64(EAccept / KbT)) + 1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -3.1e+171)
		tmp = t_0;
	elseif (KbT <= -2.05e+119)
		tmp = NdChar / ((((EDonor / KbT) + 2.0) + ((Vef / KbT) + (mu / KbT))) - (Ec / KbT));
	elseif (KbT <= 1.2e+201)
		tmp = NaChar / (exp((EAccept / KbT)) + 1.0);
	else
		tmp = t_0;
	end
	tmp_2 = 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, -3.1e+171], t$95$0, If[LessEqual[KbT, -2.05e+119], N[(NdChar / N[(N[(N[(N[(EDonor / KbT), $MachinePrecision] + 2.0), $MachinePrecision] + N[(N[(Vef / KbT), $MachinePrecision] + N[(mu / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 1.2e+201], N[(NaChar / N[(N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -3.1 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq -2.05 \cdot 10^{+119}:\\
\;\;\;\;\frac{NdChar}{\left(\left(\frac{EDonor}{KbT} + 2\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}\\

\mathbf{elif}\;KbT \leq 1.2 \cdot 10^{+201}:\\
\;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if KbT < -3.0999999999999999e171 or 1.19999999999999996e201 < KbT

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6468.4%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified68.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -3.0999999999999999e171 < KbT < -2.0499999999999999e119

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in KbT around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(\left(2 + \left(\frac{EDonor}{KbT} + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right)\right) - \frac{Ec}{KbT}\right)}\right) \]
    9. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\left(2 + \left(\frac{EDonor}{KbT} + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right)\right), \color{blue}{\left(\frac{Ec}{KbT}\right)}\right)\right) \]
      2. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\left(\left(2 + \frac{EDonor}{KbT}\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{\color{blue}{Ec}}{KbT}\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\left(2 + \frac{EDonor}{KbT}\right), \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{\color{blue}{Ec}}{KbT}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{EDonor}{KbT}\right)\right), \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\left(\frac{Vef}{KbT}\right), \left(\frac{mu}{KbT}\right)\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right), \left(\frac{mu}{KbT}\right)\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right), \mathsf{/.f64}\left(mu, KbT\right)\right)\right), \left(\frac{Ec}{KbT}\right)\right)\right) \]
      9. /-lowering-/.f6464.9%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(EDonor, KbT\right)\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right), \mathsf{/.f64}\left(mu, KbT\right)\right)\right), \mathsf{/.f64}\left(Ec, \color{blue}{KbT}\right)\right)\right) \]
    10. Simplified64.9%

      \[\leadsto \frac{NdChar}{\color{blue}{\left(\left(2 + \frac{EDonor}{KbT}\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}} \]

    if -2.0499999999999999e119 < KbT < 1.19999999999999996e201

    1. Initial program 99.5%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6464.6%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified64.6%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in EAccept around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EAccept}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6432.7%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EAccept, KbT\right)\right)\right)\right) \]
    10. Simplified32.7%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{EAccept}{KbT}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification41.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -3.1 \cdot 10^{+171}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq -2.05 \cdot 10^{+119}:\\ \;\;\;\;\frac{NdChar}{\left(\left(\frac{EDonor}{KbT} + 2\right) + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right) - \frac{Ec}{KbT}}\\ \mathbf{elif}\;KbT \leq 1.2 \cdot 10^{+201}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{EAccept}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 44.7% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{if}\;Vef \leq -3.4 \cdot 10^{+121}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;Vef \leq 2.2 \cdot 10^{+131}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NaChar (+ (exp (/ Vef KbT)) 1.0))))
   (if (<= Vef -3.4e+121)
     t_0
     (if (<= Vef 2.2e+131) (/ NdChar (+ (exp (/ EDonor KbT)) 1.0)) 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((Vef / KbT)) + 1.0);
	double tmp;
	if (Vef <= -3.4e+121) {
		tmp = t_0;
	} else if (Vef <= 2.2e+131) {
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	} else {
		tmp = t_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) :: tmp
    t_0 = nachar / (exp((vef / kbt)) + 1.0d0)
    if (vef <= (-3.4d+121)) then
        tmp = t_0
    else if (vef <= 2.2d+131) then
        tmp = ndchar / (exp((edonor / kbt)) + 1.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NaChar / (Math.exp((Vef / KbT)) + 1.0);
	double tmp;
	if (Vef <= -3.4e+121) {
		tmp = t_0;
	} else if (Vef <= 2.2e+131) {
		tmp = NdChar / (Math.exp((EDonor / KbT)) + 1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NaChar / (math.exp((Vef / KbT)) + 1.0)
	tmp = 0
	if Vef <= -3.4e+121:
		tmp = t_0
	elif Vef <= 2.2e+131:
		tmp = NdChar / (math.exp((EDonor / KbT)) + 1.0)
	else:
		tmp = t_0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(NaChar / Float64(exp(Float64(Vef / KbT)) + 1.0))
	tmp = 0.0
	if (Vef <= -3.4e+121)
		tmp = t_0;
	elseif (Vef <= 2.2e+131)
		tmp = Float64(NdChar / Float64(exp(Float64(EDonor / KbT)) + 1.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = NaChar / (exp((Vef / KbT)) + 1.0);
	tmp = 0.0;
	if (Vef <= -3.4e+121)
		tmp = t_0;
	elseif (Vef <= 2.2e+131)
		tmp = NdChar / (exp((EDonor / KbT)) + 1.0);
	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[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[Vef, -3.4e+121], t$95$0, If[LessEqual[Vef, 2.2e+131], N[(NdChar / N[(N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\
\mathbf{if}\;Vef \leq -3.4 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;Vef \leq 2.2 \cdot 10^{+131}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if Vef < -3.4000000000000001e121 or 2.1999999999999999e131 < Vef

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6474.8%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified74.8%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in Vef around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Vef}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6463.9%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Vef, KbT\right)\right)\right)\right) \]
    10. Simplified63.9%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} \]

    if -3.4000000000000001e121 < Vef < 2.1999999999999999e131

    1. Initial program 99.4%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around inf

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \color{blue}{\left(1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) - Ec\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(\left(Vef + mu\right) + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EDonor + \left(Vef + \left(mu + -1 \cdot Ec\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EDonor + Vef\right) + \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EDonor + Vef\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(Vef + EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + -1 \cdot Ec\right)\right), KbT\right)\right)\right)\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu + \left(\mathsf{neg}\left(Ec\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \left(mu - Ec\right)\right), KbT\right)\right)\right)\right) \]
      15. --lowering--.f6464.1%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(Vef, EDonor\right), \mathsf{\_.f64}\left(mu, Ec\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified64.1%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(Vef + EDonor\right) + \left(mu - Ec\right)}{KbT}}}} \]
    8. Taylor expanded in EDonor around inf

      \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{EDonor}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f6445.3%

        \[\leadsto \mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(EDonor, KbT\right)\right)\right)\right) \]
    10. Simplified45.3%

      \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{EDonor}{KbT}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq -3.4 \cdot 10^{+121}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \mathbf{elif}\;Vef \leq 2.2 \cdot 10^{+131}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{e^{\frac{Vef}{KbT}} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 34.3% accurate, 5.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(Vef - mu\right) + \left(EAccept + Ev\right)\\ t_1 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -1.65 \cdot 10^{+190}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;KbT \leq 6.1 \cdot 10^{+233}:\\ \;\;\;\;\frac{NaChar}{2 + \frac{t\_0 + \frac{-0.5 \cdot \left(t\_0 \cdot \left(\left(mu - Vef\right) - \left(EAccept + Ev\right)\right)\right)}{KbT}}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (+ (- Vef mu) (+ EAccept Ev))) (t_1 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -1.65e+190)
     t_1
     (if (<= KbT 6.1e+233)
       (/
        NaChar
        (+
         2.0
         (/
          (+ t_0 (/ (* -0.5 (* t_0 (- (- mu Vef) (+ EAccept Ev)))) KbT))
          KbT)))
       t_1))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = (Vef - mu) + (EAccept + Ev);
	double t_1 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -1.65e+190) {
		tmp = t_1;
	} else if (KbT <= 6.1e+233) {
		tmp = NaChar / (2.0 + ((t_0 + ((-0.5 * (t_0 * ((mu - Vef) - (EAccept + Ev)))) / KbT)) / KbT));
	} else {
		tmp = t_1;
	}
	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 = (vef - mu) + (eaccept + ev)
    t_1 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-1.65d+190)) then
        tmp = t_1
    else if (kbt <= 6.1d+233) then
        tmp = nachar / (2.0d0 + ((t_0 + (((-0.5d0) * (t_0 * ((mu - vef) - (eaccept + ev)))) / kbt)) / kbt))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = (Vef - mu) + (EAccept + Ev);
	double t_1 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -1.65e+190) {
		tmp = t_1;
	} else if (KbT <= 6.1e+233) {
		tmp = NaChar / (2.0 + ((t_0 + ((-0.5 * (t_0 * ((mu - Vef) - (EAccept + Ev)))) / KbT)) / KbT));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = (Vef - mu) + (EAccept + Ev)
	t_1 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -1.65e+190:
		tmp = t_1
	elif KbT <= 6.1e+233:
		tmp = NaChar / (2.0 + ((t_0 + ((-0.5 * (t_0 * ((mu - Vef) - (EAccept + Ev)))) / KbT)) / KbT))
	else:
		tmp = t_1
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(Float64(Vef - mu) + Float64(EAccept + Ev))
	t_1 = Float64(0.5 * Float64(NdChar + NaChar))
	tmp = 0.0
	if (KbT <= -1.65e+190)
		tmp = t_1;
	elseif (KbT <= 6.1e+233)
		tmp = Float64(NaChar / Float64(2.0 + Float64(Float64(t_0 + Float64(Float64(-0.5 * Float64(t_0 * Float64(Float64(mu - Vef) - Float64(EAccept + Ev)))) / KbT)) / KbT)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = (Vef - mu) + (EAccept + Ev);
	t_1 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -1.65e+190)
		tmp = t_1;
	elseif (KbT <= 6.1e+233)
		tmp = NaChar / (2.0 + ((t_0 + ((-0.5 * (t_0 * ((mu - Vef) - (EAccept + Ev)))) / KbT)) / KbT));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(Vef - mu), $MachinePrecision] + N[(EAccept + Ev), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -1.65e+190], t$95$1, If[LessEqual[KbT, 6.1e+233], N[(NaChar / N[(2.0 + N[(N[(t$95$0 + N[(N[(-0.5 * N[(t$95$0 * N[(N[(mu - Vef), $MachinePrecision] - N[(EAccept + Ev), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(Vef - mu\right) + \left(EAccept + Ev\right)\\
t_1 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -1.65 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;KbT \leq 6.1 \cdot 10^{+233}:\\
\;\;\;\;\frac{NaChar}{2 + \frac{t\_0 + \frac{-0.5 \cdot \left(t\_0 \cdot \left(\left(mu - Vef\right) - \left(EAccept + Ev\right)\right)\right)}{KbT}}{KbT}}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if KbT < -1.65e190 or 6.1000000000000003e233 < KbT

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6484.5%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified84.5%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -1.65e190 < KbT < 6.1000000000000003e233

    1. Initial program 99.6%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6463.2%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified63.2%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in KbT around -inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(2 + -1 \cdot \frac{-1 \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}^{2}}{KbT}}{KbT}\right)}\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \left(2 + \left(\mathsf{neg}\left(\frac{-1 \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}^{2}}{KbT}}{KbT}\right)\right)\right)\right) \]
      2. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \left(2 - \color{blue}{\frac{-1 \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}^{2}}{KbT}}{KbT}}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \color{blue}{\left(\frac{-1 \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}^{2}}{KbT}}{KbT}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\left(-1 \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}^{2}}{KbT}\right), \color{blue}{KbT}\right)\right)\right) \]
    10. Simplified33.4%

      \[\leadsto \frac{NaChar}{\color{blue}{2 - \frac{\frac{-0.5 \cdot \left(\left(\left(Ev + EAccept\right) + \left(Vef - mu\right)\right) \cdot \left(\left(Ev + EAccept\right) + \left(Vef - mu\right)\right)\right)}{KbT} - \left(\left(Ev + EAccept\right) + \left(Vef - mu\right)\right)}{KbT}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -1.65 \cdot 10^{+190}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq 6.1 \cdot 10^{+233}:\\ \;\;\;\;\frac{NaChar}{2 + \frac{\left(\left(Vef - mu\right) + \left(EAccept + Ev\right)\right) + \frac{-0.5 \cdot \left(\left(\left(Vef - mu\right) + \left(EAccept + Ev\right)\right) \cdot \left(\left(mu - Vef\right) - \left(EAccept + Ev\right)\right)\right)}{KbT}}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 31.2% accurate, 7.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -3.3 \cdot 10^{+162}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq -1.45 \cdot 10^{-162}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \mathbf{elif}\;KbT \leq 5 \cdot 10^{-180}:\\ \;\;\;\;\frac{NaChar}{2 - mu \cdot \left(\frac{1}{KbT} - \frac{mu \cdot 0.5}{KbT \cdot KbT}\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -3.3e+162)
     t_0
     (if (<= KbT -1.45e-162)
       (*
        0.5
        (/
         -1.0
         (/
          (+ (/ (- NaChar (/ (* NaChar NaChar) NdChar)) NdChar) -1.0)
          NdChar)))
       (if (<= KbT 5e-180)
         (/ NaChar (- 2.0 (* mu (- (/ 1.0 KbT) (/ (* mu 0.5) (* KbT 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 <= -3.3e+162) {
		tmp = t_0;
	} else if (KbT <= -1.45e-162) {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	} else if (KbT <= 5e-180) {
		tmp = NaChar / (2.0 - (mu * ((1.0 / KbT) - ((mu * 0.5) / (KbT * KbT)))));
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-3.3d+162)) then
        tmp = t_0
    else if (kbt <= (-1.45d-162)) then
        tmp = 0.5d0 * ((-1.0d0) / ((((nachar - ((nachar * nachar) / ndchar)) / ndchar) + (-1.0d0)) / ndchar))
    else if (kbt <= 5d-180) then
        tmp = nachar / (2.0d0 - (mu * ((1.0d0 / kbt) - ((mu * 0.5d0) / (kbt * 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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -3.3e+162) {
		tmp = t_0;
	} else if (KbT <= -1.45e-162) {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	} else if (KbT <= 5e-180) {
		tmp = NaChar / (2.0 - (mu * ((1.0 / KbT) - ((mu * 0.5) / (KbT * KbT)))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -3.3e+162:
		tmp = t_0
	elif KbT <= -1.45e-162:
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar))
	elif KbT <= 5e-180:
		tmp = NaChar / (2.0 - (mu * ((1.0 / KbT) - ((mu * 0.5) / (KbT * KbT)))))
	else:
		tmp = 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 <= -3.3e+162)
		tmp = t_0;
	elseif (KbT <= -1.45e-162)
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(Float64(Float64(NaChar - Float64(Float64(NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar)));
	elseif (KbT <= 5e-180)
		tmp = Float64(NaChar / Float64(2.0 - Float64(mu * Float64(Float64(1.0 / KbT) - Float64(Float64(mu * 0.5) / Float64(KbT * KbT))))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -3.3e+162)
		tmp = t_0;
	elseif (KbT <= -1.45e-162)
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	elseif (KbT <= 5e-180)
		tmp = NaChar / (2.0 - (mu * ((1.0 / KbT) - ((mu * 0.5) / (KbT * 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[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -3.3e+162], t$95$0, If[LessEqual[KbT, -1.45e-162], N[(0.5 * N[(-1.0 / N[(N[(N[(N[(NaChar - N[(N[(NaChar * NaChar), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision] / NdChar), $MachinePrecision] + -1.0), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 5e-180], N[(NaChar / N[(2.0 - N[(mu * N[(N[(1.0 / KbT), $MachinePrecision] - N[(N[(mu * 0.5), $MachinePrecision] / N[(KbT * KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -3.3 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq -1.45 \cdot 10^{-162}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\

\mathbf{elif}\;KbT \leq 5 \cdot 10^{-180}:\\
\;\;\;\;\frac{NaChar}{2 - mu \cdot \left(\frac{1}{KbT} - \frac{mu \cdot 0.5}{KbT \cdot KbT}\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if KbT < -3.29999999999999987e162 or 5.0000000000000001e-180 < KbT

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6440.3%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified40.3%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -3.29999999999999987e162 < KbT < -1.4500000000000001e-162

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6419.7%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified19.7%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f648.0%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr8.0%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around -inf

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1}{NdChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1\right)}{\color{blue}{NdChar}}\right)\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + \left(\mathsf{neg}\left(1\right)\right)\right)}{NdChar}\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1\right)}{NdChar}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right) + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}\right)}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      6. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(-1 \cdot NaChar\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(NaChar\right)\right)\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + 1}{NdChar}\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}}{NdChar}\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right), \color{blue}{NdChar}\right)\right)\right) \]
    12. Simplified27.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 - \frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar}}{NdChar}}} \]

    if -1.4500000000000001e-162 < KbT < 5.0000000000000001e-180

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6468.0%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified68.0%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in mu around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \frac{mu}{KbT}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\frac{mu}{KbT}\right)\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(0 - \frac{mu}{KbT}\right)\right)\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{mu}{KbT}\right)\right)\right)\right)\right) \]
      4. /-lowering-/.f6433.0%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(mu, KbT\right)\right)\right)\right)\right) \]
    10. Simplified33.0%

      \[\leadsto \frac{NaChar}{1 + e^{\color{blue}{0 - \frac{mu}{KbT}}}} \]
    11. Taylor expanded in mu around 0

      \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(2 + mu \cdot \left(\frac{1}{2} \cdot \frac{mu}{{KbT}^{2}} - \frac{1}{KbT}\right)\right)}\right) \]
    12. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \color{blue}{\left(mu \cdot \left(\frac{1}{2} \cdot \frac{mu}{{KbT}^{2}} - \frac{1}{KbT}\right)\right)}\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \color{blue}{\left(\frac{1}{2} \cdot \frac{mu}{{KbT}^{2}} - \frac{1}{KbT}\right)}\right)\right)\right) \]
      3. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \left(\frac{1}{2} \cdot \frac{mu}{{KbT}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{KbT}\right)\right)}\right)\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\left(\frac{1}{2} \cdot \frac{mu}{{KbT}^{2}}\right), \color{blue}{\left(\mathsf{neg}\left(\frac{1}{KbT}\right)\right)}\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\left(\frac{\frac{1}{2} \cdot mu}{{KbT}^{2}}\right), \left(\mathsf{neg}\left(\color{blue}{\frac{1}{KbT}}\right)\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot mu\right), \left({KbT}^{2}\right)\right), \left(\mathsf{neg}\left(\color{blue}{\frac{1}{KbT}}\right)\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, mu\right), \left({KbT}^{2}\right)\right), \left(\mathsf{neg}\left(\frac{\color{blue}{1}}{KbT}\right)\right)\right)\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, mu\right), \left(KbT \cdot KbT\right)\right), \left(\mathsf{neg}\left(\frac{1}{\color{blue}{KbT}}\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, mu\right), \mathsf{*.f64}\left(KbT, KbT\right)\right), \left(\mathsf{neg}\left(\frac{1}{\color{blue}{KbT}}\right)\right)\right)\right)\right)\right) \]
      10. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, mu\right), \mathsf{*.f64}\left(KbT, KbT\right)\right), \left(\frac{\mathsf{neg}\left(1\right)}{\color{blue}{KbT}}\right)\right)\right)\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, mu\right), \mathsf{*.f64}\left(KbT, KbT\right)\right), \left(\frac{-1}{KbT}\right)\right)\right)\right)\right) \]
      12. /-lowering-/.f6438.5%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(mu, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, mu\right), \mathsf{*.f64}\left(KbT, KbT\right)\right), \mathsf{/.f64}\left(-1, \color{blue}{KbT}\right)\right)\right)\right)\right) \]
    13. Simplified38.5%

      \[\leadsto \frac{NaChar}{\color{blue}{2 + mu \cdot \left(\frac{0.5 \cdot mu}{KbT \cdot KbT} + \frac{-1}{KbT}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification36.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -3.3 \cdot 10^{+162}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq -1.45 \cdot 10^{-162}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \mathbf{elif}\;KbT \leq 5 \cdot 10^{-180}:\\ \;\;\;\;\frac{NaChar}{2 - mu \cdot \left(\frac{1}{KbT} - \frac{mu \cdot 0.5}{KbT \cdot KbT}\right)}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 30.2% accurate, 7.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -5.6 \cdot 10^{+160}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq -2.1 \cdot 10^{-101}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \mathbf{elif}\;KbT \leq 5 \cdot 10^{-10}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{-1 + \frac{NdChar - \frac{NdChar \cdot NdChar}{NaChar}}{NaChar}}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -5.6e+160)
     t_0
     (if (<= KbT -2.1e-101)
       (*
        0.5
        (/
         -1.0
         (/
          (+ (/ (- NaChar (/ (* NaChar NaChar) NdChar)) NdChar) -1.0)
          NdChar)))
       (if (<= KbT 5e-10)
         (*
          0.5
          (/
           -1.0
           (/
            (+ -1.0 (/ (- NdChar (/ (* NdChar NdChar) NaChar)) NaChar))
            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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -5.6e+160) {
		tmp = t_0;
	} else if (KbT <= -2.1e-101) {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	} else if (KbT <= 5e-10) {
		tmp = 0.5 * (-1.0 / ((-1.0 + ((NdChar - ((NdChar * NdChar) / NaChar)) / NaChar)) / NaChar));
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-5.6d+160)) then
        tmp = t_0
    else if (kbt <= (-2.1d-101)) then
        tmp = 0.5d0 * ((-1.0d0) / ((((nachar - ((nachar * nachar) / ndchar)) / ndchar) + (-1.0d0)) / ndchar))
    else if (kbt <= 5d-10) then
        tmp = 0.5d0 * ((-1.0d0) / (((-1.0d0) + ((ndchar - ((ndchar * ndchar) / nachar)) / nachar)) / nachar))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -5.6e+160) {
		tmp = t_0;
	} else if (KbT <= -2.1e-101) {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	} else if (KbT <= 5e-10) {
		tmp = 0.5 * (-1.0 / ((-1.0 + ((NdChar - ((NdChar * NdChar) / NaChar)) / NaChar)) / NaChar));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -5.6e+160:
		tmp = t_0
	elif KbT <= -2.1e-101:
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar))
	elif KbT <= 5e-10:
		tmp = 0.5 * (-1.0 / ((-1.0 + ((NdChar - ((NdChar * NdChar) / NaChar)) / NaChar)) / NaChar))
	else:
		tmp = 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 <= -5.6e+160)
		tmp = t_0;
	elseif (KbT <= -2.1e-101)
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(Float64(Float64(NaChar - Float64(Float64(NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar)));
	elseif (KbT <= 5e-10)
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(-1.0 + Float64(Float64(NdChar - Float64(Float64(NdChar * NdChar) / NaChar)) / NaChar)) / NaChar)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -5.6e+160)
		tmp = t_0;
	elseif (KbT <= -2.1e-101)
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	elseif (KbT <= 5e-10)
		tmp = 0.5 * (-1.0 / ((-1.0 + ((NdChar - ((NdChar * NdChar) / NaChar)) / NaChar)) / NaChar));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -5.6e+160], t$95$0, If[LessEqual[KbT, -2.1e-101], N[(0.5 * N[(-1.0 / N[(N[(N[(N[(NaChar - N[(N[(NaChar * NaChar), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision] / NdChar), $MachinePrecision] + -1.0), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 5e-10], N[(0.5 * N[(-1.0 / N[(N[(-1.0 + N[(N[(NdChar - N[(N[(NdChar * NdChar), $MachinePrecision] / NaChar), $MachinePrecision]), $MachinePrecision] / NaChar), $MachinePrecision]), $MachinePrecision] / NaChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -5.6 \cdot 10^{+160}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq -2.1 \cdot 10^{-101}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\

\mathbf{elif}\;KbT \leq 5 \cdot 10^{-10}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{-1 + \frac{NdChar - \frac{NdChar \cdot NdChar}{NaChar}}{NaChar}}{NaChar}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if KbT < -5.5999999999999999e160 or 5.00000000000000031e-10 < KbT

    1. Initial program 98.9%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6448.1%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified48.1%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -5.5999999999999999e160 < KbT < -2.10000000000000016e-101

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6421.6%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified21.6%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f648.6%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr8.6%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around -inf

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1}{NdChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1\right)}{\color{blue}{NdChar}}\right)\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + \left(\mathsf{neg}\left(1\right)\right)\right)}{NdChar}\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1\right)}{NdChar}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right) + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}\right)}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      6. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(-1 \cdot NaChar\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(NaChar\right)\right)\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + 1}{NdChar}\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}}{NdChar}\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right), \color{blue}{NdChar}\right)\right)\right) \]
    12. Simplified29.8%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 - \frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar}}{NdChar}}} \]

    if -2.10000000000000016e-101 < KbT < 5.00000000000000031e-10

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6412.4%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified12.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f647.3%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr7.3%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NaChar around -inf

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot NdChar + \frac{{NdChar}^{2}}{NaChar}}{NaChar} - 1}{NaChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NdChar + \frac{{NdChar}^{2}}{NaChar}}{NaChar} - 1\right)}{\color{blue}{NaChar}}\right)\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NdChar + \frac{{NdChar}^{2}}{NaChar}}{NaChar} + \left(\mathsf{neg}\left(1\right)\right)\right)}{NaChar}\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NdChar + \frac{{NdChar}^{2}}{NaChar}}{NaChar} + -1\right)}{NaChar}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NdChar + \frac{{NdChar}^{2}}{NaChar}}{NaChar}\right) + -1 \cdot -1}{NaChar}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NdChar + \frac{{NdChar}^{2}}{NaChar}\right)}{NaChar} + -1 \cdot -1}{NaChar}\right)\right)\right) \]
      6. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NdChar\right) + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar} + -1 \cdot -1}{NaChar}\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(-1 \cdot NdChar\right)\right) + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar} + -1 \cdot -1}{NaChar}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(NdChar\right)\right)\right)\right) + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar} + -1 \cdot -1}{NaChar}\right)\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NdChar + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar} + -1 \cdot -1}{NaChar}\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NdChar + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar} + 1}{NaChar}\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1 + -1 \cdot \frac{NdChar + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar}}{NaChar}\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(1 + -1 \cdot \frac{NdChar + -1 \cdot \frac{{NdChar}^{2}}{NaChar}}{NaChar}\right), \color{blue}{NaChar}\right)\right)\right) \]
    12. Simplified27.0%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 - \frac{NdChar - \frac{NdChar \cdot NdChar}{NaChar}}{NaChar}}{NaChar}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification35.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -5.6 \cdot 10^{+160}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq -2.1 \cdot 10^{-101}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \mathbf{elif}\;KbT \leq 5 \cdot 10^{-10}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{-1 + \frac{NdChar - \frac{NdChar \cdot NdChar}{NaChar}}{NaChar}}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 25.0% accurate, 8.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -8.8 \cdot 10^{-122}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;NdChar \leq 8.5 \cdot 10^{-217}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{NdChar}{NaChar \cdot NaChar} + \frac{-1}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (if (<= NdChar -8.8e-122)
   (* 0.5 (+ NdChar NaChar))
   (if (<= NdChar 8.5e-217)
     (* 0.5 (/ -1.0 (+ (/ NdChar (* NaChar NaChar)) (/ -1.0 NaChar))))
     (*
      0.5
      (/
       -1.0
       (/
        (+ (/ (- NaChar (/ (* NaChar NaChar) NdChar)) NdChar) -1.0)
        NdChar))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double tmp;
	if (NdChar <= -8.8e-122) {
		tmp = 0.5 * (NdChar + NaChar);
	} else if (NdChar <= 8.5e-217) {
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)));
	} else {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	}
	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 <= (-8.8d-122)) then
        tmp = 0.5d0 * (ndchar + nachar)
    else if (ndchar <= 8.5d-217) then
        tmp = 0.5d0 * ((-1.0d0) / ((ndchar / (nachar * nachar)) + ((-1.0d0) / nachar)))
    else
        tmp = 0.5d0 * ((-1.0d0) / ((((nachar - ((nachar * nachar) / ndchar)) / ndchar) + (-1.0d0)) / 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 (NdChar <= -8.8e-122) {
		tmp = 0.5 * (NdChar + NaChar);
	} else if (NdChar <= 8.5e-217) {
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)));
	} else {
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	tmp = 0
	if NdChar <= -8.8e-122:
		tmp = 0.5 * (NdChar + NaChar)
	elif NdChar <= 8.5e-217:
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)))
	else:
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar))
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = 0.0
	if (NdChar <= -8.8e-122)
		tmp = Float64(0.5 * Float64(NdChar + NaChar));
	elseif (NdChar <= 8.5e-217)
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(NdChar / Float64(NaChar * NaChar)) + Float64(-1.0 / NaChar))));
	else
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(Float64(Float64(NaChar - Float64(Float64(NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar)));
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = 0.0;
	if (NdChar <= -8.8e-122)
		tmp = 0.5 * (NdChar + NaChar);
	elseif (NdChar <= 8.5e-217)
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)));
	else
		tmp = 0.5 * (-1.0 / ((((NaChar - ((NaChar * NaChar) / NdChar)) / NdChar) + -1.0) / NdChar));
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NdChar, -8.8e-122], N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, 8.5e-217], N[(0.5 * N[(-1.0 / N[(N[(NdChar / N[(NaChar * NaChar), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / NaChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-1.0 / N[(N[(N[(N[(NaChar - N[(N[(NaChar * NaChar), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision] / NdChar), $MachinePrecision] + -1.0), $MachinePrecision] / NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;NdChar \leq -8.8 \cdot 10^{-122}:\\
\;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\

\mathbf{elif}\;NdChar \leq 8.5 \cdot 10^{-217}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{NdChar}{NaChar \cdot NaChar} + \frac{-1}{NaChar}}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if NdChar < -8.8e-122

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6428.9%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified28.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -8.8e-122 < NdChar < 8.4999999999999994e-217

    1. Initial program 98.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified98.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6420.4%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified20.4%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f6410.0%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr10.0%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around 0

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{NdChar}{{NaChar}^{2}} + \frac{1}{NaChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \color{blue}{-1 \cdot \frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \left(\mathsf{neg}\left(\frac{NdChar}{{NaChar}^{2}}\right)\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} - \color{blue}{\frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(\frac{1}{NaChar}\right), \color{blue}{\left(\frac{NdChar}{{NaChar}^{2}}\right)}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \left(\frac{\color{blue}{NdChar}}{{NaChar}^{2}}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \color{blue}{\left({NaChar}^{2}\right)}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \left(NaChar \cdot \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f6435.5%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \mathsf{*.f64}\left(NaChar, \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
    12. Simplified35.5%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{NaChar} - \frac{NdChar}{NaChar \cdot NaChar}}} \]

    if 8.4999999999999994e-217 < NdChar

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6428.9%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified28.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f649.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr9.2%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around -inf

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1}{NdChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} - 1\right)}{\color{blue}{NdChar}}\right)\right)\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + \left(\mathsf{neg}\left(1\right)\right)\right)}{NdChar}\right)\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1\right)}{NdChar}\right)\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \left(-1 \cdot \frac{-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right) + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar + \frac{{NaChar}^{2}}{NdChar}\right)}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      6. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{-1 \cdot \left(-1 \cdot NaChar\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      7. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(-1 \cdot NaChar\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(NaChar\right)\right)\right)\right) + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + -1 \cdot -1}{NdChar}\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar} + 1}{NdChar}\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}}{NdChar}\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(1 + -1 \cdot \frac{NaChar + -1 \cdot \frac{{NaChar}^{2}}{NdChar}}{NdChar}\right), \color{blue}{NdChar}\right)\right)\right) \]
    12. Simplified32.6%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1 - \frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar}}{NdChar}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification31.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;NdChar \leq -8.8 \cdot 10^{-122}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;NdChar \leq 8.5 \cdot 10^{-217}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{NdChar}{NaChar \cdot NaChar} + \frac{-1}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{\frac{NaChar - \frac{NaChar \cdot NaChar}{NdChar}}{NdChar} + -1}{NdChar}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 30.0% accurate, 9.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -1.25 \cdot 10^{+118}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq 4.5 \cdot 10^{-180}:\\ \;\;\;\;\frac{NaChar}{2 + \frac{Ev - \frac{-0.5 \cdot \left(Ev \cdot Ev\right)}{KbT}}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -1.25e+118)
     t_0
     (if (<= KbT 4.5e-180)
       (/ NaChar (+ 2.0 (/ (- Ev (/ (* -0.5 (* Ev Ev)) KbT)) 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.25e+118) {
		tmp = t_0;
	} else if (KbT <= 4.5e-180) {
		tmp = NaChar / (2.0 + ((Ev - ((-0.5 * (Ev * Ev)) / KbT)) / KbT));
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-1.25d+118)) then
        tmp = t_0
    else if (kbt <= 4.5d-180) then
        tmp = nachar / (2.0d0 + ((ev - (((-0.5d0) * (ev * ev)) / kbt)) / 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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -1.25e+118) {
		tmp = t_0;
	} else if (KbT <= 4.5e-180) {
		tmp = NaChar / (2.0 + ((Ev - ((-0.5 * (Ev * Ev)) / KbT)) / KbT));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -1.25e+118:
		tmp = t_0
	elif KbT <= 4.5e-180:
		tmp = NaChar / (2.0 + ((Ev - ((-0.5 * (Ev * Ev)) / KbT)) / KbT))
	else:
		tmp = 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.25e+118)
		tmp = t_0;
	elseif (KbT <= 4.5e-180)
		tmp = Float64(NaChar / Float64(2.0 + Float64(Float64(Ev - Float64(Float64(-0.5 * Float64(Ev * Ev)) / KbT)) / KbT)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -1.25e+118)
		tmp = t_0;
	elseif (KbT <= 4.5e-180)
		tmp = NaChar / (2.0 + ((Ev - ((-0.5 * (Ev * Ev)) / KbT)) / 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[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -1.25e+118], t$95$0, If[LessEqual[KbT, 4.5e-180], N[(NaChar / N[(2.0 + N[(N[(Ev - N[(N[(-0.5 * N[(Ev * Ev), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -1.25 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq 4.5 \cdot 10^{-180}:\\
\;\;\;\;\frac{NaChar}{2 + \frac{Ev - \frac{-0.5 \cdot \left(Ev \cdot Ev\right)}{KbT}}{KbT}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if KbT < -1.24999999999999993e118 or 4.50000000000000009e-180 < KbT

    1. Initial program 99.3%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6439.1%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified39.1%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -1.24999999999999993e118 < KbT < 4.50000000000000009e-180

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in Ev around inf

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\color{blue}{\left(\frac{Ev}{KbT}\right)}\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6468.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(NdChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(EDonor, \mathsf{\_.f64}\left(mu, \mathsf{\_.f64}\left(Ec, Vef\right)\right)\right), KbT\right)\right)\right)\right), \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right)\right) \]
    7. Simplified68.3%

      \[\leadsto \frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{Ev}{KbT}}}} \]
    8. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{Ev}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{Ev}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{Ev}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f6436.0%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(Ev, KbT\right)\right)\right)\right) \]
    10. Simplified36.0%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}} \]
    11. Taylor expanded in KbT around -inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(2 + -1 \cdot \frac{-1 \cdot Ev + \frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT}}{KbT}\right)}\right) \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \left(2 + \left(\mathsf{neg}\left(\frac{-1 \cdot Ev + \frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT}}{KbT}\right)\right)\right)\right) \]
      2. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \left(2 - \color{blue}{\frac{-1 \cdot Ev + \frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT}}{KbT}}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \color{blue}{\left(\frac{-1 \cdot Ev + \frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT}}{KbT}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\left(-1 \cdot Ev + \frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT}\right), \color{blue}{KbT}\right)\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT} + -1 \cdot Ev\right), KbT\right)\right)\right) \]
      6. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT} + \left(\mathsf{neg}\left(Ev\right)\right)\right), KbT\right)\right)\right) \]
      7. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT} - Ev\right), KbT\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{-1}{2} \cdot \frac{{Ev}^{2}}{KbT}\right), Ev\right), KbT\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{\frac{-1}{2} \cdot {Ev}^{2}}{KbT}\right), Ev\right), KbT\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot {Ev}^{2}\right), KbT\right), Ev\right), KbT\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left({Ev}^{2}\right)\right), KbT\right), Ev\right), KbT\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(Ev \cdot Ev\right)\right), KbT\right), Ev\right), KbT\right)\right)\right) \]
      13. *-lowering-*.f6423.3%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{\_.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(Ev, Ev\right)\right), KbT\right), Ev\right), KbT\right)\right)\right) \]
    13. Simplified23.3%

      \[\leadsto \frac{NaChar}{\color{blue}{2 - \frac{\frac{-0.5 \cdot \left(Ev \cdot Ev\right)}{KbT} - Ev}{KbT}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -1.25 \cdot 10^{+118}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq 4.5 \cdot 10^{-180}:\\ \;\;\;\;\frac{NaChar}{2 + \frac{Ev - \frac{-0.5 \cdot \left(Ev \cdot Ev\right)}{KbT}}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 28.6% accurate, 9.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -3.8 \cdot 10^{-122}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq 4 \cdot 10^{+116}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{NdChar}{NaChar \cdot NaChar} + \frac{-1}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -3.8e-122)
     t_0
     (if (<= KbT 4e+116)
       (* 0.5 (/ -1.0 (+ (/ NdChar (* NaChar NaChar)) (/ -1.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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -3.8e-122) {
		tmp = t_0;
	} else if (KbT <= 4e+116) {
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)));
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-3.8d-122)) then
        tmp = t_0
    else if (kbt <= 4d+116) then
        tmp = 0.5d0 * ((-1.0d0) / ((ndchar / (nachar * nachar)) + ((-1.0d0) / nachar)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -3.8e-122) {
		tmp = t_0;
	} else if (KbT <= 4e+116) {
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -3.8e-122:
		tmp = t_0
	elif KbT <= 4e+116:
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)))
	else:
		tmp = 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 <= -3.8e-122)
		tmp = t_0;
	elseif (KbT <= 4e+116)
		tmp = Float64(0.5 * Float64(-1.0 / Float64(Float64(NdChar / Float64(NaChar * NaChar)) + Float64(-1.0 / NaChar))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -3.8e-122)
		tmp = t_0;
	elseif (KbT <= 4e+116)
		tmp = 0.5 * (-1.0 / ((NdChar / (NaChar * NaChar)) + (-1.0 / NaChar)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -3.8e-122], t$95$0, If[LessEqual[KbT, 4e+116], N[(0.5 * N[(-1.0 / N[(N[(NdChar / N[(NaChar * NaChar), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / NaChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -3.8 \cdot 10^{-122}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq 4 \cdot 10^{+116}:\\
\;\;\;\;0.5 \cdot \frac{-1}{\frac{NdChar}{NaChar \cdot NaChar} + \frac{-1}{NaChar}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if KbT < -3.8000000000000001e-122 or 4.00000000000000006e116 < KbT

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6439.0%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified39.0%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -3.8000000000000001e-122 < KbT < 4.00000000000000006e116

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6414.9%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified14.9%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f648.8%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr8.8%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around 0

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{NdChar}{{NaChar}^{2}} + \frac{1}{NaChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \color{blue}{-1 \cdot \frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \left(\mathsf{neg}\left(\frac{NdChar}{{NaChar}^{2}}\right)\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} - \color{blue}{\frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(\frac{1}{NaChar}\right), \color{blue}{\left(\frac{NdChar}{{NaChar}^{2}}\right)}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \left(\frac{\color{blue}{NdChar}}{{NaChar}^{2}}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \color{blue}{\left({NaChar}^{2}\right)}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \left(NaChar \cdot \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f6423.1%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \mathsf{*.f64}\left(NaChar, \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
    12. Simplified23.1%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{NaChar} - \frac{NdChar}{NaChar \cdot NaChar}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -3.8 \cdot 10^{-122}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq 4 \cdot 10^{+116}:\\ \;\;\;\;0.5 \cdot \frac{-1}{\frac{NdChar}{NaChar \cdot NaChar} + \frac{-1}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 28.3% accurate, 12.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{if}\;KbT \leq -2.6 \cdot 10^{-126}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq 4.8 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.5}{\frac{1 - \frac{NdChar}{NaChar}}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ NdChar NaChar))))
   (if (<= KbT -2.6e-126)
     t_0
     (if (<= KbT 4.8e-47) (/ 0.5 (/ (- 1.0 (/ NdChar NaChar)) 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 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -2.6e-126) {
		tmp = t_0;
	} else if (KbT <= 4.8e-47) {
		tmp = 0.5 / ((1.0 - (NdChar / NaChar)) / NaChar);
	} else {
		tmp = t_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) :: tmp
    t_0 = 0.5d0 * (ndchar + nachar)
    if (kbt <= (-2.6d-126)) then
        tmp = t_0
    else if (kbt <= 4.8d-47) then
        tmp = 0.5d0 / ((1.0d0 - (ndchar / nachar)) / nachar)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = 0.5 * (NdChar + NaChar);
	double tmp;
	if (KbT <= -2.6e-126) {
		tmp = t_0;
	} else if (KbT <= 4.8e-47) {
		tmp = 0.5 / ((1.0 - (NdChar / NaChar)) / NaChar);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = 0.5 * (NdChar + NaChar)
	tmp = 0
	if KbT <= -2.6e-126:
		tmp = t_0
	elif KbT <= 4.8e-47:
		tmp = 0.5 / ((1.0 - (NdChar / NaChar)) / NaChar)
	else:
		tmp = 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 <= -2.6e-126)
		tmp = t_0;
	elseif (KbT <= 4.8e-47)
		tmp = Float64(0.5 / Float64(Float64(1.0 - Float64(NdChar / NaChar)) / NaChar));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = 0.5 * (NdChar + NaChar);
	tmp = 0.0;
	if (KbT <= -2.6e-126)
		tmp = t_0;
	elseif (KbT <= 4.8e-47)
		tmp = 0.5 / ((1.0 - (NdChar / NaChar)) / NaChar);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -2.6e-126], t$95$0, If[LessEqual[KbT, 4.8e-47], N[(0.5 / N[(N[(1.0 - N[(NdChar / NaChar), $MachinePrecision]), $MachinePrecision] / NaChar), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(NdChar + NaChar\right)\\
\mathbf{if}\;KbT \leq -2.6 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;KbT \leq 4.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{0.5}{\frac{1 - \frac{NdChar}{NaChar}}{NaChar}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if KbT < -2.59999999999999999e-126 or 4.7999999999999999e-47 < KbT

    1. Initial program 99.4%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6436.5%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified36.5%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

    if -2.59999999999999999e-126 < KbT < 4.7999999999999999e-47

    1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6411.6%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified11.6%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      7. distribute-rgt-out--N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
      11. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
      14. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f646.5%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
    9. Applied egg-rr6.5%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
    10. Taylor expanded in NdChar around 0

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{NdChar}{{NaChar}^{2}} + \frac{1}{NaChar}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \color{blue}{-1 \cdot \frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \left(\mathsf{neg}\left(\frac{NdChar}{{NaChar}^{2}}\right)\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} - \color{blue}{\frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(\frac{1}{NaChar}\right), \color{blue}{\left(\frac{NdChar}{{NaChar}^{2}}\right)}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \left(\frac{\color{blue}{NdChar}}{{NaChar}^{2}}\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \color{blue}{\left({NaChar}^{2}\right)}\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \left(NaChar \cdot \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f6421.5%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \mathsf{*.f64}\left(NaChar, \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
    12. Simplified21.5%

      \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{NaChar} - \frac{NdChar}{NaChar \cdot NaChar}}} \]
    13. Step-by-step derivation
      1. un-div-invN/A

        \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\frac{1}{NaChar} - \frac{NdChar}{NaChar \cdot NaChar}}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{1}{NaChar} - \frac{NdChar}{NaChar \cdot NaChar}\right)}\right) \]
      3. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \left(\frac{1}{NaChar} - \frac{\frac{NdChar}{NaChar}}{\color{blue}{NaChar}}\right)\right) \]
      4. sub-divN/A

        \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \left(\frac{1 - \frac{NdChar}{NaChar}}{\color{blue}{NaChar}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\left(1 - \frac{NdChar}{NaChar}\right), \color{blue}{NaChar}\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \left(\frac{NdChar}{NaChar}\right)\right), NaChar\right)\right) \]
      7. /-lowering-/.f6420.5%

        \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(NdChar, NaChar\right)\right), NaChar\right)\right) \]
    14. Applied egg-rr20.5%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{1 - \frac{NdChar}{NaChar}}{NaChar}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -2.6 \cdot 10^{-126}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{elif}\;KbT \leq 4.8 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.5}{\frac{1 - \frac{NdChar}{NaChar}}{NaChar}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 22.5% accurate, 17.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NaChar \leq -5.4 \cdot 10^{+26}:\\ \;\;\;\;\frac{NaChar}{2}\\ \mathbf{elif}\;NaChar \leq 1.6 \cdot 10^{+29}:\\ \;\;\;\;NdChar \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{2}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (if (<= NaChar -5.4e+26)
   (/ NaChar 2.0)
   (if (<= NaChar 1.6e+29) (* NdChar 0.5) (/ NaChar 2.0))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double tmp;
	if (NaChar <= -5.4e+26) {
		tmp = NaChar / 2.0;
	} else if (NaChar <= 1.6e+29) {
		tmp = NdChar * 0.5;
	} else {
		tmp = NaChar / 2.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 (nachar <= (-5.4d+26)) then
        tmp = nachar / 2.0d0
    else if (nachar <= 1.6d+29) then
        tmp = ndchar * 0.5d0
    else
        tmp = nachar / 2.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 (NaChar <= -5.4e+26) {
		tmp = NaChar / 2.0;
	} else if (NaChar <= 1.6e+29) {
		tmp = NdChar * 0.5;
	} else {
		tmp = NaChar / 2.0;
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	tmp = 0
	if NaChar <= -5.4e+26:
		tmp = NaChar / 2.0
	elif NaChar <= 1.6e+29:
		tmp = NdChar * 0.5
	else:
		tmp = NaChar / 2.0
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = 0.0
	if (NaChar <= -5.4e+26)
		tmp = Float64(NaChar / 2.0);
	elseif (NaChar <= 1.6e+29)
		tmp = Float64(NdChar * 0.5);
	else
		tmp = Float64(NaChar / 2.0);
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = 0.0;
	if (NaChar <= -5.4e+26)
		tmp = NaChar / 2.0;
	elseif (NaChar <= 1.6e+29)
		tmp = NdChar * 0.5;
	else
		tmp = NaChar / 2.0;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NaChar, -5.4e+26], N[(NaChar / 2.0), $MachinePrecision], If[LessEqual[NaChar, 1.6e+29], N[(NdChar * 0.5), $MachinePrecision], N[(NaChar / 2.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;NaChar \leq -5.4 \cdot 10^{+26}:\\
\;\;\;\;\frac{NaChar}{2}\\

\mathbf{elif}\;NaChar \leq 1.6 \cdot 10^{+29}:\\
\;\;\;\;NdChar \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{NaChar}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if NaChar < -5.4e26 or 1.59999999999999993e29 < NaChar

    1. Initial program 99.2%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in NdChar around 0

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{\left(1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}\right)}\right)\right) \]
      3. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\left(\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}\right)\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right), KbT\right)\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) - mu\right)\right), KbT\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(\left(Ev + Vef\right) + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      7. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(EAccept + \left(Ev + \left(Vef + -1 \cdot mu\right)\right)\right), KbT\right)\right)\right)\right) \]
      9. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\left(\left(EAccept + Ev\right) + \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(EAccept + Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + -1 \cdot mu\right)\right), KbT\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef + \left(\mathsf{neg}\left(mu\right)\right)\right)\right), KbT\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \left(Vef - mu\right)\right), KbT\right)\right)\right)\right) \]
      14. --lowering--.f6475.9%

        \[\leadsto \mathsf{/.f64}\left(NaChar, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(EAccept, Ev\right), \mathsf{\_.f64}\left(Vef, mu\right)\right), KbT\right)\right)\right)\right) \]
    7. Simplified75.9%

      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + Ev\right) + \left(Vef - mu\right)}{KbT}}}} \]
    8. Taylor expanded in KbT around inf

      \[\leadsto \mathsf{/.f64}\left(NaChar, \color{blue}{2}\right) \]
    9. Step-by-step derivation
      1. Simplified24.3%

        \[\leadsto \frac{NaChar}{\color{blue}{2}} \]

      if -5.4e26 < NaChar < 1.59999999999999993e29

      1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
      4. Add Preprocessing
      5. Taylor expanded in KbT around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
      6. Step-by-step derivation
        1. distribute-lft-outN/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
        3. +-lowering-+.f6430.3%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
      7. Simplified30.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
      8. Taylor expanded in NaChar around 0

        \[\leadsto \color{blue}{\frac{1}{2} \cdot NdChar} \]
      9. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto NdChar \cdot \color{blue}{\frac{1}{2}} \]
        2. *-lowering-*.f6429.2%

          \[\leadsto \mathsf{*.f64}\left(NdChar, \color{blue}{\frac{1}{2}}\right) \]
      10. Simplified29.2%

        \[\leadsto \color{blue}{NdChar \cdot 0.5} \]
    10. Recombined 2 regimes into one program.
    11. Add Preprocessing

    Alternative 21: 27.3% accurate, 19.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;Vef \leq 8.5 \cdot 10^{+239}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar \cdot \left(NaChar \cdot -0.5\right)}{NdChar}\\ \end{array} \end{array} \]
    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
     :precision binary64
     (if (<= Vef 8.5e+239)
       (* 0.5 (+ NdChar NaChar))
       (/ (* NaChar (* 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 (Vef <= 8.5e+239) {
    		tmp = 0.5 * (NdChar + NaChar);
    	} else {
    		tmp = (NaChar * (NaChar * -0.5)) / NdChar;
    	}
    	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 (vef <= 8.5d+239) then
            tmp = 0.5d0 * (ndchar + nachar)
        else
            tmp = (nachar * (nachar * (-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 (Vef <= 8.5e+239) {
    		tmp = 0.5 * (NdChar + NaChar);
    	} else {
    		tmp = (NaChar * (NaChar * -0.5)) / NdChar;
    	}
    	return tmp;
    }
    
    def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
    	tmp = 0
    	if Vef <= 8.5e+239:
    		tmp = 0.5 * (NdChar + NaChar)
    	else:
    		tmp = (NaChar * (NaChar * -0.5)) / NdChar
    	return tmp
    
    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	tmp = 0.0
    	if (Vef <= 8.5e+239)
    		tmp = Float64(0.5 * Float64(NdChar + NaChar));
    	else
    		tmp = Float64(Float64(NaChar * Float64(NaChar * -0.5)) / NdChar);
    	end
    	return tmp
    end
    
    function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	tmp = 0.0;
    	if (Vef <= 8.5e+239)
    		tmp = 0.5 * (NdChar + NaChar);
    	else
    		tmp = (NaChar * (NaChar * -0.5)) / NdChar;
    	end
    	tmp_2 = tmp;
    end
    
    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[Vef, 8.5e+239], N[(0.5 * N[(NdChar + NaChar), $MachinePrecision]), $MachinePrecision], N[(N[(NaChar * N[(NaChar * -0.5), $MachinePrecision]), $MachinePrecision] / NdChar), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;Vef \leq 8.5 \cdot 10^{+239}:\\
    \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{NaChar \cdot \left(NaChar \cdot -0.5\right)}{NdChar}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if Vef < 8.50000000000000021e239

      1. Initial program 99.6%

        \[\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}}} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
      3. Simplified99.6%

        \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
      4. Add Preprocessing
      5. Taylor expanded in KbT around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
      6. Step-by-step derivation
        1. distribute-lft-outN/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
        3. +-lowering-+.f6428.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
      7. Simplified28.4%

        \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]

      if 8.50000000000000021e239 < Vef

      1. Initial program 100.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) + \left(-mu\right)}{KbT}}} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
      4. Add Preprocessing
      5. Taylor expanded in KbT around inf

        \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
      6. Step-by-step derivation
        1. distribute-lft-outN/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
        3. +-lowering-+.f647.0%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
      7. Simplified7.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
      8. Step-by-step derivation
        1. flip3-+N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{{NaChar}^{3} + {NdChar}^{3}}{\color{blue}{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}}\right)\right) \]
        2. clear-numN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{1}{\color{blue}{\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}}}\right)\right) \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)}{{NaChar}^{3} + {NdChar}^{3}}\right)}\right)\right) \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(NaChar \cdot NaChar + \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \color{blue}{\left({NaChar}^{3} + {NdChar}^{3}\right)}\right)\right)\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(NaChar \cdot NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left(\color{blue}{{NaChar}^{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot NdChar - NaChar \cdot NdChar\right)\right), \left({\color{blue}{NaChar}}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
        7. distribute-rgt-out--N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \left(NdChar \cdot \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \left(NdChar - NaChar\right)\right)\right), \left({NaChar}^{\color{blue}{3}} + {NdChar}^{3}\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \left({NaChar}^{3} + {NdChar}^{3}\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left({NaChar}^{3}\right), \color{blue}{\left({NdChar}^{3}\right)}\right)\right)\right)\right) \]
        11. cube-multN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\left(NaChar \cdot \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
        12. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot NaChar\right)\right), \left({\color{blue}{NdChar}}^{3}\right)\right)\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left({NdChar}^{3}\right)\right)\right)\right)\right) \]
        14. cube-multN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \left(NdChar \cdot \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \color{blue}{\left(NdChar \cdot NdChar\right)}\right)\right)\right)\right)\right) \]
        16. *-lowering-*.f6410.9%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, NaChar\right), \mathsf{*.f64}\left(NdChar, \mathsf{\_.f64}\left(NdChar, NaChar\right)\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, NaChar\right)\right), \mathsf{*.f64}\left(NdChar, \mathsf{*.f64}\left(NdChar, \color{blue}{NdChar}\right)\right)\right)\right)\right)\right) \]
      9. Applied egg-rr10.9%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\frac{NaChar \cdot NaChar + NdChar \cdot \left(NdChar - NaChar\right)}{NaChar \cdot \left(NaChar \cdot NaChar\right) + NdChar \cdot \left(NdChar \cdot NdChar\right)}}} \]
      10. Taylor expanded in NdChar around 0

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{NdChar}{{NaChar}^{2}} + \frac{1}{NaChar}\right)}\right)\right) \]
      11. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \color{blue}{-1 \cdot \frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
        2. mul-1-negN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} + \left(\mathsf{neg}\left(\frac{NdChar}{{NaChar}^{2}}\right)\right)\right)\right)\right) \]
        3. unsub-negN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \left(\frac{1}{NaChar} - \color{blue}{\frac{NdChar}{{NaChar}^{2}}}\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(\frac{1}{NaChar}\right), \color{blue}{\left(\frac{NdChar}{{NaChar}^{2}}\right)}\right)\right)\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \left(\frac{\color{blue}{NdChar}}{{NaChar}^{2}}\right)\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \color{blue}{\left({NaChar}^{2}\right)}\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \left(NaChar \cdot \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f6436.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, NaChar\right), \mathsf{/.f64}\left(NdChar, \mathsf{*.f64}\left(NaChar, \color{blue}{NaChar}\right)\right)\right)\right)\right) \]
      12. Simplified36.4%

        \[\leadsto 0.5 \cdot \frac{1}{\color{blue}{\frac{1}{NaChar} - \frac{NdChar}{NaChar \cdot NaChar}}} \]
      13. Taylor expanded in NaChar around 0

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{NaChar}^{2}}{NdChar}} \]
      14. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{\frac{-1}{2} \cdot {NaChar}^{2}}{\color{blue}{NdChar}} \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot {NaChar}^{2}\right), \color{blue}{NdChar}\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\left({NaChar}^{2} \cdot \frac{-1}{2}\right), NdChar\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\left(\left(NaChar \cdot NaChar\right) \cdot \frac{-1}{2}\right), NdChar\right) \]
        5. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\left(NaChar \cdot \left(NaChar \cdot \frac{-1}{2}\right)\right), NdChar\right) \]
        6. metadata-evalN/A

          \[\leadsto \mathsf{/.f64}\left(\left(NaChar \cdot \left(NaChar \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right), NdChar\right) \]
        7. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{/.f64}\left(\left(NaChar \cdot \left(\mathsf{neg}\left(NaChar \cdot \frac{1}{2}\right)\right)\right), NdChar\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\left(NaChar \cdot \left(\mathsf{neg}\left(\frac{1}{2} \cdot NaChar\right)\right)\right), NdChar\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(NaChar, \left(\mathsf{neg}\left(\frac{1}{2} \cdot NaChar\right)\right)\right), NdChar\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(NaChar, \left(\mathsf{neg}\left(NaChar \cdot \frac{1}{2}\right)\right)\right), NdChar\right) \]
        11. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right), NdChar\right) \]
        12. metadata-evalN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(NaChar, \left(NaChar \cdot \frac{-1}{2}\right)\right), NdChar\right) \]
        13. *-lowering-*.f6435.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(NaChar, \mathsf{*.f64}\left(NaChar, \frac{-1}{2}\right)\right), NdChar\right) \]
      15. Simplified35.0%

        \[\leadsto \color{blue}{\frac{NaChar \cdot \left(NaChar \cdot -0.5\right)}{NdChar}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification28.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq 8.5 \cdot 10^{+239}:\\ \;\;\;\;0.5 \cdot \left(NdChar + NaChar\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar \cdot \left(NaChar \cdot -0.5\right)}{NdChar}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 22: 27.2% accurate, 45.8× speedup?

    \[\begin{array}{l} \\ 0.5 \cdot \left(NdChar + NaChar\right) \end{array} \]
    (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}
    
    Derivation
    1. Initial program 99.6%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6427.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified27.2%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Final simplification27.2%

      \[\leadsto 0.5 \cdot \left(NdChar + NaChar\right) \]
    9. Add Preprocessing

    Alternative 23: 18.1% accurate, 76.3× speedup?

    \[\begin{array}{l} \\ NdChar \cdot 0.5 \end{array} \]
    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
     :precision binary64
     (* NdChar 0.5))
    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	return NdChar * 0.5;
    }
    
    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 * 0.5d0
    end function
    
    public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	return NdChar * 0.5;
    }
    
    def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
    	return NdChar * 0.5
    
    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	return Float64(NdChar * 0.5)
    end
    
    function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	tmp = NdChar * 0.5;
    end
    
    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(NdChar * 0.5), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    NdChar \cdot 0.5
    \end{array}
    
    Derivation
    1. Initial program 99.6%

      \[\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}}} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}\right), \color{blue}{\left(\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}\right)}\right) \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{EDonor + \left(mu - \left(Ec - Vef\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef + \left(EAccept + \left(Ev - mu\right)\right)}{KbT}}}} \]
    4. Add Preprocessing
    5. Taylor expanded in KbT around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
    6. Step-by-step derivation
      1. distribute-lft-outN/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(NaChar + NdChar\right)}\right) \]
      3. +-lowering-+.f6427.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(NaChar, \color{blue}{NdChar}\right)\right) \]
    7. Simplified27.2%

      \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
    8. Taylor expanded in NaChar around 0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot NdChar} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto NdChar \cdot \color{blue}{\frac{1}{2}} \]
      2. *-lowering-*.f6419.8%

        \[\leadsto \mathsf{*.f64}\left(NdChar, \color{blue}{\frac{1}{2}}\right) \]
    10. Simplified19.8%

      \[\leadsto \color{blue}{NdChar \cdot 0.5} \]
    11. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2024288 
    (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))))))