Bulmash initializePoisson

Percentage Accurate: 100.0% → 100.0%
Time: 8.6s
Alternatives: 17
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))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
    real(8), intent (in) :: ndchar
    real(8), intent (in) :: ec
    real(8), intent (in) :: vef
    real(8), intent (in) :: edonor
    real(8), intent (in) :: mu
    real(8), intent (in) :: kbt
    real(8), intent (in) :: nachar
    real(8), intent (in) :: ev
    real(8), intent (in) :: eaccept
    code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))))
end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

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 17 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))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
    real(8), intent (in) :: ndchar
    real(8), intent (in) :: ec
    real(8), intent (in) :: vef
    real(8), intent (in) :: edonor
    real(8), intent (in) :: mu
    real(8), intent (in) :: kbt
    real(8), intent (in) :: nachar
    real(8), intent (in) :: ev
    real(8), intent (in) :: eaccept
    code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))))
end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] + (-mu)), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 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) - mu}{KbT}}} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (+
  (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
  (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
    real(8), intent (in) :: ndchar
    real(8), intent (in) :: ec
    real(8), intent (in) :: vef
    real(8), intent (in) :: edonor
    real(8), intent (in) :: mu
    real(8), intent (in) :: kbt
    real(8), intent (in) :: nachar
    real(8), intent (in) :: ev
    real(8), intent (in) :: eaccept
    code = (ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))) + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	return (NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))))
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	return Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))))
end
function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	tmp = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}
\end{array}
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{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}} \]
  4. Add Preprocessing

Alternative 2: 79.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}}\\ t_1 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-244} \lor \neg \left(t\_1 \leq 5 \cdot 10^{-265}\right):\\ \;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\ \end{array} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT)))))
        (t_1
         (+
          t_0
          (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
   (if (or (<= t_1 -2e-244) (not (<= t_1 5e-265)))
     (+ t_0 (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))))
     (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor (+ Vef mu)) Ec) KbT)))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
	double t_1 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
	double tmp;
	if ((t_1 <= -2e-244) || !(t_1 <= 5e-265)) {
		tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT))));
	} else {
		tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
    real(8), intent (in) :: ndchar
    real(8), intent (in) :: ec
    real(8), intent (in) :: vef
    real(8), intent (in) :: edonor
    real(8), intent (in) :: mu
    real(8), intent (in) :: kbt
    real(8), intent (in) :: nachar
    real(8), intent (in) :: ev
    real(8), intent (in) :: eaccept
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
    t_1 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) - mu) / kbt))))
    if ((t_1 <= (-2d-244)) .or. (.not. (t_1 <= 5d-265))) then
        tmp = t_0 + (nachar / (1.0d0 + exp((eaccept / kbt))))
    else
        tmp = ndchar / (1.0d0 + exp((((edonor + (vef + mu)) - ec) / kbt)))
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
	double t_1 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
	double tmp;
	if ((t_1 <= -2e-244) || !(t_1 <= 5e-265)) {
		tmp = t_0 + (NaChar / (1.0 + Math.exp((EAccept / KbT))));
	} else {
		tmp = NdChar / (1.0 + Math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
	}
	return tmp;
}
def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
	t_0 = NdChar / (1.0 + math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))
	t_1 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) - mu) / KbT))))
	tmp = 0
	if (t_1 <= -2e-244) or not (t_1 <= 5e-265):
		tmp = t_0 + (NaChar / (1.0 + math.exp((EAccept / KbT))))
	else:
		tmp = NdChar / (1.0 + math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)))
	return tmp
function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT))))
	t_1 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))))
	tmp = 0.0
	if ((t_1 <= -2e-244) || !(t_1 <= 5e-265))
		tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT)))));
	else
		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Float64(Vef + mu)) - Ec) / KbT))));
	end
	return tmp
end
function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
	t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
	t_1 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
	tmp = 0.0;
	if ((t_1 <= -2e-244) || ~((t_1 <= 5e-265)))
		tmp = t_0 + (NaChar / (1.0 + exp((EAccept / KbT))));
	else
		tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-244], N[Not[LessEqual[t$95$1, 5e-265]], $MachinePrecision]], N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\


