Bulmash initializePoisson

Percentage Accurate: 100.0% → 100.0%
Time: 12.4s
Alternatives: 15
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 15 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{NaChar}{1 + {e}^{\left(\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\right)}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (-
  (/ NaChar (+ 1.0 (pow E (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
  (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NaChar / (1.0 + pow(((double) M_E), ((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
}
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NaChar / (1.0 + Math.pow(Math.E, ((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - Math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	return (NaChar / (1.0 + math.pow(math.e, ((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	return Float64(Float64(NaChar / Float64(1.0 + (exp(1) ^ Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = (NaChar / (1.0 + (2.71828182845904523536 ^ ((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NaChar / N[(1.0 + N[Power[E, N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{NaChar}{1 + {e}^{\left(\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}\right)}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + \color{blue}{e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}} \]
    2. lift-/.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}} \]
    3. clear-numN/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{\frac{1}{\frac{KbT}{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}}}}} \]
    4. div-invN/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\color{blue}{1 \cdot \frac{1}{\frac{KbT}{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}}}}} \]
    5. clear-numN/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{1 \cdot \color{blue}{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}} \]
    6. lift-/.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{1 \cdot \color{blue}{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}} \]
    7. exp-prodN/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + \color{blue}{{\left(e^{1}\right)}^{\left(\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}\right)}}} \]
    8. lower-pow.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + \color{blue}{{\left(e^{1}\right)}^{\left(\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}\right)}}} \]
    9. lower-exp.f64100.0

      \[\leadsto \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + {\color{blue}{\left(e^{1}\right)}}^{\left(\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}\right)}} \]
    10. lift-+.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\color{blue}{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}}{KbT}\right)}} \]
    11. lift-neg.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \color{blue}{\left(\mathsf{neg}\left(mu\right)\right)}}{KbT}\right)}} \]
    12. unsub-negN/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\color{blue}{\left(\left(Ev + Vef\right) + EAccept\right) - mu}}{KbT}\right)}} \]
    13. lower--.f64100.0

      \[\leadsto \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\color{blue}{\left(\left(Ev + Vef\right) + EAccept\right) - mu}}{KbT}\right)}} \]
    14. lift-+.f64N/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\color{blue}{\left(\left(Ev + Vef\right) + EAccept\right)} - mu}{KbT}\right)}} \]
    15. +-commutativeN/A

      \[\leadsto \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\color{blue}{\left(EAccept + \left(Ev + Vef\right)\right)} - mu}{KbT}\right)}} \]
    16. lower-+.f64100.0

      \[\leadsto \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + {\left(e^{1}\right)}^{\left(\frac{\color{blue}{\left(EAccept + \left(Ev + Vef\right)\right)} - mu}{KbT}\right)}} \]
  4. Applied rewrites100.0%

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

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