\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.9999999999999999e-244 or 5.0000000000000001e-265 < (+.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 EAccept around inf

      \[\leadsto \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\color{blue}{EAccept}}{KbT}}} \]
    4. Step-by-step derivation
      1. Applied rewrites76.5%

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

      if -1.9999999999999999e-244 < (+.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.0000000000000001e-265

      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 NdChar around inf

        \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
        2. lower-+.f64N/A

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

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

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

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

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

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

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

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

    Alternative 3: 37.5% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-231} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-255}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{\left(2 + \frac{EDonor + \left(Vef + mu\right)}{KbT}\right) - \frac{Ec}{KbT}}\\ \end{array} \end{array} \]
    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
     :precision binary64
     (let* ((t_0
             (+
              (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
              (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
       (if (or (<= t_0 -5e-231) (not (<= t_0 4e-255)))
         (fma 0.5 NaChar (* 0.5 NdChar))
         (/ NdChar (- (+ 2.0 (/ (+ EDonor (+ Vef mu)) KbT)) (/ Ec KbT))))))
    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
    	double tmp;
    	if ((t_0 <= -5e-231) || !(t_0 <= 4e-255)) {
    		tmp = fma(0.5, NaChar, (0.5 * NdChar));
    	} else {
    		tmp = NdChar / ((2.0 + ((EDonor + (Vef + mu)) / KbT)) - (Ec / KbT));
    	}
    	return tmp;
    }
    
    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))))
    	tmp = 0.0
    	if ((t_0 <= -5e-231) || !(t_0 <= 4e-255))
    		tmp = fma(0.5, NaChar, Float64(0.5 * NdChar));
    	else
    		tmp = Float64(NdChar / Float64(Float64(2.0 + Float64(Float64(EDonor + Float64(Vef + mu)) / KbT)) - Float64(Ec / KbT)));
    	end
    	return tmp
    end
    
    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-231], N[Not[LessEqual[t$95$0, 4e-255]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(N[(2.0 + N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] - N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
    \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-231} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-255}\right):\\
    \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{NdChar}{\left(2 + \frac{EDonor + \left(Vef + mu\right)}{KbT}\right) - \frac{Ec}{KbT}}\\
    
    
    \end{array}
    \end{array}
    
    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.00000000000000023e-231 or 4e-255 < (+.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. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
        2. lower-*.f6434.8

          \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
      5. Applied rewrites34.8%

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

      if -5.00000000000000023e-231 < (+.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-255

      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 NdChar around inf

        \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
        2. lower-+.f64N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
      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. lower--.f64N/A

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

          \[\leadsto \frac{NdChar}{\left(2 + \left(\frac{EDonor}{KbT} + \left(\frac{Vef}{KbT} + \frac{mu}{KbT}\right)\right)\right) - \frac{Ec}{KbT}} \]
        3. div-add-revN/A

          \[\leadsto \frac{NdChar}{\left(2 + \left(\frac{EDonor}{KbT} + \frac{Vef + mu}{KbT}\right)\right) - \frac{Ec}{KbT}} \]
        4. div-addN/A

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

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

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

          \[\leadsto \frac{NdChar}{\left(2 + \frac{EDonor + \left(Vef + mu\right)}{KbT}\right) - \frac{Ec}{KbT}} \]
        8. lower-/.f6454.6

          \[\leadsto \frac{NdChar}{\left(2 + \frac{EDonor + \left(Vef + mu\right)}{KbT}\right) - \frac{Ec}{KbT}} \]
      8. Applied rewrites54.6%

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

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

    Alternative 4: 37.2% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-291} \lor \neg \left(t\_0 \leq 7.59 \cdot 10^{-221}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}}\\ \end{array} \end{array} \]
    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
     :precision binary64
     (let* ((t_0
             (+
              (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
              (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
       (if (or (<= t_0 -4e-291) (not (<= t_0 7.59e-221)))
         (fma 0.5 NaChar (* 0.5 NdChar))
         (/ NaChar (- (+ 2.0 (/ (+ EAccept (+ Ev Vef)) KbT)) (/ mu KbT))))))
    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
    	double tmp;
    	if ((t_0 <= -4e-291) || !(t_0 <= 7.59e-221)) {
    		tmp = fma(0.5, NaChar, (0.5 * NdChar));
    	} else {
    		tmp = NaChar / ((2.0 + ((EAccept + (Ev + Vef)) / KbT)) - (mu / KbT));
    	}
    	return tmp;
    }
    
    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))))
    	tmp = 0.0
    	if ((t_0 <= -4e-291) || !(t_0 <= 7.59e-221))
    		tmp = fma(0.5, NaChar, Float64(0.5 * NdChar));
    	else
    		tmp = Float64(NaChar / Float64(Float64(2.0 + Float64(Float64(EAccept + Float64(Ev + Vef)) / KbT)) - Float64(mu / KbT)));
    	end
    	return tmp
    end
    
    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-291], N[Not[LessEqual[t$95$0, 7.59e-221]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(N[(2.0 + N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision] - N[(mu / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
    \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-291} \lor \neg \left(t\_0 \leq 7.59 \cdot 10^{-221}\right):\\
    \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}}\\
    
    
    \end{array}
    \end{array}
    
    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))))) < -3.99999999999999985e-291 or 7.5900000000000001e-221 < (+.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. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
        2. lower-*.f6434.1

          \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
      5. Applied rewrites34.1%

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

      if -3.99999999999999985e-291 < (+.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))))) < 7.5900000000000001e-221

      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 NdChar around 0

        \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
        2. lower-+.f64N/A

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

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

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

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

          \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
        7. lift-+.f6493.7

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

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

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

          \[\leadsto \frac{NaChar}{\left(2 + \left(\frac{EAccept}{KbT} + \left(\frac{Ev}{KbT} + \frac{Vef}{KbT}\right)\right)\right) - \frac{mu}{\color{blue}{KbT}}} \]
        2. div-add-revN/A

          \[\leadsto \frac{NaChar}{\left(2 + \left(\frac{EAccept}{KbT} + \frac{Ev + Vef}{KbT}\right)\right) - \frac{mu}{KbT}} \]
        3. div-addN/A

          \[\leadsto \frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}} \]
        4. lower-+.f64N/A

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

          \[\leadsto \frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}} \]
        6. lift-+.f64N/A

          \[\leadsto \frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}} \]
        7. lift-+.f64N/A

          \[\leadsto \frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}} \]
        8. lower-/.f6449.0

          \[\leadsto \frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \frac{mu}{KbT}} \]
      8. Applied rewrites49.0%

        \[\leadsto \frac{NaChar}{\left(2 + \frac{EAccept + \left(Ev + Vef\right)}{KbT}\right) - \color{blue}{\frac{mu}{KbT}}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification37.5%

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

    Alternative 5: 31.5% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-291} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;NdChar \cdot \left(-0.25 \cdot \left(\frac{Ev}{KbT} \cdot \frac{NaChar}{NdChar}\right)\right)\\ \end{array} \end{array} \]
    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
     :precision binary64
     (let* ((t_0
             (+
              (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
              (/ NaChar (+ 1.0 (exp (/ (- (+ (+ Ev Vef) EAccept) mu) KbT)))))))
       (if (or (<= t_0 -4e-291) (not (<= t_0 0.0)))
         (fma 0.5 NaChar (* 0.5 NdChar))
         (* NdChar (* -0.25 (* (/ Ev KbT) (/ NaChar NdChar)))))))
    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	double t_0 = (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) - mu) / KbT))));
    	double tmp;
    	if ((t_0 <= -4e-291) || !(t_0 <= 0.0)) {
    		tmp = fma(0.5, NaChar, (0.5 * NdChar));
    	} else {
    		tmp = NdChar * (-0.25 * ((Ev / KbT) * (NaChar / NdChar)));
    	}
    	return tmp;
    }
    
    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	t_0 = Float64(Float64(NdChar / Float64(1.0 + exp(Float64(Float64(-Float64(Float64(Float64(Ec - Vef) - EDonor) - mu)) / KbT)))) + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) - mu) / KbT)))))
    	tmp = 0.0
    	if ((t_0 <= -4e-291) || !(t_0 <= 0.0))
    		tmp = fma(0.5, NaChar, Float64(0.5 * NdChar));
    	else
    		tmp = Float64(NdChar * Float64(-0.25 * Float64(Float64(Ev / KbT) * Float64(NaChar / NdChar))));
    	end
    	return tmp
    end
    
    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(N[(NdChar / N[(1.0 + N[Exp[N[((-N[(N[(N[(Ec - Vef), $MachinePrecision] - EDonor), $MachinePrecision] - mu), $MachinePrecision]) / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(N[(Ev + Vef), $MachinePrecision] + EAccept), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-291], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NdChar * N[(-0.25 * N[(N[(Ev / KbT), $MachinePrecision] * N[(NaChar / NdChar), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
    \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-291} \lor \neg \left(t\_0 \leq 0\right):\\
    \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;NdChar \cdot \left(-0.25 \cdot \left(\frac{Ev}{KbT} \cdot \frac{NaChar}{NdChar}\right)\right)\\
    
    
    \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))))) < -3.99999999999999985e-291 or -0.0 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

      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. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
        2. lower-*.f6433.5

          \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
      5. Applied rewrites33.5%

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

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

      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 NdChar around inf

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

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

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

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

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

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

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

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

        \[\leadsto NdChar \cdot \left(\frac{-1}{4} \cdot \frac{Ev \cdot NaChar}{\color{blue}{KbT \cdot NdChar}}\right) \]
      10. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto NdChar \cdot \left(\frac{-1}{4} \cdot \frac{Ev \cdot NaChar}{KbT \cdot \color{blue}{NdChar}}\right) \]
        2. times-fracN/A

          \[\leadsto NdChar \cdot \left(\frac{-1}{4} \cdot \left(\frac{Ev}{KbT} \cdot \frac{NaChar}{NdChar}\right)\right) \]
        3. lower-*.f64N/A

          \[\leadsto NdChar \cdot \left(\frac{-1}{4} \cdot \left(\frac{Ev}{KbT} \cdot \frac{NaChar}{NdChar}\right)\right) \]
        4. lower-/.f64N/A

          \[\leadsto NdChar \cdot \left(\frac{-1}{4} \cdot \left(\frac{Ev}{KbT} \cdot \frac{NaChar}{NdChar}\right)\right) \]
        5. lift-/.f6416.5

          \[\leadsto NdChar \cdot \left(-0.25 \cdot \left(\frac{Ev}{KbT} \cdot \frac{NaChar}{NdChar}\right)\right) \]
      11. Applied rewrites16.5%

        \[\leadsto NdChar \cdot \left(-0.25 \cdot \left(\frac{Ev}{KbT} \cdot \color{blue}{\frac{NaChar}{NdChar}}\right)\right) \]
    3. Recombined 2 regimes into one program.
    4. Final simplification30.3%

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

    Alternative 6: 50.3% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\ t_1 := \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\ \mathbf{if}\;NdChar \leq -2.8 \cdot 10^{+149}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{elif}\;NdChar \leq -1.3 \cdot 10^{+97}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;NdChar \leq -3.7 \cdot 10^{-138}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NdChar \leq -4.1 \cdot 10^{-197}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;NdChar \leq -4 \cdot 10^{-235}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \mathbf{elif}\;NdChar \leq 6.1 \cdot 10^{+34}:\\ \;\;\;\;t\_0\\ \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 (/ (- Vef mu) KbT)))))
            (t_1 (/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT))))))
       (if (<= NdChar -2.8e+149)
         (/ NdChar (+ 1.0 (exp (/ Vef KbT))))
         (if (<= NdChar -1.3e+97)
           t_1
           (if (<= NdChar -3.7e-138)
             t_0
             (if (<= NdChar -4.1e-197)
               t_1
               (if (<= NdChar -4e-235)
                 (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
                 (if (<= NdChar 6.1e+34) t_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(((Vef - mu) / KbT)));
    	double t_1 = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
    	double tmp;
    	if (NdChar <= -2.8e+149) {
    		tmp = NdChar / (1.0 + exp((Vef / KbT)));
    	} else if (NdChar <= -1.3e+97) {
    		tmp = t_1;
    	} else if (NdChar <= -3.7e-138) {
    		tmp = t_0;
    	} else if (NdChar <= -4.1e-197) {
    		tmp = t_1;
    	} else if (NdChar <= -4e-235) {
    		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
    	} else if (NdChar <= 6.1e+34) {
    		tmp = t_0;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
    use fmin_fmax_functions
        real(8), intent (in) :: ndchar
        real(8), intent (in) :: ec
        real(8), intent (in) :: vef
        real(8), intent (in) :: edonor
        real(8), intent (in) :: mu
        real(8), intent (in) :: kbt
        real(8), intent (in) :: nachar
        real(8), intent (in) :: ev
        real(8), intent (in) :: eaccept
        real(8) :: t_0
        real(8) :: t_1
        real(8) :: tmp
        t_0 = nachar / (1.0d0 + exp(((vef - mu) / kbt)))
        t_1 = ndchar / (1.0d0 + exp(((mu - ec) / kbt)))
        if (ndchar <= (-2.8d+149)) then
            tmp = ndchar / (1.0d0 + exp((vef / kbt)))
        else if (ndchar <= (-1.3d+97)) then
            tmp = t_1
        else if (ndchar <= (-3.7d-138)) then
            tmp = t_0
        else if (ndchar <= (-4.1d-197)) then
            tmp = t_1
        else if (ndchar <= (-4d-235)) then
            tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
        else if (ndchar <= 6.1d+34) then
            tmp = t_0
        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(((Vef - mu) / KbT)));
    	double t_1 = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
    	double tmp;
    	if (NdChar <= -2.8e+149) {
    		tmp = NdChar / (1.0 + Math.exp((Vef / KbT)));
    	} else if (NdChar <= -1.3e+97) {
    		tmp = t_1;
    	} else if (NdChar <= -3.7e-138) {
    		tmp = t_0;
    	} else if (NdChar <= -4.1e-197) {
    		tmp = t_1;
    	} else if (NdChar <= -4e-235) {
    		tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
    	} else if (NdChar <= 6.1e+34) {
    		tmp = t_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(((Vef - mu) / KbT)))
    	t_1 = NdChar / (1.0 + math.exp(((mu - Ec) / KbT)))
    	tmp = 0
    	if NdChar <= -2.8e+149:
    		tmp = NdChar / (1.0 + math.exp((Vef / KbT)))
    	elif NdChar <= -1.3e+97:
    		tmp = t_1
    	elif NdChar <= -3.7e-138:
    		tmp = t_0
    	elif NdChar <= -4.1e-197:
    		tmp = t_1
    	elif NdChar <= -4e-235:
    		tmp = NaChar / (1.0 + math.exp((EAccept / KbT)))
    	elif NdChar <= 6.1e+34:
    		tmp = t_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(Vef - mu) / KbT))))
    	t_1 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT))))
    	tmp = 0.0
    	if (NdChar <= -2.8e+149)
    		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT))));
    	elseif (NdChar <= -1.3e+97)
    		tmp = t_1;
    	elseif (NdChar <= -3.7e-138)
    		tmp = t_0;
    	elseif (NdChar <= -4.1e-197)
    		tmp = t_1;
    	elseif (NdChar <= -4e-235)
    		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
    	elseif (NdChar <= 6.1e+34)
    		tmp = t_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(((Vef - mu) / KbT)));
    	t_1 = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
    	tmp = 0.0;
    	if (NdChar <= -2.8e+149)
    		tmp = NdChar / (1.0 + exp((Vef / KbT)));
    	elseif (NdChar <= -1.3e+97)
    		tmp = t_1;
    	elseif (NdChar <= -3.7e-138)
    		tmp = t_0;
    	elseif (NdChar <= -4.1e-197)
    		tmp = t_1;
    	elseif (NdChar <= -4e-235)
    		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
    	elseif (NdChar <= 6.1e+34)
    		tmp = t_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[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(NdChar / N[(1.0 + N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NdChar, -2.8e+149], N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, -1.3e+97], t$95$1, If[LessEqual[NdChar, -3.7e-138], t$95$0, If[LessEqual[NdChar, -4.1e-197], t$95$1, If[LessEqual[NdChar, -4e-235], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, 6.1e+34], t$95$0, t$95$1]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
    t_1 := \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
    \mathbf{if}\;NdChar \leq -2.8 \cdot 10^{+149}:\\
    \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\
    
    \mathbf{elif}\;NdChar \leq -1.3 \cdot 10^{+97}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;NdChar \leq -3.7 \cdot 10^{-138}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;NdChar \leq -4.1 \cdot 10^{-197}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;NdChar \leq -4 \cdot 10^{-235}:\\
    \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
    
    \mathbf{elif}\;NdChar \leq 6.1 \cdot 10^{+34}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if NdChar < -2.7999999999999999e149

      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 NdChar around inf

        \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
        2. lower-+.f64N/A

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

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

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

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

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

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

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

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

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

        if -2.7999999999999999e149 < NdChar < -1.3e97 or -3.69999999999999991e-138 < NdChar < -4.1e-197 or 6.09999999999999996e34 < 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 NdChar around inf

          \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
          2. lower-+.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}} \]

          if -1.3e97 < NdChar < -3.69999999999999991e-138 or -3.9999999999999998e-235 < NdChar < 6.09999999999999996e34

          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 NdChar around 0

            \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
            2. lower-+.f64N/A

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

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

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

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

              \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
            7. lift-+.f6472.3

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

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

            \[\leadsto \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}} \]
          7. Step-by-step derivation
            1. Applied rewrites61.9%

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

            if -4.1e-197 < NdChar < -3.9999999999999998e-235

            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 NdChar around 0

              \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
              2. lower-+.f64N/A

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

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

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

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

                \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
              7. lift-+.f6490.8

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

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

              \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
            7. Step-by-step derivation
              1. Applied rewrites56.9%

                \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
            8. Recombined 4 regimes into one program.
            9. Add Preprocessing

            Alternative 7: 61.1% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -2.8 \cdot 10^{+149}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{elif}\;NdChar \leq -4.3 \cdot 10^{+100} \lor \neg \left(NdChar \leq 7.2 \cdot 10^{+34}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\ \end{array} \end{array} \]
            (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
             :precision binary64
             (if (<= NdChar -2.8e+149)
               (/ NdChar (+ 1.0 (exp (/ Vef KbT))))
               (if (or (<= NdChar -4.3e+100) (not (<= NdChar 7.2e+34)))
                 (/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT))))
                 (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT)))))))
            double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
            	double tmp;
            	if (NdChar <= -2.8e+149) {
            		tmp = NdChar / (1.0 + exp((Vef / KbT)));
            	} else if ((NdChar <= -4.3e+100) || !(NdChar <= 7.2e+34)) {
            		tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
            	} else {
            		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
            use fmin_fmax_functions
                real(8), intent (in) :: ndchar
                real(8), intent (in) :: ec
                real(8), intent (in) :: vef
                real(8), intent (in) :: edonor
                real(8), intent (in) :: mu
                real(8), intent (in) :: kbt
                real(8), intent (in) :: nachar
                real(8), intent (in) :: ev
                real(8), intent (in) :: eaccept
                real(8) :: tmp
                if (ndchar <= (-2.8d+149)) then
                    tmp = ndchar / (1.0d0 + exp((vef / kbt)))
                else if ((ndchar <= (-4.3d+100)) .or. (.not. (ndchar <= 7.2d+34))) then
                    tmp = ndchar / (1.0d0 + exp(((mu - ec) / kbt)))
                else
                    tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
                end if
                code = tmp
            end function
            
            public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
            	double tmp;
            	if (NdChar <= -2.8e+149) {
            		tmp = NdChar / (1.0 + Math.exp((Vef / KbT)));
            	} else if ((NdChar <= -4.3e+100) || !(NdChar <= 7.2e+34)) {
            		tmp = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
            	} else {
            		tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
            	}
            	return tmp;
            }
            
            def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
            	tmp = 0
            	if NdChar <= -2.8e+149:
            		tmp = NdChar / (1.0 + math.exp((Vef / KbT)))
            	elif (NdChar <= -4.3e+100) or not (NdChar <= 7.2e+34):
            		tmp = NdChar / (1.0 + math.exp(((mu - Ec) / KbT)))
            	else:
            		tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)))
            	return tmp
            
            function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
            	tmp = 0.0
            	if (NdChar <= -2.8e+149)
            		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT))));
            	elseif ((NdChar <= -4.3e+100) || !(NdChar <= 7.2e+34))
            		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT))));
            	else
            		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
            	tmp = 0.0;
            	if (NdChar <= -2.8e+149)
            		tmp = NdChar / (1.0 + exp((Vef / KbT)));
            	elseif ((NdChar <= -4.3e+100) || ~((NdChar <= 7.2e+34)))
            		tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
            	else
            		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
            	end
            	tmp_2 = tmp;
            end
            
            code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NdChar, -2.8e+149], N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[NdChar, -4.3e+100], N[Not[LessEqual[NdChar, 7.2e+34]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;NdChar \leq -2.8 \cdot 10^{+149}:\\
            \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\
            
            \mathbf{elif}\;NdChar \leq -4.3 \cdot 10^{+100} \lor \neg \left(NdChar \leq 7.2 \cdot 10^{+34}\right):\\
            \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if NdChar < -2.7999999999999999e149

              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 NdChar around inf

                \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                2. lower-+.f64N/A

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

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

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

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

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

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

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

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

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

                if -2.7999999999999999e149 < NdChar < -4.29999999999999993e100 or 7.2000000000000001e34 < 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 NdChar around inf

                  \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                  2. lower-+.f64N/A

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

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

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

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

                    \[\leadsto \frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}} \]
                  7. lower-+.f6478.0

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

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

                  \[\leadsto \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}} \]
                7. Step-by-step derivation
                  1. Applied rewrites68.8%

                    \[\leadsto \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}} \]

                  if -4.29999999999999993e100 < NdChar < 7.2000000000000001e34

                  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 NdChar around 0

                    \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                    2. lower-+.f64N/A

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

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

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

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

                      \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                    7. lift-+.f6470.5

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

                    \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                8. Recombined 3 regimes into one program.
                9. Final simplification69.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;NdChar \leq -2.8 \cdot 10^{+149}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{elif}\;NdChar \leq -4.3 \cdot 10^{+100} \lor \neg \left(NdChar \leq 7.2 \cdot 10^{+34}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\ \end{array} \]
                10. Add Preprocessing

                Alternative 8: 69.6% accurate, 1.9× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NaChar \leq -1.65 \cdot 10^{+62} \lor \neg \left(NaChar \leq 8.6 \cdot 10^{+102}\right):\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\ \end{array} \end{array} \]
                (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                 :precision binary64
                 (if (or (<= NaChar -1.65e+62) (not (<= NaChar 8.6e+102)))
                   (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
                   (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor (+ Vef mu)) Ec) KbT))))))
                double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                	double tmp;
                	if ((NaChar <= -1.65e+62) || !(NaChar <= 8.6e+102)) {
                		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
                	} else {
                		tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                use fmin_fmax_functions
                    real(8), intent (in) :: ndchar
                    real(8), intent (in) :: ec
                    real(8), intent (in) :: vef
                    real(8), intent (in) :: edonor
                    real(8), intent (in) :: mu
                    real(8), intent (in) :: kbt
                    real(8), intent (in) :: nachar
                    real(8), intent (in) :: ev
                    real(8), intent (in) :: eaccept
                    real(8) :: tmp
                    if ((nachar <= (-1.65d+62)) .or. (.not. (nachar <= 8.6d+102))) then
                        tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
                    else
                        tmp = ndchar / (1.0d0 + exp((((edonor + (vef + mu)) - ec) / kbt)))
                    end if
                    code = tmp
                end function
                
                public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                	double tmp;
                	if ((NaChar <= -1.65e+62) || !(NaChar <= 8.6e+102)) {
                		tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
                	} else {
                		tmp = NdChar / (1.0 + Math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
                	}
                	return tmp;
                }
                
                def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                	tmp = 0
                	if (NaChar <= -1.65e+62) or not (NaChar <= 8.6e+102):
                		tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)))
                	else:
                		tmp = NdChar / (1.0 + math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)))
                	return tmp
                
                function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                	tmp = 0.0
                	if ((NaChar <= -1.65e+62) || !(NaChar <= 8.6e+102))
                		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT))));
                	else
                		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Float64(Vef + mu)) - Ec) / KbT))));
                	end
                	return tmp
                end
                
                function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                	tmp = 0.0;
                	if ((NaChar <= -1.65e+62) || ~((NaChar <= 8.6e+102)))
                		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
                	else
                		tmp = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
                	end
                	tmp_2 = tmp;
                end
                
                code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NaChar, -1.65e+62], N[Not[LessEqual[NaChar, 8.6e+102]], $MachinePrecision]], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;NaChar \leq -1.65 \cdot 10^{+62} \lor \neg \left(NaChar \leq 8.6 \cdot 10^{+102}\right):\\
                \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if NaChar < -1.65e62 or 8.6000000000000002e102 < 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 NdChar around 0

                    \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                    2. lower-+.f64N/A

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

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

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

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

                      \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                    7. lift-+.f6480.7

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

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

                  if -1.65e62 < NaChar < 8.6000000000000002e102

                  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 NdChar around inf

                    \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                    2. lower-+.f64N/A

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

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

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

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

                      \[\leadsto \frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}} \]
                    7. lower-+.f6472.4

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

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

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

                Alternative 9: 49.2% accurate, 2.0× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -9.8 \cdot 10^{+98}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{elif}\;NdChar \leq 7.2 \cdot 10^{+34}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\ \end{array} \end{array} \]
                (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                 :precision binary64
                 (if (<= NdChar -9.8e+98)
                   (/ NdChar (+ 1.0 (exp (/ Vef KbT))))
                   (if (<= NdChar 7.2e+34)
                     (/ NaChar (+ 1.0 (exp (/ (- Vef mu) KbT))))
                     (/ NdChar (+ 1.0 (exp (/ mu KbT)))))))
                double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                	double tmp;
                	if (NdChar <= -9.8e+98) {
                		tmp = NdChar / (1.0 + exp((Vef / KbT)));
                	} else if (NdChar <= 7.2e+34) {
                		tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
                	} else {
                		tmp = NdChar / (1.0 + exp((mu / KbT)));
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                use fmin_fmax_functions
                    real(8), intent (in) :: ndchar
                    real(8), intent (in) :: ec
                    real(8), intent (in) :: vef
                    real(8), intent (in) :: edonor
                    real(8), intent (in) :: mu
                    real(8), intent (in) :: kbt
                    real(8), intent (in) :: nachar
                    real(8), intent (in) :: ev
                    real(8), intent (in) :: eaccept
                    real(8) :: tmp
                    if (ndchar <= (-9.8d+98)) then
                        tmp = ndchar / (1.0d0 + exp((vef / kbt)))
                    else if (ndchar <= 7.2d+34) then
                        tmp = nachar / (1.0d0 + exp(((vef - mu) / kbt)))
                    else
                        tmp = ndchar / (1.0d0 + exp((mu / kbt)))
                    end if
                    code = tmp
                end function
                
                public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                	double tmp;
                	if (NdChar <= -9.8e+98) {
                		tmp = NdChar / (1.0 + Math.exp((Vef / KbT)));
                	} else if (NdChar <= 7.2e+34) {
                		tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
                	} else {
                		tmp = NdChar / (1.0 + Math.exp((mu / KbT)));
                	}
                	return tmp;
                }
                
                def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                	tmp = 0
                	if NdChar <= -9.8e+98:
                		tmp = NdChar / (1.0 + math.exp((Vef / KbT)))
                	elif NdChar <= 7.2e+34:
                		tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT)))
                	else:
                		tmp = NdChar / (1.0 + math.exp((mu / KbT)))
                	return tmp
                
                function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                	tmp = 0.0
                	if (NdChar <= -9.8e+98)
                		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT))));
                	elseif (NdChar <= 7.2e+34)
                		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT))));
                	else
                		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT))));
                	end
                	return tmp
                end
                
                function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                	tmp = 0.0;
                	if (NdChar <= -9.8e+98)
                		tmp = NdChar / (1.0 + exp((Vef / KbT)));
                	elseif (NdChar <= 7.2e+34)
                		tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
                	else
                		tmp = NdChar / (1.0 + exp((mu / KbT)));
                	end
                	tmp_2 = tmp;
                end
                
                code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NdChar, -9.8e+98], N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[NdChar, 7.2e+34], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;NdChar \leq -9.8 \cdot 10^{+98}:\\
                \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\
                
                \mathbf{elif}\;NdChar \leq 7.2 \cdot 10^{+34}:\\
                \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if NdChar < -9.79999999999999958e98

                  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 NdChar around inf

                    \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                    2. lower-+.f64N/A

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

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

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

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

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

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

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

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

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

                    if -9.79999999999999958e98 < NdChar < 7.2000000000000001e34

                    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 NdChar around 0

                      \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                      2. lower-+.f64N/A

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

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

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

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

                        \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                      7. lift-+.f6470.5

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

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

                      \[\leadsto \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}} \]
                    7. Step-by-step derivation
                      1. Applied rewrites56.6%

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

                      if 7.2000000000000001e34 < 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 NdChar around inf

                        \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                        2. lower-+.f64N/A

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

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

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

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

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

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

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

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

                          \[\leadsto \frac{NdChar}{1 + e^{\frac{mu}{KbT}}} \]
                      8. Recombined 3 regimes into one program.
                      9. Add Preprocessing

                      Alternative 10: 43.8% accurate, 2.0× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;Vef \leq -1 \cdot 10^{+74} \lor \neg \left(Vef \leq 2.2 \cdot 10^{+90}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \end{array} \]
                      (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                       :precision binary64
                       (if (or (<= Vef -1e+74) (not (<= Vef 2.2e+90)))
                         (/ NdChar (+ 1.0 (exp (/ Vef KbT))))
                         (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
                      double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                      	double tmp;
                      	if ((Vef <= -1e+74) || !(Vef <= 2.2e+90)) {
                      		tmp = NdChar / (1.0 + exp((Vef / KbT)));
                      	} else {
                      		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                      	}
                      	return tmp;
                      }
                      
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                      use fmin_fmax_functions
                          real(8), intent (in) :: ndchar
                          real(8), intent (in) :: ec
                          real(8), intent (in) :: vef
                          real(8), intent (in) :: edonor
                          real(8), intent (in) :: mu
                          real(8), intent (in) :: kbt
                          real(8), intent (in) :: nachar
                          real(8), intent (in) :: ev
                          real(8), intent (in) :: eaccept
                          real(8) :: tmp
                          if ((vef <= (-1d+74)) .or. (.not. (vef <= 2.2d+90))) then
                              tmp = ndchar / (1.0d0 + exp((vef / kbt)))
                          else
                              tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                      	double tmp;
                      	if ((Vef <= -1e+74) || !(Vef <= 2.2e+90)) {
                      		tmp = NdChar / (1.0 + Math.exp((Vef / KbT)));
                      	} else {
                      		tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
                      	}
                      	return tmp;
                      }
                      
                      def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                      	tmp = 0
                      	if (Vef <= -1e+74) or not (Vef <= 2.2e+90):
                      		tmp = NdChar / (1.0 + math.exp((Vef / KbT)))
                      	else:
                      		tmp = NaChar / (1.0 + math.exp((EAccept / KbT)))
                      	return tmp
                      
                      function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                      	tmp = 0.0
                      	if ((Vef <= -1e+74) || !(Vef <= 2.2e+90))
                      		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT))));
                      	else
                      		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                      	tmp = 0.0;
                      	if ((Vef <= -1e+74) || ~((Vef <= 2.2e+90)))
                      		tmp = NdChar / (1.0 + exp((Vef / KbT)));
                      	else
                      		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[Vef, -1e+74], N[Not[LessEqual[Vef, 2.2e+90]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;Vef \leq -1 \cdot 10^{+74} \lor \neg \left(Vef \leq 2.2 \cdot 10^{+90}\right):\\
                      \;\;\;\;\frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if Vef < -9.99999999999999952e73 or 2.1999999999999999e90 < 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 NdChar around inf

                          \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                          2. lower-+.f64N/A

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

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

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

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

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

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

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

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

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

                          if -9.99999999999999952e73 < Vef < 2.1999999999999999e90

                          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 NdChar around 0

                            \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                            2. lower-+.f64N/A

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

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

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

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

                              \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                            7. lift-+.f6459.8

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

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

                            \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                          7. Step-by-step derivation
                            1. Applied rewrites42.0%

                              \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                          8. Recombined 2 regimes into one program.
                          9. Final simplification47.3%

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

                          Alternative 11: 43.3% accurate, 2.0× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;Vef \leq -6.9 \cdot 10^{+84} \lor \neg \left(Vef \leq 3.4 \cdot 10^{+94}\right):\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \end{array} \]
                          (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                           :precision binary64
                           (if (or (<= Vef -6.9e+84) (not (<= Vef 3.4e+94)))
                             (/ NaChar (+ 1.0 (exp (/ Vef KbT))))
                             (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
                          double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                          	double tmp;
                          	if ((Vef <= -6.9e+84) || !(Vef <= 3.4e+94)) {
                          		tmp = NaChar / (1.0 + exp((Vef / KbT)));
                          	} else {
                          		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                          	}
                          	return tmp;
                          }
                          
                          module fmin_fmax_functions
                              implicit none
                              private
                              public fmax
                              public fmin
                          
                              interface fmax
                                  module procedure fmax88
                                  module procedure fmax44
                                  module procedure fmax84
                                  module procedure fmax48
                              end interface
                              interface fmin
                                  module procedure fmin88
                                  module procedure fmin44
                                  module procedure fmin84
                                  module procedure fmin48
                              end interface
                          contains
                              real(8) function fmax88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmax44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmax84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmax48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                              end function
                              real(8) function fmin88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmin44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmin84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmin48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                              end function
                          end module
                          
                          real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                          use fmin_fmax_functions
                              real(8), intent (in) :: ndchar
                              real(8), intent (in) :: ec
                              real(8), intent (in) :: vef
                              real(8), intent (in) :: edonor
                              real(8), intent (in) :: mu
                              real(8), intent (in) :: kbt
                              real(8), intent (in) :: nachar
                              real(8), intent (in) :: ev
                              real(8), intent (in) :: eaccept
                              real(8) :: tmp
                              if ((vef <= (-6.9d+84)) .or. (.not. (vef <= 3.4d+94))) then
                                  tmp = nachar / (1.0d0 + exp((vef / kbt)))
                              else
                                  tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                          	double tmp;
                          	if ((Vef <= -6.9e+84) || !(Vef <= 3.4e+94)) {
                          		tmp = NaChar / (1.0 + Math.exp((Vef / KbT)));
                          	} else {
                          		tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
                          	}
                          	return tmp;
                          }
                          
                          def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                          	tmp = 0
                          	if (Vef <= -6.9e+84) or not (Vef <= 3.4e+94):
                          		tmp = NaChar / (1.0 + math.exp((Vef / KbT)))
                          	else:
                          		tmp = NaChar / (1.0 + math.exp((EAccept / KbT)))
                          	return tmp
                          
                          function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                          	tmp = 0.0
                          	if ((Vef <= -6.9e+84) || !(Vef <= 3.4e+94))
                          		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT))));
                          	else
                          		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                          	tmp = 0.0;
                          	if ((Vef <= -6.9e+84) || ~((Vef <= 3.4e+94)))
                          		tmp = NaChar / (1.0 + exp((Vef / KbT)));
                          	else
                          		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[Vef, -6.9e+84], N[Not[LessEqual[Vef, 3.4e+94]], $MachinePrecision]], N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;Vef \leq -6.9 \cdot 10^{+84} \lor \neg \left(Vef \leq 3.4 \cdot 10^{+94}\right):\\
                          \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if Vef < -6.8999999999999997e84 or 3.4000000000000002e94 < 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 NdChar around 0

                              \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                              2. lower-+.f64N/A

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

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

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

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

                                \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                              7. lift-+.f6455.6

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

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

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

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

                              if -6.8999999999999997e84 < Vef < 3.4000000000000002e94

                              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 NdChar around 0

                                \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                2. lower-+.f64N/A

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

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

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

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

                                  \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                                7. lift-+.f6459.3

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

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

                                \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                              7. Step-by-step derivation
                                1. Applied rewrites40.8%

                                  \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                              8. Recombined 2 regimes into one program.
                              9. Final simplification43.9%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;Vef \leq -6.9 \cdot 10^{+84} \lor \neg \left(Vef \leq 3.4 \cdot 10^{+94}\right):\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \]
                              10. Add Preprocessing

                              Alternative 12: 40.8% accurate, 2.0× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;KbT \leq -6.5 \cdot 10^{+114} \lor \neg \left(KbT \leq 7 \cdot 10^{+75}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \end{array} \]
                              (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                               :precision binary64
                               (if (or (<= KbT -6.5e+114) (not (<= KbT 7e+75)))
                                 (fma 0.5 NaChar (* 0.5 NdChar))
                                 (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
                              double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                              	double tmp;
                              	if ((KbT <= -6.5e+114) || !(KbT <= 7e+75)) {
                              		tmp = fma(0.5, NaChar, (0.5 * NdChar));
                              	} else {
                              		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                              	}
                              	return tmp;
                              }
                              
                              function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                              	tmp = 0.0
                              	if ((KbT <= -6.5e+114) || !(KbT <= 7e+75))
                              		tmp = fma(0.5, NaChar, Float64(0.5 * NdChar));
                              	else
                              		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                              	end
                              	return tmp
                              end
                              
                              code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[KbT, -6.5e+114], N[Not[LessEqual[KbT, 7e+75]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;KbT \leq -6.5 \cdot 10^{+114} \lor \neg \left(KbT \leq 7 \cdot 10^{+75}\right):\\
                              \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if KbT < -6.5000000000000001e114 or 6.9999999999999997e75 < 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. lower-fma.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
                                  2. lower-*.f6454.3

                                    \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
                                5. Applied rewrites54.3%

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

                                if -6.5000000000000001e114 < KbT < 6.9999999999999997e75

                                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 NdChar around 0

                                  \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                  2. lower-+.f64N/A

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

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

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

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

                                    \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                                  7. lift-+.f6462.8

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

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

                                  \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites35.4%

                                    \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                                8. Recombined 2 regimes into one program.
                                9. Final simplification41.5%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;KbT \leq -6.5 \cdot 10^{+114} \lor \neg \left(KbT \leq 7 \cdot 10^{+75}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \]
                                10. Add Preprocessing

                                Alternative 13: 37.2% accurate, 2.1× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;EAccept \leq 950000000000:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \end{array} \]
                                (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                                 :precision binary64
                                 (if (<= EAccept 950000000000.0)
                                   (/ NdChar (+ 1.0 (exp (/ EDonor KbT))))
                                   (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
                                double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                	double tmp;
                                	if (EAccept <= 950000000000.0) {
                                		tmp = NdChar / (1.0 + exp((EDonor / KbT)));
                                	} else {
                                		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                                	}
                                	return tmp;
                                }
                                
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: ndchar
                                    real(8), intent (in) :: ec
                                    real(8), intent (in) :: vef
                                    real(8), intent (in) :: edonor
                                    real(8), intent (in) :: mu
                                    real(8), intent (in) :: kbt
                                    real(8), intent (in) :: nachar
                                    real(8), intent (in) :: ev
                                    real(8), intent (in) :: eaccept
                                    real(8) :: tmp
                                    if (eaccept <= 950000000000.0d0) then
                                        tmp = ndchar / (1.0d0 + exp((edonor / kbt)))
                                    else
                                        tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                	double tmp;
                                	if (EAccept <= 950000000000.0) {
                                		tmp = NdChar / (1.0 + Math.exp((EDonor / KbT)));
                                	} else {
                                		tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
                                	}
                                	return tmp;
                                }
                                
                                def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                                	tmp = 0
                                	if EAccept <= 950000000000.0:
                                		tmp = NdChar / (1.0 + math.exp((EDonor / KbT)))
                                	else:
                                		tmp = NaChar / (1.0 + math.exp((EAccept / KbT)))
                                	return tmp
                                
                                function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                	tmp = 0.0
                                	if (EAccept <= 950000000000.0)
                                		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT))));
                                	else
                                		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                	tmp = 0.0;
                                	if (EAccept <= 950000000000.0)
                                		tmp = NdChar / (1.0 + exp((EDonor / KbT)));
                                	else
                                		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, 950000000000.0], N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;EAccept \leq 950000000000:\\
                                \;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if EAccept < 9.5e11

                                  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 NdChar around inf

                                    \[\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 \frac{NdChar}{\color{blue}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}} \]
                                    2. lower-+.f64N/A

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

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

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

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

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

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

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

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

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

                                    if 9.5e11 < EAccept

                                    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 NdChar around 0

                                      \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                      2. lower-+.f64N/A

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

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

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

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

                                        \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                                      7. lift-+.f6467.8

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

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

                                      \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites52.0%

                                        \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                                    8. Recombined 2 regimes into one program.
                                    9. Add Preprocessing

                                    Alternative 14: 38.5% accurate, 2.1× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;EAccept \leq 180000000000:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \end{array} \end{array} \]
                                    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                                     :precision binary64
                                     (if (<= EAccept 180000000000.0)
                                       (/ NaChar (+ 1.0 (exp (/ Ev KbT))))
                                       (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))))
                                    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                    	double tmp;
                                    	if (EAccept <= 180000000000.0) {
                                    		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                                    	} else {
                                    		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    module fmin_fmax_functions
                                        implicit none
                                        private
                                        public fmax
                                        public fmin
                                    
                                        interface fmax
                                            module procedure fmax88
                                            module procedure fmax44
                                            module procedure fmax84
                                            module procedure fmax48
                                        end interface
                                        interface fmin
                                            module procedure fmin88
                                            module procedure fmin44
                                            module procedure fmin84
                                            module procedure fmin48
                                        end interface
                                    contains
                                        real(8) function fmax88(x, y) result (res)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                        end function
                                        real(4) function fmax44(x, y) result (res)
                                            real(4), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                        end function
                                        real(8) function fmax84(x, y) result(res)
                                            real(8), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                        end function
                                        real(8) function fmax48(x, y) result(res)
                                            real(4), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                        end function
                                        real(8) function fmin88(x, y) result (res)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                        end function
                                        real(4) function fmin44(x, y) result (res)
                                            real(4), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                        end function
                                        real(8) function fmin84(x, y) result(res)
                                            real(8), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                        end function
                                        real(8) function fmin48(x, y) result(res)
                                            real(4), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                        end function
                                    end module
                                    
                                    real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                                    use fmin_fmax_functions
                                        real(8), intent (in) :: ndchar
                                        real(8), intent (in) :: ec
                                        real(8), intent (in) :: vef
                                        real(8), intent (in) :: edonor
                                        real(8), intent (in) :: mu
                                        real(8), intent (in) :: kbt
                                        real(8), intent (in) :: nachar
                                        real(8), intent (in) :: ev
                                        real(8), intent (in) :: eaccept
                                        real(8) :: tmp
                                        if (eaccept <= 180000000000.0d0) then
                                            tmp = nachar / (1.0d0 + exp((ev / kbt)))
                                        else
                                            tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
                                        end if
                                        code = tmp
                                    end function
                                    
                                    public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                    	double tmp;
                                    	if (EAccept <= 180000000000.0) {
                                    		tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
                                    	} else {
                                    		tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                                    	tmp = 0
                                    	if EAccept <= 180000000000.0:
                                    		tmp = NaChar / (1.0 + math.exp((Ev / KbT)))
                                    	else:
                                    		tmp = NaChar / (1.0 + math.exp((EAccept / KbT)))
                                    	return tmp
                                    
                                    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                    	tmp = 0.0
                                    	if (EAccept <= 180000000000.0)
                                    		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))));
                                    	else
                                    		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                                    	end
                                    	return tmp
                                    end
                                    
                                    function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                    	tmp = 0.0;
                                    	if (EAccept <= 180000000000.0)
                                    		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                                    	else
                                    		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                                    	end
                                    	tmp_2 = tmp;
                                    end
                                    
                                    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[EAccept, 180000000000.0], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;EAccept \leq 180000000000:\\
                                    \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if EAccept < 1.8e11

                                      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 NdChar around 0

                                        \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                        2. lower-+.f64N/A

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

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

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

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

                                          \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                                        7. lift-+.f6455.2

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

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

                                        \[\leadsto \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites38.8%

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

                                        if 1.8e11 < EAccept

                                        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 NdChar around 0

                                          \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                          2. lower-+.f64N/A

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

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

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

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

                                            \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                                          7. lift-+.f6466.8

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

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

                                          \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites51.3%

                                            \[\leadsto \frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}} \]
                                        8. Recombined 2 regimes into one program.
                                        9. Add Preprocessing

                                        Alternative 15: 23.1% accurate, 15.3× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NaChar \leq -2.7 \cdot 10^{+62} \lor \neg \left(NaChar \leq 1.32 \cdot 10^{+107}\right):\\ \;\;\;\;0.5 \cdot NaChar\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot NdChar\\ \end{array} \end{array} \]
                                        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                                         :precision binary64
                                         (if (or (<= NaChar -2.7e+62) (not (<= NaChar 1.32e+107)))
                                           (* 0.5 NaChar)
                                           (* 0.5 NdChar)))
                                        double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                        	double tmp;
                                        	if ((NaChar <= -2.7e+62) || !(NaChar <= 1.32e+107)) {
                                        		tmp = 0.5 * NaChar;
                                        	} else {
                                        		tmp = 0.5 * NdChar;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        module fmin_fmax_functions
                                            implicit none
                                            private
                                            public fmax
                                            public fmin
                                        
                                            interface fmax
                                                module procedure fmax88
                                                module procedure fmax44
                                                module procedure fmax84
                                                module procedure fmax48
                                            end interface
                                            interface fmin
                                                module procedure fmin88
                                                module procedure fmin44
                                                module procedure fmin84
                                                module procedure fmin48
                                            end interface
                                        contains
                                            real(8) function fmax88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmax44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmax84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmax48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmin44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmin48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                            end function
                                        end module
                                        
                                        real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: ndchar
                                            real(8), intent (in) :: ec
                                            real(8), intent (in) :: vef
                                            real(8), intent (in) :: edonor
                                            real(8), intent (in) :: mu
                                            real(8), intent (in) :: kbt
                                            real(8), intent (in) :: nachar
                                            real(8), intent (in) :: ev
                                            real(8), intent (in) :: eaccept
                                            real(8) :: tmp
                                            if ((nachar <= (-2.7d+62)) .or. (.not. (nachar <= 1.32d+107))) then
                                                tmp = 0.5d0 * nachar
                                            else
                                                tmp = 0.5d0 * ndchar
                                            end if
                                            code = tmp
                                        end function
                                        
                                        public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                        	double tmp;
                                        	if ((NaChar <= -2.7e+62) || !(NaChar <= 1.32e+107)) {
                                        		tmp = 0.5 * NaChar;
                                        	} else {
                                        		tmp = 0.5 * NdChar;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                                        	tmp = 0
                                        	if (NaChar <= -2.7e+62) or not (NaChar <= 1.32e+107):
                                        		tmp = 0.5 * NaChar
                                        	else:
                                        		tmp = 0.5 * NdChar
                                        	return tmp
                                        
                                        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                        	tmp = 0.0
                                        	if ((NaChar <= -2.7e+62) || !(NaChar <= 1.32e+107))
                                        		tmp = Float64(0.5 * NaChar);
                                        	else
                                        		tmp = Float64(0.5 * NdChar);
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                        	tmp = 0.0;
                                        	if ((NaChar <= -2.7e+62) || ~((NaChar <= 1.32e+107)))
                                        		tmp = 0.5 * NaChar;
                                        	else
                                        		tmp = 0.5 * NdChar;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NaChar, -2.7e+62], N[Not[LessEqual[NaChar, 1.32e+107]], $MachinePrecision]], N[(0.5 * NaChar), $MachinePrecision], N[(0.5 * NdChar), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;NaChar \leq -2.7 \cdot 10^{+62} \lor \neg \left(NaChar \leq 1.32 \cdot 10^{+107}\right):\\
                                        \;\;\;\;0.5 \cdot NaChar\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;0.5 \cdot NdChar\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if NaChar < -2.7e62 or 1.32000000000000003e107 < 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 NdChar around 0

                                            \[\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 \frac{NaChar}{\color{blue}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                            2. lower-+.f64N/A

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

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

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

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

                                              \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
                                            7. lift-+.f6481.4

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

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

                                            \[\leadsto \frac{1}{2} \cdot \color{blue}{NaChar} \]
                                          7. Step-by-step derivation
                                            1. lower-*.f6429.6

                                              \[\leadsto 0.5 \cdot NaChar \]
                                          8. Applied rewrites29.6%

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

                                          if -2.7e62 < NaChar < 1.32000000000000003e107

                                          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. lower-fma.f64N/A

                                              \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
                                            2. lower-*.f6427.8

                                              \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
                                          5. Applied rewrites27.8%

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

                                            \[\leadsto \frac{1}{2} \cdot \color{blue}{NdChar} \]
                                          7. Step-by-step derivation
                                            1. lift-*.f6423.4

                                              \[\leadsto 0.5 \cdot NdChar \]
                                          8. Applied rewrites23.4%

                                            \[\leadsto 0.5 \cdot \color{blue}{NdChar} \]
                                        3. Recombined 2 regimes into one program.
                                        4. Final simplification25.3%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;NaChar \leq -2.7 \cdot 10^{+62} \lor \neg \left(NaChar \leq 1.32 \cdot 10^{+107}\right):\\ \;\;\;\;0.5 \cdot NaChar\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot NdChar\\ \end{array} \]
                                        5. Add Preprocessing

                                        Alternative 16: 28.1% accurate, 23.0× speedup?

                                        \[\begin{array}{l} \\ \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \end{array} \]
                                        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                                         :precision binary64
                                         (fma 0.5 NaChar (* 0.5 NdChar)))
                                        double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                        	return fma(0.5, NaChar, (0.5 * NdChar));
                                        }
                                        
                                        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                        	return fma(0.5, NaChar, Float64(0.5 * NdChar))
                                        end
                                        
                                        code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)
                                        \end{array}
                                        
                                        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. lower-fma.f64N/A

                                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
                                          2. lower-*.f6427.7

                                            \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
                                        5. Applied rewrites27.7%

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)} \]
                                        6. Add Preprocessing

                                        Alternative 17: 18.7% accurate, 46.0× speedup?

                                        \[\begin{array}{l} \\ 0.5 \cdot NdChar \end{array} \]
                                        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                                         :precision binary64
                                         (* 0.5 NdChar))
                                        double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                        	return 0.5 * NdChar;
                                        }
                                        
                                        module fmin_fmax_functions
                                            implicit none
                                            private
                                            public fmax
                                            public fmin
                                        
                                            interface fmax
                                                module procedure fmax88
                                                module procedure fmax44
                                                module procedure fmax84
                                                module procedure fmax48
                                            end interface
                                            interface fmin
                                                module procedure fmin88
                                                module procedure fmin44
                                                module procedure fmin84
                                                module procedure fmin48
                                            end interface
                                        contains
                                            real(8) function fmax88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmax44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmax84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmax48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmin44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmin48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                            end function
                                        end module
                                        
                                        real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: ndchar
                                            real(8), intent (in) :: ec
                                            real(8), intent (in) :: vef
                                            real(8), intent (in) :: edonor
                                            real(8), intent (in) :: mu
                                            real(8), intent (in) :: kbt
                                            real(8), intent (in) :: nachar
                                            real(8), intent (in) :: ev
                                            real(8), intent (in) :: eaccept
                                            code = 0.5d0 * ndchar
                                        end function
                                        
                                        public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                        	return 0.5 * NdChar;
                                        }
                                        
                                        def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                                        	return 0.5 * NdChar
                                        
                                        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                        	return Float64(0.5 * NdChar)
                                        end
                                        
                                        function tmp = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                        	tmp = 0.5 * NdChar;
                                        end
                                        
                                        code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := N[(0.5 * NdChar), $MachinePrecision]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        0.5 \cdot NdChar
                                        \end{array}
                                        
                                        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. lower-fma.f64N/A

                                            \[\leadsto \mathsf{fma}\left(\frac{1}{2}, \color{blue}{NaChar}, \frac{1}{2} \cdot NdChar\right) \]
                                          2. lower-*.f6427.7

                                            \[\leadsto \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right) \]
                                        5. Applied rewrites27.7%

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

                                          \[\leadsto \frac{1}{2} \cdot \color{blue}{NdChar} \]
                                        7. Step-by-step derivation
                                          1. lift-*.f6418.8

                                            \[\leadsto 0.5 \cdot NdChar \]
                                        8. Applied rewrites18.8%

                                          \[\leadsto 0.5 \cdot \color{blue}{NdChar} \]
                                        9. Add Preprocessing

                                        Reproduce

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