Alternative 2: 46.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\ t_1 := Ec - \left(\left(mu + Vef\right) + EDonor\right)\\ t_2 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-304}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} - -1}\\ \mathbf{elif}\;t\_2 \leq 10^{-244}:\\ \;\;\;\;\frac{NdChar}{2 - \frac{\mathsf{fma}\left(\frac{t\_1 \cdot t\_1}{KbT}, -0.5, t\_1\right)}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (* (+ NaChar NdChar) 0.5))
        (t_1 (- Ec (+ (+ mu Vef) EDonor)))
        (t_2
         (-
          (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
          (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
   (if (<= t_2 -1e+19)
     t_0
     (if (<= t_2 -2e-304)
       (/ NdChar (- (exp (/ EDonor KbT)) -1.0))
       (if (<= t_2 1e-244)
         (/ NdChar (- 2.0 (/ (fma (/ (* t_1 t_1) KbT) -0.5 t_1) KbT)))
         t_0)))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = (NaChar + NdChar) * 0.5;
	double t_1 = Ec - ((mu + Vef) + EDonor);
	double t_2 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
	double tmp;
	if (t_2 <= -1e+19) {
		tmp = t_0;
	} else if (t_2 <= -2e-304) {
		tmp = NdChar / (exp((EDonor / KbT)) - -1.0);
	} else if (t_2 <= 1e-244) {
		tmp = NdChar / (2.0 - (fma(((t_1 * t_1) / KbT), -0.5, t_1) / KbT));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(Float64(NaChar + NdChar) * 0.5)
	t_1 = Float64(Ec - Float64(Float64(mu + Vef) + EDonor))
	t_2 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
	tmp = 0.0
	if (t_2 <= -1e+19)
		tmp = t_0;
	elseif (t_2 <= -2e-304)
		tmp = Float64(NdChar / Float64(exp(Float64(EDonor / KbT)) - -1.0));
	elseif (t_2 <= 1e-244)
		tmp = Float64(NdChar / Float64(2.0 - Float64(fma(Float64(Float64(t_1 * t_1) / KbT), -0.5, t_1) / KbT)));
	else
		tmp = t_0;
	end
	return tmp
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(Ec - N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+19], t$95$0, If[LessEqual[t$95$2, -2e-304], N[(NdChar / N[(N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-244], N[(NdChar / N[(2.0 - N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] / KbT), $MachinePrecision] * -0.5 + t$95$1), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-304}:\\
\;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} - -1}\\

\mathbf{elif}\;t\_2 \leq 10^{-244}:\\
\;\;\;\;\frac{NdChar}{2 - \frac{\mathsf{fma}\left(\frac{t\_1 \cdot t\_1}{KbT}, -0.5, t\_1\right)}{KbT}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1e19 or 9.9999999999999993e-245 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

    1. 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. Add Preprocessing
    3. Taylor expanded in KbT around inf

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

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
      3. lower-+.f6440.2

        \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
    5. Applied rewrites40.2%

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

    if -1e19 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.99999999999999994e-304

    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. Add Preprocessing
    3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{NdChar}{e^{\frac{EDonor}{KbT}} + 1} \]
    7. Step-by-step derivation
      1. Applied rewrites41.1%

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

      if -1.99999999999999994e-304 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 9.9999999999999993e-245

      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. Add Preprocessing
      3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{NdChar}{2 + \color{blue}{-1 \cdot \frac{-1 \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}^{2}}{KbT}}{KbT}}} \]
      7. Step-by-step derivation
        1. Applied rewrites85.4%

          \[\leadsto \frac{NdChar}{2 - \color{blue}{\frac{\mathsf{fma}\left(\frac{\left(\left(\left(mu + Vef\right) + EDonor\right) - Ec\right) \cdot \left(\left(\left(mu + Vef\right) + EDonor\right) - Ec\right)}{KbT}, -0.5, -\left(\left(\left(mu + Vef\right) + EDonor\right) - Ec\right)\right)}{KbT}}} \]
      8. Recombined 3 regimes into one program.
      9. Final simplification50.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq -1 \cdot 10^{+19}:\\ \;\;\;\;\left(NaChar + NdChar\right) \cdot 0.5\\ \mathbf{elif}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq -2 \cdot 10^{-304}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{EDonor}{KbT}} - -1}\\ \mathbf{elif}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq 10^{-244}:\\ \;\;\;\;\frac{NdChar}{2 - \frac{\mathsf{fma}\left(\frac{\left(Ec - \left(\left(mu + Vef\right) + EDonor\right)\right) \cdot \left(Ec - \left(\left(mu + Vef\right) + EDonor\right)\right)}{KbT}, -0.5, Ec - \left(\left(mu + Vef\right) + EDonor\right)\right)}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;\left(NaChar + NdChar\right) \cdot 0.5\\ \end{array} \]
      10. Add Preprocessing

      Alternative 3: 75.8% accurate, 0.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ t_1 := \frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + t\_0\\ t_2 := t\_0 - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-52}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{-244}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}} - -1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
       :precision binary64
       (let* ((t_0 (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))
              (t_1 (+ (/ NdChar (- (exp (/ Vef KbT)) -1.0)) t_0))
              (t_2
               (-
                t_0
                (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
         (if (<= t_2 -4e-52)
           t_1
           (if (<= t_2 1e-244)
             (/ NdChar (- (exp (/ (- (+ (+ mu Vef) EDonor) Ec) KbT)) -1.0))
             t_1))))
      double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
      	double t_0 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
      	double t_1 = (NdChar / (exp((Vef / KbT)) - -1.0)) + t_0;
      	double t_2 = t_0 - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
      	double tmp;
      	if (t_2 <= -4e-52) {
      		tmp = t_1;
      	} else if (t_2 <= 1e-244) {
      		tmp = NdChar / (exp(((((mu + Vef) + EDonor) - Ec) / KbT)) - -1.0);
      	} 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) :: t_2
          real(8) :: tmp
          t_0 = nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))
          t_1 = (ndchar / (exp((vef / kbt)) - (-1.0d0))) + t_0
          t_2 = t_0 - (ndchar / ((-1.0d0) - exp(((mu - ((ec - vef) - edonor)) / kbt))))
          if (t_2 <= (-4d-52)) then
              tmp = t_1
          else if (t_2 <= 1d-244) then
              tmp = ndchar / (exp(((((mu + vef) + edonor) - ec) / kbt)) - (-1.0d0))
          else
              tmp = t_1
          end if
          code = tmp
      end function
      
      public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
      	double t_0 = NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
      	double t_1 = (NdChar / (Math.exp((Vef / KbT)) - -1.0)) + t_0;
      	double t_2 = t_0 - (NdChar / (-1.0 - Math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
      	double tmp;
      	if (t_2 <= -4e-52) {
      		tmp = t_1;
      	} else if (t_2 <= 1e-244) {
      		tmp = NdChar / (Math.exp(((((mu + Vef) + EDonor) - Ec) / KbT)) - -1.0);
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
      	t_0 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))
      	t_1 = (NdChar / (math.exp((Vef / KbT)) - -1.0)) + t_0
      	t_2 = t_0 - (NdChar / (-1.0 - math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))))
      	tmp = 0
      	if t_2 <= -4e-52:
      		tmp = t_1
      	elif t_2 <= 1e-244:
      		tmp = NdChar / (math.exp(((((mu + Vef) + EDonor) - Ec) / KbT)) - -1.0)
      	else:
      		tmp = t_1
      	return tmp
      
      function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
      	t_0 = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))
      	t_1 = Float64(Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0)) + t_0)
      	t_2 = Float64(t_0 - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
      	tmp = 0.0
      	if (t_2 <= -4e-52)
      		tmp = t_1;
      	elseif (t_2 <= 1e-244)
      		tmp = Float64(NdChar / Float64(exp(Float64(Float64(Float64(Float64(mu + Vef) + EDonor) - Ec) / KbT)) - -1.0));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
      	t_0 = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
      	t_1 = (NdChar / (exp((Vef / KbT)) - -1.0)) + t_0;
      	t_2 = t_0 - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
      	tmp = 0.0;
      	if (t_2 <= -4e-52)
      		tmp = t_1;
      	elseif (t_2 <= 1e-244)
      		tmp = NdChar / (exp(((((mu + Vef) + EDonor) - Ec) / KbT)) - -1.0);
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-52], t$95$1, If[LessEqual[t$95$2, 1e-244], N[(NdChar / N[(N[Exp[N[(N[(N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
      t_1 := \frac{NdChar}{e^{\frac{Vef}{KbT}} - -1} + t\_0\\
      t_2 := t\_0 - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\
      \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-52}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;t\_2 \leq 10^{-244}:\\
      \;\;\;\;\frac{NdChar}{e^{\frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}} - -1}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4e-52 or 9.9999999999999993e-245 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

        1. 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. Add Preprocessing
        3. Taylor expanded in Vef around inf

          \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}} \]
        4. Step-by-step derivation
          1. lower-/.f6483.0

            \[\leadsto \frac{NdChar}{1 + e^{\color{blue}{\frac{Vef}{KbT}}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}} \]
        5. Applied rewrites83.0%

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

        if -4e-52 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 9.9999999999999993e-245

        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. Add Preprocessing
        3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 44.6% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := Ec - \left(\left(mu + Vef\right) + EDonor\right)\\ t_1 := \left(NaChar + NdChar\right) \cdot 0.5\\ t_2 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{-226}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{-244}:\\ \;\;\;\;\frac{NdChar}{2 - \frac{\mathsf{fma}\left(\frac{t\_0 \cdot t\_0}{KbT}, -0.5, t\_0\right)}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
       :precision binary64
       (let* ((t_0 (- Ec (+ (+ mu Vef) EDonor)))
              (t_1 (* (+ NaChar NdChar) 0.5))
              (t_2
               (-
                (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
         (if (<= t_2 -1e-226)
           t_1
           (if (<= t_2 1e-244)
             (/ NdChar (- 2.0 (/ (fma (/ (* t_0 t_0) KbT) -0.5 t_0) 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 = Ec - ((mu + Vef) + EDonor);
      	double t_1 = (NaChar + NdChar) * 0.5;
      	double t_2 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
      	double tmp;
      	if (t_2 <= -1e-226) {
      		tmp = t_1;
      	} else if (t_2 <= 1e-244) {
      		tmp = NdChar / (2.0 - (fma(((t_0 * t_0) / KbT), -0.5, t_0) / KbT));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
      	t_0 = Float64(Ec - Float64(Float64(mu + Vef) + EDonor))
      	t_1 = Float64(Float64(NaChar + NdChar) * 0.5)
      	t_2 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
      	tmp = 0.0
      	if (t_2 <= -1e-226)
      		tmp = t_1;
      	elseif (t_2 <= 1e-244)
      		tmp = Float64(NdChar / Float64(2.0 - Float64(fma(Float64(Float64(t_0 * t_0) / KbT), -0.5, t_0) / KbT)));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(Ec - N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$2 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-226], t$95$1, If[LessEqual[t$95$2, 1e-244], N[(NdChar / N[(2.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / KbT), $MachinePrecision] * -0.5 + t$95$0), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := Ec - \left(\left(mu + Vef\right) + EDonor\right)\\
      t_1 := \left(NaChar + NdChar\right) \cdot 0.5\\
      t_2 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\
      \mathbf{if}\;t\_2 \leq -1 \cdot 10^{-226}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;t\_2 \leq 10^{-244}:\\
      \;\;\;\;\frac{NdChar}{2 - \frac{\mathsf{fma}\left(\frac{t\_0 \cdot t\_0}{KbT}, -0.5, t\_0\right)}{KbT}}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999921e-227 or 9.9999999999999993e-245 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

        1. 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. Add Preprocessing
        3. Taylor expanded in KbT around inf

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

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

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
          3. lower-+.f6437.0

            \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
        5. Applied rewrites37.0%

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

        if -9.99999999999999921e-227 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 9.9999999999999993e-245

        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. Add Preprocessing
        3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{NdChar}{2 + \color{blue}{-1 \cdot \frac{-1 \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right) + \frac{-1}{2} \cdot \frac{{\left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}^{2}}{KbT}}{KbT}}} \]
        7. Step-by-step derivation
          1. Applied rewrites76.0%

            \[\leadsto \frac{NdChar}{2 - \color{blue}{\frac{\mathsf{fma}\left(\frac{\left(\left(\left(mu + Vef\right) + EDonor\right) - Ec\right) \cdot \left(\left(\left(mu + Vef\right) + EDonor\right) - Ec\right)}{KbT}, -0.5, -\left(\left(\left(mu + Vef\right) + EDonor\right) - Ec\right)\right)}{KbT}}} \]
        8. Recombined 2 regimes into one program.
        9. Final simplification46.9%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq -1 \cdot 10^{-226}:\\ \;\;\;\;\left(NaChar + NdChar\right) \cdot 0.5\\ \mathbf{elif}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq 10^{-244}:\\ \;\;\;\;\frac{NdChar}{2 - \frac{\mathsf{fma}\left(\frac{\left(Ec - \left(\left(mu + Vef\right) + EDonor\right)\right) \cdot \left(Ec - \left(\left(mu + Vef\right) + EDonor\right)\right)}{KbT}, -0.5, Ec - \left(\left(mu + Vef\right) + EDonor\right)\right)}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;\left(NaChar + NdChar\right) \cdot 0.5\\ \end{array} \]
        10. Add Preprocessing

        Alternative 5: 36.0% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\ t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-240}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-249}:\\ \;\;\;\;\frac{NdChar}{\left(\left(\frac{mu}{KbT} + \frac{Vef}{KbT}\right) + \left(2 + \frac{EDonor}{KbT}\right)\right) - \frac{Ec}{KbT}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
         :precision binary64
         (let* ((t_0 (* (+ NaChar NdChar) 0.5))
                (t_1
                 (-
                  (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                  (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
           (if (<= t_1 -5e-240)
             t_0
             (if (<= t_1 4e-249)
               (/
                NdChar
                (- (+ (+ (/ mu KbT) (/ Vef KbT)) (+ 2.0 (/ EDonor KbT))) (/ Ec KbT)))
               t_0))))
        double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
        	double t_0 = (NaChar + NdChar) * 0.5;
        	double t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
        	double tmp;
        	if (t_1 <= -5e-240) {
        		tmp = t_0;
        	} else if (t_1 <= 4e-249) {
        		tmp = NdChar / ((((mu / KbT) + (Vef / KbT)) + (2.0 + (EDonor / KbT))) - (Ec / 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) :: t_1
            real(8) :: tmp
            t_0 = (nachar + ndchar) * 0.5d0
            t_1 = (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))) - (ndchar / ((-1.0d0) - exp(((mu - ((ec - vef) - edonor)) / kbt))))
            if (t_1 <= (-5d-240)) then
                tmp = t_0
            else if (t_1 <= 4d-249) then
                tmp = ndchar / ((((mu / kbt) + (vef / kbt)) + (2.0d0 + (edonor / kbt))) - (ec / kbt))
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
        	double t_0 = (NaChar + NdChar) * 0.5;
        	double t_1 = (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - Math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
        	double tmp;
        	if (t_1 <= -5e-240) {
        		tmp = t_0;
        	} else if (t_1 <= 4e-249) {
        		tmp = NdChar / ((((mu / KbT) + (Vef / KbT)) + (2.0 + (EDonor / KbT))) - (Ec / KbT));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
        	t_0 = (NaChar + NdChar) * 0.5
        	t_1 = (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))))
        	tmp = 0
        	if t_1 <= -5e-240:
        		tmp = t_0
        	elif t_1 <= 4e-249:
        		tmp = NdChar / ((((mu / KbT) + (Vef / KbT)) + (2.0 + (EDonor / KbT))) - (Ec / KbT))
        	else:
        		tmp = t_0
        	return tmp
        
        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
        	t_0 = Float64(Float64(NaChar + NdChar) * 0.5)
        	t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
        	tmp = 0.0
        	if (t_1 <= -5e-240)
        		tmp = t_0;
        	elseif (t_1 <= 4e-249)
        		tmp = Float64(NdChar / Float64(Float64(Float64(Float64(mu / KbT) + Float64(Vef / KbT)) + Float64(2.0 + Float64(EDonor / KbT))) - Float64(Ec / KbT)));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
        	t_0 = (NaChar + NdChar) * 0.5;
        	t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
        	tmp = 0.0;
        	if (t_1 <= -5e-240)
        		tmp = t_0;
        	elseif (t_1 <= 4e-249)
        		tmp = NdChar / ((((mu / KbT) + (Vef / KbT)) + (2.0 + (EDonor / KbT))) - (Ec / 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[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-240], t$95$0, If[LessEqual[t$95$1, 4e-249], N[(NdChar / N[(N[(N[(N[(mu / KbT), $MachinePrecision] + N[(Vef / KbT), $MachinePrecision]), $MachinePrecision] + N[(2.0 + N[(EDonor / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
        t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\
        \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-240}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-249}:\\
        \;\;\;\;\frac{NdChar}{\left(\left(\frac{mu}{KbT} + \frac{Vef}{KbT}\right) + \left(2 + \frac{EDonor}{KbT}\right)\right) - \frac{Ec}{KbT}}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -5.0000000000000004e-240 or 4.00000000000000022e-249 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

          1. 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. Add Preprocessing
          3. Taylor expanded in KbT around inf

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

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
            3. lower-+.f6436.6

              \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
          5. Applied rewrites36.6%

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

          if -5.0000000000000004e-240 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 4.00000000000000022e-249

          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. Add Preprocessing
          3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{NdChar}{\left(2 + \left(\frac{EDonor}{KbT} + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right)\right) - \color{blue}{\frac{Ec}{KbT}}} \]
          7. Step-by-step derivation
            1. Applied rewrites44.6%

              \[\leadsto \frac{NdChar}{\left(\left(2 + \frac{EDonor}{KbT}\right) + \left(\frac{mu}{KbT} + \frac{Vef}{KbT}\right)\right) - \color{blue}{\frac{Ec}{KbT}}} \]
          8. Recombined 2 regimes into one program.
          9. Final simplification38.6%

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

          Alternative 6: 32.7% accurate, 0.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\ t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-226}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{-244}:\\ \;\;\;\;\frac{\left(NdChar \cdot NdChar\right) \cdot -0.5}{NaChar - 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 NdChar) 0.5))
                  (t_1
                   (-
                    (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                    (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
             (if (<= t_1 -1e-226)
               t_0
               (if (<= t_1 1e-244)
                 (/ (* (* NdChar NdChar) -0.5) (- NaChar 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 + NdChar) * 0.5;
          	double t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
          	double tmp;
          	if (t_1 <= -1e-226) {
          		tmp = t_0;
          	} else if (t_1 <= 1e-244) {
          		tmp = ((NdChar * NdChar) * -0.5) / (NaChar - 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) :: t_1
              real(8) :: tmp
              t_0 = (nachar + ndchar) * 0.5d0
              t_1 = (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))) - (ndchar / ((-1.0d0) - exp(((mu - ((ec - vef) - edonor)) / kbt))))
              if (t_1 <= (-1d-226)) then
                  tmp = t_0
              else if (t_1 <= 1d-244) then
                  tmp = ((ndchar * ndchar) * (-0.5d0)) / (nachar - 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 + NdChar) * 0.5;
          	double t_1 = (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - Math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
          	double tmp;
          	if (t_1 <= -1e-226) {
          		tmp = t_0;
          	} else if (t_1 <= 1e-244) {
          		tmp = ((NdChar * NdChar) * -0.5) / (NaChar - NdChar);
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
          	t_0 = (NaChar + NdChar) * 0.5
          	t_1 = (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))))
          	tmp = 0
          	if t_1 <= -1e-226:
          		tmp = t_0
          	elif t_1 <= 1e-244:
          		tmp = ((NdChar * NdChar) * -0.5) / (NaChar - NdChar)
          	else:
          		tmp = t_0
          	return tmp
          
          function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
          	t_0 = Float64(Float64(NaChar + NdChar) * 0.5)
          	t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
          	tmp = 0.0
          	if (t_1 <= -1e-226)
          		tmp = t_0;
          	elseif (t_1 <= 1e-244)
          		tmp = Float64(Float64(Float64(NdChar * NdChar) * -0.5) / Float64(NaChar - 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 + NdChar) * 0.5;
          	t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
          	tmp = 0.0;
          	if (t_1 <= -1e-226)
          		tmp = t_0;
          	elseif (t_1 <= 1e-244)
          		tmp = ((NdChar * NdChar) * -0.5) / (NaChar - 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[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-226], t$95$0, If[LessEqual[t$95$1, 1e-244], N[(N[(N[(NdChar * NdChar), $MachinePrecision] * -0.5), $MachinePrecision] / N[(NaChar - NdChar), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
          t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\
          \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-226}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;t\_1 \leq 10^{-244}:\\
          \;\;\;\;\frac{\left(NdChar \cdot NdChar\right) \cdot -0.5}{NaChar - NdChar}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -9.99999999999999921e-227 or 9.9999999999999993e-245 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

            1. 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. Add Preprocessing
            3. Taylor expanded in KbT around inf

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

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
              3. lower-+.f6437.0

                \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
            5. Applied rewrites37.0%

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

            if -9.99999999999999921e-227 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 9.9999999999999993e-245

            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. Add Preprocessing
            3. Taylor expanded in KbT around inf

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

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
              3. lower-+.f643.6

                \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
            5. Applied rewrites3.6%

              \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites16.4%

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

                \[\leadsto \frac{\frac{-1}{2} \cdot {NdChar}^{2}}{\color{blue}{NaChar} - NdChar} \]
              3. Step-by-step derivation
                1. Applied rewrites40.1%

                  \[\leadsto \frac{-0.5 \cdot \left(NdChar \cdot NdChar\right)}{\color{blue}{NaChar} - NdChar} \]
              4. Recombined 2 regimes into one program.
              5. Final simplification37.8%

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

              Alternative 7: 29.6% accurate, 0.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\ t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-304}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{-244}:\\ \;\;\;\;0.25 \cdot \left(\frac{NdChar}{KbT} \cdot Ec\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
               :precision binary64
               (let* ((t_0 (* (+ NaChar NdChar) 0.5))
                      (t_1
                       (-
                        (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                        (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
                 (if (<= t_1 -2e-304)
                   t_0
                   (if (<= t_1 1e-244) (* 0.25 (* (/ NdChar KbT) Ec)) 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 + NdChar) * 0.5;
              	double t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
              	double tmp;
              	if (t_1 <= -2e-304) {
              		tmp = t_0;
              	} else if (t_1 <= 1e-244) {
              		tmp = 0.25 * ((NdChar / KbT) * Ec);
              	} 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) :: t_1
                  real(8) :: tmp
                  t_0 = (nachar + ndchar) * 0.5d0
                  t_1 = (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))) - (ndchar / ((-1.0d0) - exp(((mu - ((ec - vef) - edonor)) / kbt))))
                  if (t_1 <= (-2d-304)) then
                      tmp = t_0
                  else if (t_1 <= 1d-244) then
                      tmp = 0.25d0 * ((ndchar / kbt) * ec)
                  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 + NdChar) * 0.5;
              	double t_1 = (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - Math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
              	double tmp;
              	if (t_1 <= -2e-304) {
              		tmp = t_0;
              	} else if (t_1 <= 1e-244) {
              		tmp = 0.25 * ((NdChar / KbT) * Ec);
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
              	t_0 = (NaChar + NdChar) * 0.5
              	t_1 = (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))))
              	tmp = 0
              	if t_1 <= -2e-304:
              		tmp = t_0
              	elif t_1 <= 1e-244:
              		tmp = 0.25 * ((NdChar / KbT) * Ec)
              	else:
              		tmp = t_0
              	return tmp
              
              function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
              	t_0 = Float64(Float64(NaChar + NdChar) * 0.5)
              	t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
              	tmp = 0.0
              	if (t_1 <= -2e-304)
              		tmp = t_0;
              	elseif (t_1 <= 1e-244)
              		tmp = Float64(0.25 * Float64(Float64(NdChar / KbT) * Ec));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
              	t_0 = (NaChar + NdChar) * 0.5;
              	t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
              	tmp = 0.0;
              	if (t_1 <= -2e-304)
              		tmp = t_0;
              	elseif (t_1 <= 1e-244)
              		tmp = 0.25 * ((NdChar / KbT) * Ec);
              	else
              		tmp = t_0;
              	end
              	tmp_2 = tmp;
              end
              
              code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-304], t$95$0, If[LessEqual[t$95$1, 1e-244], N[(0.25 * N[(N[(NdChar / KbT), $MachinePrecision] * Ec), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
              t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\
              \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-304}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;t\_1 \leq 10^{-244}:\\
              \;\;\;\;0.25 \cdot \left(\frac{NdChar}{KbT} \cdot Ec\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -1.99999999999999994e-304 or 9.9999999999999993e-245 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

                1. 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. Add Preprocessing
                3. Taylor expanded in KbT around inf

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

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

                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
                  3. lower-+.f6435.8

                    \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
                5. Applied rewrites35.8%

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

                if -1.99999999999999994e-304 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 9.9999999999999993e-245

                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. Add Preprocessing
                3. Taylor expanded in KbT around -inf

                  \[\leadsto \color{blue}{\frac{-1}{4} \cdot \frac{NaChar \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}{KbT} + \left(\frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right)} \]
                4. Step-by-step derivation
                  1. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, \frac{NaChar \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right)} \]
                  2. associate-/l*N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{NaChar \cdot \frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  3. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{NaChar \cdot \frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  4. lower-/.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \color{blue}{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  5. lower--.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\color{blue}{\left(EAccept + \left(Ev + Vef\right)\right) - mu}}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  6. lower-+.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\color{blue}{\left(EAccept + \left(Ev + Vef\right)\right)} - mu}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  7. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\left(EAccept + \color{blue}{\left(Vef + Ev\right)}\right) - mu}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  8. lower-+.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\left(EAccept + \color{blue}{\left(Vef + Ev\right)}\right) - mu}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                  9. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\left(EAccept + \left(Vef + Ev\right)\right) - mu}{KbT}, \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT}, \frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)}\right) \]
                5. Applied rewrites1.5%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, NaChar \cdot \frac{\left(EAccept + \left(Vef + Ev\right)\right) - mu}{KbT}, \mathsf{fma}\left(-0.25, NdChar \cdot \frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}, 0.5 \cdot \left(NaChar + NdChar\right)\right)\right)} \]
                6. Taylor expanded in Ec around inf

                  \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{Ec \cdot NdChar}{KbT}} \]
                7. Step-by-step derivation
                  1. Applied rewrites21.9%

                    \[\leadsto \left(Ec \cdot \frac{NdChar}{KbT}\right) \cdot \color{blue}{0.25} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification32.7%

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

                Alternative 8: 29.5% accurate, 0.5× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\ t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-300}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-249}:\\ \;\;\;\;\left(\frac{NdChar}{KbT} \cdot EDonor\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                 :precision binary64
                 (let* ((t_0 (* (+ NaChar NdChar) 0.5))
                        (t_1
                         (-
                          (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                          (/ NdChar (- -1.0 (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)))))))
                   (if (<= t_1 -2e-300)
                     t_0
                     (if (<= t_1 4e-249) (* (* (/ NdChar KbT) EDonor) -0.25) 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 + NdChar) * 0.5;
                	double t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
                	double tmp;
                	if (t_1 <= -2e-300) {
                		tmp = t_0;
                	} else if (t_1 <= 4e-249) {
                		tmp = ((NdChar / KbT) * EDonor) * -0.25;
                	} 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) :: t_1
                    real(8) :: tmp
                    t_0 = (nachar + ndchar) * 0.5d0
                    t_1 = (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))) - (ndchar / ((-1.0d0) - exp(((mu - ((ec - vef) - edonor)) / kbt))))
                    if (t_1 <= (-2d-300)) then
                        tmp = t_0
                    else if (t_1 <= 4d-249) then
                        tmp = ((ndchar / kbt) * edonor) * (-0.25d0)
                    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 + NdChar) * 0.5;
                	double t_1 = (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - Math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
                	double tmp;
                	if (t_1 <= -2e-300) {
                		tmp = t_0;
                	} else if (t_1 <= 4e-249) {
                		tmp = ((NdChar / KbT) * EDonor) * -0.25;
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                	t_0 = (NaChar + NdChar) * 0.5
                	t_1 = (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - math.exp(((mu - ((Ec - Vef) - EDonor)) / KbT))))
                	tmp = 0
                	if t_1 <= -2e-300:
                		tmp = t_0
                	elif t_1 <= 4e-249:
                		tmp = ((NdChar / KbT) * EDonor) * -0.25
                	else:
                		tmp = t_0
                	return tmp
                
                function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                	t_0 = Float64(Float64(NaChar + NdChar) * 0.5)
                	t_1 = Float64(Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))) - Float64(NdChar / Float64(-1.0 - exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)))))
                	tmp = 0.0
                	if (t_1 <= -2e-300)
                		tmp = t_0;
                	elseif (t_1 <= 4e-249)
                		tmp = Float64(Float64(Float64(NdChar / KbT) * EDonor) * -0.25);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                	t_0 = (NaChar + NdChar) * 0.5;
                	t_1 = (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))) - (NdChar / (-1.0 - exp(((mu - ((Ec - Vef) - EDonor)) / KbT))));
                	tmp = 0.0;
                	if (t_1 <= -2e-300)
                		tmp = t_0;
                	elseif (t_1 <= 4e-249)
                		tmp = ((NdChar / KbT) * EDonor) * -0.25;
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(NdChar / N[(-1.0 - N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-300], t$95$0, If[LessEqual[t$95$1, 4e-249], N[(N[(N[(NdChar / KbT), $MachinePrecision] * EDonor), $MachinePrecision] * -0.25), $MachinePrecision], t$95$0]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \left(NaChar + NdChar\right) \cdot 0.5\\
                t_1 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}}\\
                \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-300}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-249}:\\
                \;\;\;\;\left(\frac{NdChar}{KbT} \cdot EDonor\right) \cdot -0.25\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -2.00000000000000005e-300 or 4.00000000000000022e-249 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

                  1. 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. Add Preprocessing
                  3. Taylor expanded in KbT around inf

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

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

                      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
                    3. lower-+.f6435.8

                      \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
                  5. Applied rewrites35.8%

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

                  if -2.00000000000000005e-300 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 4.00000000000000022e-249

                  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. Add Preprocessing
                  3. Taylor expanded in KbT around -inf

                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \frac{NaChar \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}{KbT} + \left(\frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right)} \]
                  4. Step-by-step derivation
                    1. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, \frac{NaChar \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right)} \]
                    2. associate-/l*N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{NaChar \cdot \frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    3. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{NaChar \cdot \frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    4. lower-/.f64N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \color{blue}{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    5. lower--.f64N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\color{blue}{\left(EAccept + \left(Ev + Vef\right)\right) - mu}}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    6. lower-+.f64N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\color{blue}{\left(EAccept + \left(Ev + Vef\right)\right)} - mu}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    7. +-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\left(EAccept + \color{blue}{\left(Vef + Ev\right)}\right) - mu}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    8. lower-+.f64N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\left(EAccept + \color{blue}{\left(Vef + Ev\right)}\right) - mu}{KbT}, \frac{-1}{4} \cdot \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)\right) \]
                    9. lower-fma.f64N/A

                      \[\leadsto \mathsf{fma}\left(\frac{-1}{4}, NaChar \cdot \frac{\left(EAccept + \left(Vef + Ev\right)\right) - mu}{KbT}, \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, \frac{NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)}{KbT}, \frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)}\right) \]
                  5. Applied rewrites1.5%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, NaChar \cdot \frac{\left(EAccept + \left(Vef + Ev\right)\right) - mu}{KbT}, \mathsf{fma}\left(-0.25, NdChar \cdot \frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}, 0.5 \cdot \left(NaChar + NdChar\right)\right)\right)} \]
                  6. Taylor expanded in EDonor around inf

                    \[\leadsto \frac{-1}{4} \cdot \color{blue}{\frac{EDonor \cdot NdChar}{KbT}} \]
                  7. Step-by-step derivation
                    1. Applied rewrites20.8%

                      \[\leadsto \left(EDonor \cdot \frac{NdChar}{KbT}\right) \cdot \color{blue}{-0.25} \]
                  8. Recombined 2 regimes into one program.
                  9. Final simplification32.4%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq -2 \cdot 10^{-300}:\\ \;\;\;\;\left(NaChar + NdChar\right) \cdot 0.5\\ \mathbf{elif}\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} - \frac{NdChar}{-1 - e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}}} \leq 4 \cdot 10^{-249}:\\ \;\;\;\;\left(\frac{NdChar}{KbT} \cdot EDonor\right) \cdot -0.25\\ \mathbf{else}:\\ \;\;\;\;\left(NaChar + NdChar\right) \cdot 0.5\\ \end{array} \]
                  10. Add Preprocessing

                  Alternative 9: 100.0% accurate, 1.0× speedup?

                  \[\begin{array}{l} \\ \mathsf{fma}\left(\frac{1}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}, NaChar, \frac{NdChar}{e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}} - -1}\right) \end{array} \]
                  (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                   :precision binary64
                   (fma
                    (/ 1.0 (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                    NaChar
                    (/ NdChar (- (exp (/ (- mu (- (- Ec Vef) EDonor)) KbT)) -1.0))))
                  double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                  	return fma((1.0 / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)))), NaChar, (NdChar / (exp(((mu - ((Ec - Vef) - EDonor)) / KbT)) - -1.0)));
                  }
                  
                  function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                  	return fma(Float64(1.0 / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))), NaChar, Float64(NdChar / Float64(exp(Float64(Float64(mu - Float64(Float64(Ec - Vef) - EDonor)) / KbT)) - -1.0)))
                  end
                  
                  code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(1.0 / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * NaChar + N[(NdChar / N[(N[Exp[N[(N[(mu - N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \mathsf{fma}\left(\frac{1}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}, NaChar, \frac{NdChar}{e^{\frac{mu - \left(\left(Ec - Vef\right) - EDonor\right)}{KbT}} - -1}\right)
                  \end{array}
                  
                  Derivation
                  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. Add Preprocessing
                  3. Step-by-step derivation
                    1. lift-+.f64N/A

                      \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}} \]
                    2. +-commutativeN/A

                      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}} + \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}}} \]
                    3. lift-/.f64N/A

                      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}} + \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} \]
                    4. clear-numN/A

                      \[\leadsto \color{blue}{\frac{1}{\frac{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}}{NaChar}}} + \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} \]
                    5. associate-/r/N/A

                      \[\leadsto \color{blue}{\frac{1}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(\mathsf{neg}\left(mu\right)\right)}{KbT}}} \cdot NaChar} + \frac{NdChar}{1 + e^{\frac{\mathsf{neg}\left(\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)\right)}{KbT}}} \]
                    6. lower-fma.f64N/A

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

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

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

                  Alternative 10: 100.0% accurate, 1.0× speedup?

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

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

                  Alternative 11: 70.0% accurate, 1.9× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{if}\;NaChar \leq -7 \cdot 10^{-11}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NaChar \leq 2.05 \cdot 10^{-30}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{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 (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))))
                     (if (<= NaChar -7e-11)
                       t_0
                       (if (<= NaChar 2.05e-30)
                         (/ NdChar (- (exp (/ (- (+ (+ mu Vef) EDonor) 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 / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
                  	double tmp;
                  	if (NaChar <= -7e-11) {
                  		tmp = t_0;
                  	} else if (NaChar <= 2.05e-30) {
                  		tmp = NdChar / (exp(((((mu + Vef) + EDonor) - 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 / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))
                      if (nachar <= (-7d-11)) then
                          tmp = t_0
                      else if (nachar <= 2.05d-30) then
                          tmp = ndchar / (exp(((((mu + vef) + edonor) - 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 / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
                  	double tmp;
                  	if (NaChar <= -7e-11) {
                  		tmp = t_0;
                  	} else if (NaChar <= 2.05e-30) {
                  		tmp = NdChar / (Math.exp(((((mu + Vef) + EDonor) - Ec) / KbT)) - -1.0);
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                  	t_0 = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))
                  	tmp = 0
                  	if NaChar <= -7e-11:
                  		tmp = t_0
                  	elif NaChar <= 2.05e-30:
                  		tmp = NdChar / (math.exp(((((mu + Vef) + EDonor) - 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(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))))
                  	tmp = 0.0
                  	if (NaChar <= -7e-11)
                  		tmp = t_0;
                  	elseif (NaChar <= 2.05e-30)
                  		tmp = Float64(NdChar / Float64(exp(Float64(Float64(Float64(Float64(mu + Vef) + EDonor) - 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 / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
                  	tmp = 0.0;
                  	if (NaChar <= -7e-11)
                  		tmp = t_0;
                  	elseif (NaChar <= 2.05e-30)
                  		tmp = NdChar / (exp(((((mu + Vef) + EDonor) - 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[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NaChar, -7e-11], t$95$0, If[LessEqual[NaChar, 2.05e-30], N[(NdChar / N[(N[Exp[N[(N[(N[(N[(mu + Vef), $MachinePrecision] + EDonor), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
                  \mathbf{if}\;NaChar \leq -7 \cdot 10^{-11}:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;NaChar \leq 2.05 \cdot 10^{-30}:\\
                  \;\;\;\;\frac{NdChar}{e^{\frac{\left(\left(mu + Vef\right) + EDonor\right) - Ec}{KbT}} - -1}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if NaChar < -7.00000000000000038e-11 or 2.0500000000000002e-30 < NaChar

                    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. Add Preprocessing
                    3. Taylor expanded in NaChar around inf

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

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

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

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

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

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

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

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

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

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

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

                    if -7.00000000000000038e-11 < NaChar < 2.0500000000000002e-30

                    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. Add Preprocessing
                    3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 12: 58.8% accurate, 2.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;Vef \leq 3.8 \cdot 10^{+123}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1}\\ \end{array} \end{array} \]
                  (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                   :precision binary64
                   (if (<= Vef 3.8e+123)
                     (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))
                     (/ NdChar (- (exp (/ Vef KbT)) -1.0))))
                  double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                  	double tmp;
                  	if (Vef <= 3.8e+123) {
                  		tmp = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
                  	} else {
                  		tmp = NdChar / (exp((Vef / KbT)) - -1.0);
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                      real(8), intent (in) :: ndchar
                      real(8), intent (in) :: ec
                      real(8), intent (in) :: vef
                      real(8), intent (in) :: edonor
                      real(8), intent (in) :: mu
                      real(8), intent (in) :: kbt
                      real(8), intent (in) :: nachar
                      real(8), intent (in) :: ev
                      real(8), intent (in) :: eaccept
                      real(8) :: tmp
                      if (vef <= 3.8d+123) then
                          tmp = nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt)))
                      else
                          tmp = ndchar / (exp((vef / kbt)) - (-1.0d0))
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                  	double tmp;
                  	if (Vef <= 3.8e+123) {
                  		tmp = NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
                  	} else {
                  		tmp = NdChar / (Math.exp((Vef / KbT)) - -1.0);
                  	}
                  	return tmp;
                  }
                  
                  def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                  	tmp = 0
                  	if Vef <= 3.8e+123:
                  		tmp = NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT)))
                  	else:
                  		tmp = NdChar / (math.exp((Vef / KbT)) - -1.0)
                  	return tmp
                  
                  function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                  	tmp = 0.0
                  	if (Vef <= 3.8e+123)
                  		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT))));
                  	else
                  		tmp = Float64(NdChar / Float64(exp(Float64(Vef / KbT)) - -1.0));
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                  	tmp = 0.0;
                  	if (Vef <= 3.8e+123)
                  		tmp = NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT)));
                  	else
                  		tmp = NdChar / (exp((Vef / KbT)) - -1.0);
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[Vef, 3.8e+123], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;Vef \leq 3.8 \cdot 10^{+123}:\\
                  \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if Vef < 3.79999999999999994e123

                    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. Add Preprocessing
                    3. Taylor expanded in NaChar around inf

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

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

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

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

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

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

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

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

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

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

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

                    if 3.79999999999999994e123 < 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. Add Preprocessing
                    3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{NdChar}{e^{\frac{Vef}{KbT}} + 1} \]
                    7. Step-by-step derivation
                      1. Applied rewrites65.2%

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq 3.8 \cdot 10^{+123}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{e^{\frac{Vef}{KbT}} - -1}\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 13: 20.2% accurate, 23.0× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -2.6 \cdot 10^{+23}:\\ \;\;\;\;0.5 \cdot NdChar\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot NaChar\\ \end{array} \end{array} \]
                    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                     :precision binary64
                     (if (<= NdChar -2.6e+23) (* 0.5 NdChar) (* 0.5 NaChar)))
                    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                    	double tmp;
                    	if (NdChar <= -2.6e+23) {
                    		tmp = 0.5 * NdChar;
                    	} else {
                    		tmp = 0.5 * NaChar;
                    	}
                    	return tmp;
                    }
                    
                    real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                        real(8), intent (in) :: ndchar
                        real(8), intent (in) :: ec
                        real(8), intent (in) :: vef
                        real(8), intent (in) :: edonor
                        real(8), intent (in) :: mu
                        real(8), intent (in) :: kbt
                        real(8), intent (in) :: nachar
                        real(8), intent (in) :: ev
                        real(8), intent (in) :: eaccept
                        real(8) :: tmp
                        if (ndchar <= (-2.6d+23)) then
                            tmp = 0.5d0 * ndchar
                        else
                            tmp = 0.5d0 * nachar
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                    	double tmp;
                    	if (NdChar <= -2.6e+23) {
                    		tmp = 0.5 * NdChar;
                    	} else {
                    		tmp = 0.5 * NaChar;
                    	}
                    	return tmp;
                    }
                    
                    def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                    	tmp = 0
                    	if NdChar <= -2.6e+23:
                    		tmp = 0.5 * NdChar
                    	else:
                    		tmp = 0.5 * NaChar
                    	return tmp
                    
                    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                    	tmp = 0.0
                    	if (NdChar <= -2.6e+23)
                    		tmp = Float64(0.5 * NdChar);
                    	else
                    		tmp = Float64(0.5 * NaChar);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                    	tmp = 0.0;
                    	if (NdChar <= -2.6e+23)
                    		tmp = 0.5 * NdChar;
                    	else
                    		tmp = 0.5 * NaChar;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NdChar, -2.6e+23], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;NdChar \leq -2.6 \cdot 10^{+23}:\\
                    \;\;\;\;0.5 \cdot NdChar\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;0.5 \cdot NaChar\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if NdChar < -2.59999999999999992e23

                      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. Add Preprocessing
                      3. Taylor expanded in NaChar around 0

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{1}{2} \cdot \color{blue}{NdChar} \]
                      7. Step-by-step derivation
                        1. Applied rewrites25.0%

                          \[\leadsto 0.5 \cdot \color{blue}{NdChar} \]

                        if -2.59999999999999992e23 < 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. Add Preprocessing
                        3. Taylor expanded in KbT around inf

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

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

                            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
                          3. lower-+.f6427.2

                            \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
                        5. Applied rewrites27.2%

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

                          \[\leadsto \frac{1}{2} \cdot \color{blue}{NaChar} \]
                        7. Step-by-step derivation
                          1. Applied rewrites22.2%

                            \[\leadsto 0.5 \cdot \color{blue}{NaChar} \]
                        8. Recombined 2 regimes into one program.
                        9. Add Preprocessing

                        Alternative 14: 27.5% accurate, 30.7× speedup?

                        \[\begin{array}{l} \\ \left(NaChar + NdChar\right) \cdot 0.5 \end{array} \]
                        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                         :precision binary64
                         (* (+ NaChar NdChar) 0.5))
                        double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                        	return (NaChar + 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 = (nachar + 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 (NaChar + NdChar) * 0.5;
                        }
                        
                        def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                        	return (NaChar + NdChar) * 0.5
                        
                        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                        	return Float64(Float64(NaChar + NdChar) * 0.5)
                        end
                        
                        function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                        	tmp = (NaChar + NdChar) * 0.5;
                        end
                        
                        code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NaChar + NdChar), $MachinePrecision] * 0.5), $MachinePrecision]
                        
                        \begin{array}{l}
                        
                        \\
                        \left(NaChar + NdChar\right) \cdot 0.5
                        \end{array}
                        
                        Derivation
                        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. Add Preprocessing
                        3. Taylor expanded in KbT around inf

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

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

                            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
                          3. lower-+.f6428.5

                            \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
                        5. Applied rewrites28.5%

                          \[\leadsto \color{blue}{0.5 \cdot \left(NaChar + NdChar\right)} \]
                        6. Final simplification28.5%

                          \[\leadsto \left(NaChar + NdChar\right) \cdot 0.5 \]
                        7. Add Preprocessing

                        Alternative 15: 18.1% accurate, 46.0× speedup?

                        \[\begin{array}{l} \\ 0.5 \cdot NaChar \end{array} \]
                        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                         :precision binary64
                         (* 0.5 NaChar))
                        double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                        	return 0.5 * NaChar;
                        }
                        
                        real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                            real(8), intent (in) :: ndchar
                            real(8), intent (in) :: ec
                            real(8), intent (in) :: vef
                            real(8), intent (in) :: edonor
                            real(8), intent (in) :: mu
                            real(8), intent (in) :: kbt
                            real(8), intent (in) :: nachar
                            real(8), intent (in) :: ev
                            real(8), intent (in) :: eaccept
                            code = 0.5d0 * nachar
                        end function
                        
                        public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                        	return 0.5 * NaChar;
                        }
                        
                        def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                        	return 0.5 * NaChar
                        
                        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                        	return Float64(0.5 * NaChar)
                        end
                        
                        function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                        	tmp = 0.5 * NaChar;
                        end
                        
                        code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar), $MachinePrecision]
                        
                        \begin{array}{l}
                        
                        \\
                        0.5 \cdot NaChar
                        \end{array}
                        
                        Derivation
                        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. Add Preprocessing
                        3. Taylor expanded in KbT around inf

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

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

                            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(NaChar + NdChar\right)} \]
                          3. lower-+.f6428.5

                            \[\leadsto 0.5 \cdot \color{blue}{\left(NaChar + NdChar\right)} \]
                        5. Applied rewrites28.5%

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

                          \[\leadsto \frac{1}{2} \cdot \color{blue}{NaChar} \]
                        7. Step-by-step derivation
                          1. Applied rewrites20.3%

                            \[\leadsto 0.5 \cdot \color{blue}{NaChar} \]
                          2. Add Preprocessing

                          Reproduce

                          ?
                          herbie shell --seed 2024240 
                          (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))))))