Bulmash initializePoisson

Percentage Accurate: 100.0% → 100.0%
Time: 9.5s
Alternatives: 16
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 16 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: 76.1% 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^{-78} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-215}\right):\\ \;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{Vef}{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
 (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-78) (not (<= t_1 2e-215)))
     (+ t_0 (/ NaChar (+ 1.0 (exp (/ Vef 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 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-78) || !(t_1 <= 2e-215)) {
		tmp = t_0 + (NaChar / (1.0 + exp((Vef / 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) :: 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-78)) .or. (.not. (t_1 <= 2d-215))) then
        tmp = t_0 + (nachar / (1.0d0 + exp((vef / 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 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-78) || !(t_1 <= 2e-215)) {
		tmp = t_0 + (NaChar / (1.0 + Math.exp((Vef / 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):
	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-78) or not (t_1 <= 2e-215):
		tmp = t_0 + (NaChar / (1.0 + math.exp((Vef / 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)
	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-78) || !(t_1 <= 2e-215))
		tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Vef / 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)
	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-78) || ~((t_1 <= 2e-215)))
		tmp = t_0 + (NaChar / (1.0 + exp((Vef / 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_] := 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-78], N[Not[LessEqual[t$95$1, 2e-215]], $MachinePrecision]], N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $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}
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^{-78} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-215}\right):\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{Vef}{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 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))))) < -2e-78 or 2.00000000000000008e-215 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

    1. Initial program 100.0%

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

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

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

      if -2e-78 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2.00000000000000008e-215

      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-+.f6486.7

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

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

      \[\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^{-78} \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 2 \cdot 10^{-215}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 36.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^{-167} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-215}\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 -5e-167) (not (<= t_0 2e-215)))
         (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 <= -5e-167) || !(t_0 <= 2e-215)) {
    		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 <= -5e-167) || !(t_0 <= 2e-215))
    		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, -5e-167], N[Not[LessEqual[t$95$0, 2e-215]], $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 -5 \cdot 10^{-167} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-215}\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))))) < -5.0000000000000002e-167 or 2.00000000000000008e-215 < (+.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-*.f6438.4

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

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

      if -5.0000000000000002e-167 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2.00000000000000008e-215

      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-+.f6489.4

          \[\leadsto \frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}} \]
      5. Applied rewrites89.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{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-/.f6450.8

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

        \[\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 simplification41.7%

      \[\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^{-167} \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 2 \cdot 10^{-215}\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 4: 29.7% 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^{-230} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-255}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{Ec \cdot NdChar}{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-230) (not (<= t_0 2e-255)))
         (fma 0.5 NaChar (* 0.5 NdChar))
         (* 0.25 (/ (* Ec NdChar) 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-230) || !(t_0 <= 2e-255)) {
    		tmp = fma(0.5, NaChar, (0.5 * NdChar));
    	} else {
    		tmp = 0.25 * ((Ec * NdChar) / 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-230) || !(t_0 <= 2e-255))
    		tmp = fma(0.5, NaChar, Float64(0.5 * NdChar));
    	else
    		tmp = Float64(0.25 * Float64(Float64(Ec * NdChar) / 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-230], N[Not[LessEqual[t$95$0, 2e-255]], $MachinePrecision]], N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(Ec * NdChar), $MachinePrecision] / KbT), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) - mu}{KbT}}}\\
    \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-230} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-255}\right):\\
    \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;0.25 \cdot \frac{Ec \cdot NdChar}{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.00000000000000035e-230 or 2e-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-*.f6436.4

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

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

      if -5.00000000000000035e-230 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2e-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 KbT around inf

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

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

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

        \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{Ec \cdot NdChar}{KbT}} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{1}{4} \cdot \frac{Ec \cdot NdChar}{\color{blue}{KbT}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{1}{4} \cdot \frac{Ec \cdot NdChar}{KbT} \]
        3. lower-*.f6418.2

          \[\leadsto 0.25 \cdot \frac{Ec \cdot NdChar}{KbT} \]
      8. Applied rewrites18.2%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{Ec \cdot NdChar}{KbT}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification32.4%

      \[\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^{-230} \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 2 \cdot 10^{-255}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{Ec \cdot NdChar}{KbT}\\ \end{array} \]
    5. Add Preprocessing

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

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

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

      if -1.9999999999999999e-269 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < 2e-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 KbT around inf

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

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

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

        \[\leadsto \frac{-1}{4} \cdot \color{blue}{\frac{EDonor \cdot NdChar}{KbT}} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{-1}{4} \cdot \frac{EDonor \cdot NdChar}{\color{blue}{KbT}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{-1}{4} \cdot \frac{EDonor \cdot NdChar}{KbT} \]
        3. lower-*.f6418.3

          \[\leadsto -0.25 \cdot \frac{EDonor \cdot NdChar}{KbT} \]
      8. Applied rewrites18.3%

        \[\leadsto -0.25 \cdot \color{blue}{\frac{EDonor \cdot NdChar}{KbT}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification32.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 -2 \cdot 10^{-269} \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 2 \cdot 10^{-255}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{else}:\\ \;\;\;\;-0.25 \cdot \frac{EDonor \cdot NdChar}{KbT}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 43.1% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{if}\;Vef \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;Vef \leq -3.4 \cdot 10^{-58}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\ \mathbf{elif}\;Vef \leq 4.7 \cdot 10^{-38}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \mathbf{elif}\;Vef \leq 6 \cdot 10^{+56}:\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
     :precision binary64
     (let* ((t_0 (/ NaChar (+ 1.0 (exp (/ Vef KbT))))))
       (if (<= Vef -4.8e+91)
         t_0
         (if (<= Vef -3.4e-58)
           (/ NdChar (+ 1.0 (exp (/ mu KbT))))
           (if (<= Vef 4.7e-38)
             (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
             (if (<= Vef 6e+56) (/ NdChar (+ 1.0 (exp (/ EDonor KbT)))) t_0))))))
    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	double t_0 = NaChar / (1.0 + exp((Vef / KbT)));
    	double tmp;
    	if (Vef <= -4.8e+91) {
    		tmp = t_0;
    	} else if (Vef <= -3.4e-58) {
    		tmp = NdChar / (1.0 + exp((mu / KbT)));
    	} else if (Vef <= 4.7e-38) {
    		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
    	} else if (Vef <= 6e+56) {
    		tmp = NdChar / (1.0 + exp((EDonor / KbT)));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
    use fmin_fmax_functions
        real(8), intent (in) :: ndchar
        real(8), intent (in) :: ec
        real(8), intent (in) :: vef
        real(8), intent (in) :: edonor
        real(8), intent (in) :: mu
        real(8), intent (in) :: kbt
        real(8), intent (in) :: nachar
        real(8), intent (in) :: ev
        real(8), intent (in) :: eaccept
        real(8) :: t_0
        real(8) :: tmp
        t_0 = nachar / (1.0d0 + exp((vef / kbt)))
        if (vef <= (-4.8d+91)) then
            tmp = t_0
        else if (vef <= (-3.4d-58)) then
            tmp = ndchar / (1.0d0 + exp((mu / kbt)))
        else if (vef <= 4.7d-38) then
            tmp = nachar / (1.0d0 + exp((eaccept / kbt)))
        else if (vef <= 6d+56) then
            tmp = ndchar / (1.0d0 + exp((edonor / kbt)))
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
    	double t_0 = NaChar / (1.0 + Math.exp((Vef / KbT)));
    	double tmp;
    	if (Vef <= -4.8e+91) {
    		tmp = t_0;
    	} else if (Vef <= -3.4e-58) {
    		tmp = NdChar / (1.0 + Math.exp((mu / KbT)));
    	} else if (Vef <= 4.7e-38) {
    		tmp = NaChar / (1.0 + Math.exp((EAccept / KbT)));
    	} else if (Vef <= 6e+56) {
    		tmp = NdChar / (1.0 + Math.exp((EDonor / KbT)));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
    	t_0 = NaChar / (1.0 + math.exp((Vef / KbT)))
    	tmp = 0
    	if Vef <= -4.8e+91:
    		tmp = t_0
    	elif Vef <= -3.4e-58:
    		tmp = NdChar / (1.0 + math.exp((mu / KbT)))
    	elif Vef <= 4.7e-38:
    		tmp = NaChar / (1.0 + math.exp((EAccept / KbT)))
    	elif Vef <= 6e+56:
    		tmp = NdChar / (1.0 + math.exp((EDonor / KbT)))
    	else:
    		tmp = t_0
    	return tmp
    
    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	t_0 = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT))))
    	tmp = 0.0
    	if (Vef <= -4.8e+91)
    		tmp = t_0;
    	elseif (Vef <= -3.4e-58)
    		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(mu / KbT))));
    	elseif (Vef <= 4.7e-38)
    		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
    	elseif (Vef <= 6e+56)
    		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(EDonor / KbT))));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
    	t_0 = NaChar / (1.0 + exp((Vef / KbT)));
    	tmp = 0.0;
    	if (Vef <= -4.8e+91)
    		tmp = t_0;
    	elseif (Vef <= -3.4e-58)
    		tmp = NdChar / (1.0 + exp((mu / KbT)));
    	elseif (Vef <= 4.7e-38)
    		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
    	elseif (Vef <= 6e+56)
    		tmp = NdChar / (1.0 + exp((EDonor / KbT)));
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[Vef, -4.8e+91], t$95$0, If[LessEqual[Vef, -3.4e-58], N[(NdChar / N[(1.0 + N[Exp[N[(mu / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 4.7e-38], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[Vef, 6e+56], N[(NdChar / N[(1.0 + N[Exp[N[(EDonor / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
    \mathbf{if}\;Vef \leq -4.8 \cdot 10^{+91}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;Vef \leq -3.4 \cdot 10^{-58}:\\
    \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu}{KbT}}}\\
    
    \mathbf{elif}\;Vef \leq 4.7 \cdot 10^{-38}:\\
    \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
    
    \mathbf{elif}\;Vef \leq 6 \cdot 10^{+56}:\\
    \;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if Vef < -4.79999999999999966e91 or 6.00000000000000012e56 < 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-+.f6470.9

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

        \[\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 rewrites61.1%

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

        if -4.79999999999999966e91 < Vef < -3.39999999999999973e-58

        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.9

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

          \[\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 rewrites57.9%

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

          if -3.39999999999999973e-58 < Vef < 4.69999999999999998e-38

          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-+.f6468.4

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

            \[\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 rewrites46.3%

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

            if 4.69999999999999998e-38 < Vef < 6.00000000000000012e56

            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.6

                \[\leadsto \frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}} \]
            5. Applied rewrites79.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 rewrites66.9%

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

            Alternative 7: 69.0% accurate, 1.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -1.32 \cdot 10^{+114} \lor \neg \left(NdChar \leq 1.15 \cdot 10^{+25}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - 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 (or (<= NdChar -1.32e+114) (not (<= NdChar 1.15e+25)))
               (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor (+ Vef 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 <= -1.32e+114) || !(NdChar <= 1.15e+25)) {
            		tmp = NdChar / (1.0 + exp((((EDonor + (Vef + 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 <= (-1.32d+114)) .or. (.not. (ndchar <= 1.15d+25))) then
                    tmp = ndchar / (1.0d0 + exp((((edonor + (vef + 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 <= -1.32e+114) || !(NdChar <= 1.15e+25)) {
            		tmp = NdChar / (1.0 + Math.exp((((EDonor + (Vef + 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 <= -1.32e+114) or not (NdChar <= 1.15e+25):
            		tmp = NdChar / (1.0 + math.exp((((EDonor + (Vef + 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 <= -1.32e+114) || !(NdChar <= 1.15e+25))
            		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Float64(Vef + 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 <= -1.32e+114) || ~((NdChar <= 1.15e+25)))
            		tmp = NdChar / (1.0 + exp((((EDonor + (Vef + 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[Or[LessEqual[NdChar, -1.32e+114], N[Not[LessEqual[NdChar, 1.15e+25]], $MachinePrecision]], N[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - 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 -1.32 \cdot 10^{+114} \lor \neg \left(NdChar \leq 1.15 \cdot 10^{+25}\right):\\
            \;\;\;\;\frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - 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 2 regimes
            2. if NdChar < -1.3200000000000001e114 or 1.1499999999999999e25 < 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.8

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

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

              if -1.3200000000000001e114 < NdChar < 1.1499999999999999e25

              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-+.f6477.1

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

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

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

            Alternative 8: 61.3% accurate, 1.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -2.1 \cdot 10^{+130} \lor \neg \left(NdChar \leq 2.3 \cdot 10^{+25}\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 (or (<= NdChar -2.1e+130) (not (<= NdChar 2.3e+25)))
               (/ 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.1e+130) || !(NdChar <= 2.3e+25)) {
            		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.1d+130)) .or. (.not. (ndchar <= 2.3d+25))) 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.1e+130) || !(NdChar <= 2.3e+25)) {
            		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.1e+130) or not (NdChar <= 2.3e+25):
            		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.1e+130) || !(NdChar <= 2.3e+25))
            		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.1e+130) || ~((NdChar <= 2.3e+25)))
            		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[Or[LessEqual[NdChar, -2.1e+130], N[Not[LessEqual[NdChar, 2.3e+25]], $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.1 \cdot 10^{+130} \lor \neg \left(NdChar \leq 2.3 \cdot 10^{+25}\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 2 regimes
            2. if NdChar < -2.0999999999999999e130 or 2.2999999999999998e25 < 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.2

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

                \[\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 rewrites64.5%

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

                if -2.0999999999999999e130 < NdChar < 2.2999999999999998e25

                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-+.f6476.9

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;NdChar \leq -2.1 \cdot 10^{+130} \lor \neg \left(NdChar \leq 2.3 \cdot 10^{+25}\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 9: 52.2% accurate, 2.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -2.1 \cdot 10^{+130} \lor \neg \left(NdChar \leq 1.15 \cdot 10^{+25}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\ \end{array} \end{array} \]
              (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
               :precision binary64
               (if (or (<= NdChar -2.1e+130) (not (<= NdChar 1.15e+25)))
                 (/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT))))
                 (/ NaChar (+ 1.0 (exp (/ (- 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.1e+130) || !(NdChar <= 1.15e+25)) {
              		tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
              	} else {
              		tmp = NaChar / (1.0 + exp(((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.1d+130)) .or. (.not. (ndchar <= 1.15d+25))) then
                      tmp = ndchar / (1.0d0 + exp(((mu - ec) / kbt)))
                  else
                      tmp = nachar / (1.0d0 + exp(((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.1e+130) || !(NdChar <= 1.15e+25)) {
              		tmp = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
              	} else {
              		tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
              	}
              	return tmp;
              }
              
              def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
              	tmp = 0
              	if (NdChar <= -2.1e+130) or not (NdChar <= 1.15e+25):
              		tmp = NdChar / (1.0 + math.exp(((mu - Ec) / KbT)))
              	else:
              		tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT)))
              	return tmp
              
              function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
              	tmp = 0.0
              	if ((NdChar <= -2.1e+130) || !(NdChar <= 1.15e+25))
              		tmp = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT))));
              	else
              		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(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.1e+130) || ~((NdChar <= 1.15e+25)))
              		tmp = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
              	else
              		tmp = NaChar / (1.0 + exp(((Vef - mu) / KbT)));
              	end
              	tmp_2 = tmp;
              end
              
              code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -2.1e+130], N[Not[LessEqual[NdChar, 1.15e+25]], $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[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;NdChar \leq -2.1 \cdot 10^{+130} \lor \neg \left(NdChar \leq 1.15 \cdot 10^{+25}\right):\\
              \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if NdChar < -2.0999999999999999e130 or 1.1499999999999999e25 < 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.2

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

                  \[\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 rewrites64.5%

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

                  if -2.0999999999999999e130 < NdChar < 1.1499999999999999e25

                  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-+.f6476.9

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

                    \[\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 rewrites60.1%

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;NdChar \leq -2.1 \cdot 10^{+130} \lor \neg \left(NdChar \leq 1.15 \cdot 10^{+25}\right):\\ \;\;\;\;\frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\ \end{array} \]
                  10. Add Preprocessing

                  Alternative 10: 42.4% accurate, 2.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;EAccept \leq 8.2 \cdot 10^{-286}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\ \mathbf{elif}\;EAccept \leq 1.05 \cdot 10^{+143}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{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 8.2e-286)
                     (/ NaChar (+ 1.0 (exp (/ Ev KbT))))
                     (if (<= EAccept 1.05e+143)
                       (/ NaChar (+ 1.0 (exp (/ (- Vef mu) 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 <= 8.2e-286) {
                  		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                  	} else if (EAccept <= 1.05e+143) {
                  		tmp = NaChar / (1.0 + exp(((Vef - mu) / 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 <= 8.2d-286) then
                          tmp = nachar / (1.0d0 + exp((ev / kbt)))
                      else if (eaccept <= 1.05d+143) then
                          tmp = nachar / (1.0d0 + exp(((vef - mu) / 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 <= 8.2e-286) {
                  		tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
                  	} else if (EAccept <= 1.05e+143) {
                  		tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / 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 <= 8.2e-286:
                  		tmp = NaChar / (1.0 + math.exp((Ev / KbT)))
                  	elif EAccept <= 1.05e+143:
                  		tmp = NaChar / (1.0 + math.exp(((Vef - mu) / 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 <= 8.2e-286)
                  		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))));
                  	elseif (EAccept <= 1.05e+143)
                  		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / 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 <= 8.2e-286)
                  		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                  	elseif (EAccept <= 1.05e+143)
                  		tmp = NaChar / (1.0 + exp(((Vef - mu) / 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, 8.2e-286], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 1.05e+143], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / 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 8.2 \cdot 10^{-286}:\\
                  \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
                  
                  \mathbf{elif}\;EAccept \leq 1.05 \cdot 10^{+143}:\\
                  \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if EAccept < 8.2e-286

                    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-+.f6460.0

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

                      \[\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 rewrites40.1%

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

                      if 8.2e-286 < EAccept < 1.04999999999999994e143

                      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.7

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

                        \[\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 rewrites53.9%

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

                        if 1.04999999999999994e143 < 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-+.f6469.5

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

                          \[\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 rewrites61.3%

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

                        Alternative 11: 39.2% accurate, 2.0× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;EAccept \leq 1.45 \cdot 10^{-285}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\ \mathbf{elif}\;EAccept \leq 3 \cdot 10^{+97}:\\ \;\;\;\;\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 (<= EAccept 1.45e-285)
                           (/ NaChar (+ 1.0 (exp (/ Ev KbT))))
                           (if (<= EAccept 3e+97)
                             (/ 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 (EAccept <= 1.45e-285) {
                        		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                        	} else if (EAccept <= 3e+97) {
                        		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 (eaccept <= 1.45d-285) then
                                tmp = nachar / (1.0d0 + exp((ev / kbt)))
                            else if (eaccept <= 3d+97) 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 (EAccept <= 1.45e-285) {
                        		tmp = NaChar / (1.0 + Math.exp((Ev / KbT)));
                        	} else if (EAccept <= 3e+97) {
                        		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 EAccept <= 1.45e-285:
                        		tmp = NaChar / (1.0 + math.exp((Ev / KbT)))
                        	elif EAccept <= 3e+97:
                        		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 (EAccept <= 1.45e-285)
                        		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))));
                        	elseif (EAccept <= 3e+97)
                        		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 (EAccept <= 1.45e-285)
                        		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                        	elseif (EAccept <= 3e+97)
                        		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[LessEqual[EAccept, 1.45e-285], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[EAccept, 3e+97], 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}\;EAccept \leq 1.45 \cdot 10^{-285}:\\
                        \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
                        
                        \mathbf{elif}\;EAccept \leq 3 \cdot 10^{+97}:\\
                        \;\;\;\;\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 3 regimes
                        2. if EAccept < 1.45e-285

                          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-+.f6460.0

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

                            \[\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 rewrites40.1%

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

                            if 1.45e-285 < EAccept < 2.9999999999999998e97

                            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.2

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

                              \[\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 rewrites46.6%

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

                              if 2.9999999999999998e97 < 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-+.f6469.7

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

                                \[\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 rewrites55.5%

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

                              Alternative 12: 40.5% accurate, 2.0× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{if}\;KbT \leq -4.1 \cdot 10^{+136}:\\ \;\;\;\;\mathsf{fma}\left(-1, NdChar \cdot \left(-0.25 \cdot \frac{Ec}{KbT}\right), t\_0\right)\\ \mathbf{elif}\;KbT \leq 1.6 \cdot 10^{+193}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                              (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                               :precision binary64
                               (let* ((t_0 (fma 0.5 NaChar (* 0.5 NdChar))))
                                 (if (<= KbT -4.1e+136)
                                   (fma -1.0 (* NdChar (* -0.25 (/ Ec KbT))) t_0)
                                   (if (<= KbT 1.6e+193) (/ NaChar (+ 1.0 (exp (/ EAccept KbT)))) t_0))))
                              double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                              	double t_0 = fma(0.5, NaChar, (0.5 * NdChar));
                              	double tmp;
                              	if (KbT <= -4.1e+136) {
                              		tmp = fma(-1.0, (NdChar * (-0.25 * (Ec / KbT))), t_0);
                              	} else if (KbT <= 1.6e+193) {
                              		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                              	} else {
                              		tmp = t_0;
                              	}
                              	return tmp;
                              }
                              
                              function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                              	t_0 = fma(0.5, NaChar, Float64(0.5 * NdChar))
                              	tmp = 0.0
                              	if (KbT <= -4.1e+136)
                              		tmp = fma(-1.0, Float64(NdChar * Float64(-0.25 * Float64(Ec / KbT))), t_0);
                              	elseif (KbT <= 1.6e+193)
                              		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                              	else
                              		tmp = t_0;
                              	end
                              	return tmp
                              end
                              
                              code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -4.1e+136], N[(-1.0 * N[(NdChar * N[(-0.25 * N[(Ec / KbT), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[KbT, 1.6e+193], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
                              \mathbf{if}\;KbT \leq -4.1 \cdot 10^{+136}:\\
                              \;\;\;\;\mathsf{fma}\left(-1, NdChar \cdot \left(-0.25 \cdot \frac{Ec}{KbT}\right), t\_0\right)\\
                              
                              \mathbf{elif}\;KbT \leq 1.6 \cdot 10^{+193}:\\
                              \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_0\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if KbT < -4.0999999999999998e136

                                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}{-1 \cdot \frac{\frac{1}{4} \cdot \left(NaChar \cdot \left(\left(EAccept + \left(Ev + Vef\right)\right) - mu\right)\right) + \frac{1}{4} \cdot \left(NdChar \cdot \left(\left(EDonor + \left(Vef + mu\right)\right) - Ec\right)\right)}{KbT} + \left(\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar\right)} \]
                                4. Step-by-step derivation
                                  1. lower-fma.f64N/A

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(-1, NdChar \cdot \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}\right), \mathsf{fma}\left(\frac{1}{2}, NaChar, \frac{1}{2} \cdot NdChar\right)\right) \]
                                  3. times-fracN/A

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(-1, NdChar \cdot \left(\frac{-1}{4} \cdot \frac{Ec}{KbT}\right), \mathsf{fma}\left(\frac{1}{2}, NaChar, \frac{1}{2} \cdot NdChar\right)\right) \]
                                  2. lower-/.f6468.8

                                    \[\leadsto \mathsf{fma}\left(-1, NdChar \cdot \left(-0.25 \cdot \frac{Ec}{KbT}\right), \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\right) \]
                                11. Applied rewrites68.8%

                                  \[\leadsto \mathsf{fma}\left(-1, NdChar \cdot \left(-0.25 \cdot \frac{Ec}{\color{blue}{KbT}}\right), \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\right) \]

                                if -4.0999999999999998e136 < KbT < 1.60000000000000007e193

                                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.9

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

                                  \[\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.2%

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

                                  if 1.60000000000000007e193 < 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-*.f6471.0

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

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)} \]
                                8. Recombined 3 regimes into one program.
                                9. Add Preprocessing

                                Alternative 13: 37.9% accurate, 2.1× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;Ev \leq -1.65 \cdot 10^{+112}:\\ \;\;\;\;\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 (<= Ev -1.65e+112)
                                   (/ 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 (Ev <= -1.65e+112) {
                                		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 (ev <= (-1.65d+112)) 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 (Ev <= -1.65e+112) {
                                		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 Ev <= -1.65e+112:
                                		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 (Ev <= -1.65e+112)
                                		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 (Ev <= -1.65e+112)
                                		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[Ev, -1.65e+112], 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}\;Ev \leq -1.65 \cdot 10^{+112}:\\
                                \;\;\;\;\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 Ev < -1.64999999999999995e112

                                  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-+.f6464.5

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

                                    \[\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 rewrites59.3%

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

                                    if -1.64999999999999995e112 < Ev

                                    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-+.f6463.5

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

                                      \[\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.5%

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

                                    Alternative 14: 22.4% accurate, 15.3× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NdChar \leq -1.02 \cdot 10^{+116} \lor \neg \left(NdChar \leq 2.3 \cdot 10^{+25}\right):\\ \;\;\;\;0.5 \cdot NdChar\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot NaChar\\ \end{array} \end{array} \]
                                    (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
                                     :precision binary64
                                     (if (or (<= NdChar -1.02e+116) (not (<= NdChar 2.3e+25)))
                                       (* 0.5 NdChar)
                                       (* 0.5 NaChar)))
                                    double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                    	double tmp;
                                    	if ((NdChar <= -1.02e+116) || !(NdChar <= 2.3e+25)) {
                                    		tmp = 0.5 * NdChar;
                                    	} else {
                                    		tmp = 0.5 * NaChar;
                                    	}
                                    	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 <= (-1.02d+116)) .or. (.not. (ndchar <= 2.3d+25))) then
                                            tmp = 0.5d0 * ndchar
                                        else
                                            tmp = 0.5d0 * nachar
                                        end if
                                        code = tmp
                                    end function
                                    
                                    public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                    	double tmp;
                                    	if ((NdChar <= -1.02e+116) || !(NdChar <= 2.3e+25)) {
                                    		tmp = 0.5 * NdChar;
                                    	} else {
                                    		tmp = 0.5 * NaChar;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
                                    	tmp = 0
                                    	if (NdChar <= -1.02e+116) or not (NdChar <= 2.3e+25):
                                    		tmp = 0.5 * NdChar
                                    	else:
                                    		tmp = 0.5 * NaChar
                                    	return tmp
                                    
                                    function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                    	tmp = 0.0
                                    	if ((NdChar <= -1.02e+116) || !(NdChar <= 2.3e+25))
                                    		tmp = Float64(0.5 * NdChar);
                                    	else
                                    		tmp = Float64(0.5 * NaChar);
                                    	end
                                    	return tmp
                                    end
                                    
                                    function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                    	tmp = 0.0;
                                    	if ((NdChar <= -1.02e+116) || ~((NdChar <= 2.3e+25)))
                                    		tmp = 0.5 * NdChar;
                                    	else
                                    		tmp = 0.5 * NaChar;
                                    	end
                                    	tmp_2 = tmp;
                                    end
                                    
                                    code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[Or[LessEqual[NdChar, -1.02e+116], N[Not[LessEqual[NdChar, 2.3e+25]], $MachinePrecision]], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;NdChar \leq -1.02 \cdot 10^{+116} \lor \neg \left(NdChar \leq 2.3 \cdot 10^{+25}\right):\\
                                    \;\;\;\;0.5 \cdot NdChar\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;0.5 \cdot NaChar\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if NdChar < -1.0199999999999999e116 or 2.2999999999999998e25 < 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.8

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

                                        \[\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{1}{2} \cdot \color{blue}{NdChar} \]
                                      7. Step-by-step derivation
                                        1. lift-*.f6425.6

                                          \[\leadsto 0.5 \cdot NdChar \]
                                      8. Applied rewrites25.6%

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

                                      if -1.0199999999999999e116 < NdChar < 2.2999999999999998e25

                                      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-+.f6477.1

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

                                        \[\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-*.f6426.5

                                          \[\leadsto 0.5 \cdot NaChar \]
                                      8. Applied rewrites26.5%

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

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

                                    Alternative 15: 27.6% 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-*.f6428.9

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

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

                                    Alternative 16: 18.1% accurate, 46.0× speedup?

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

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

                                      \[\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-*.f6420.3

                                        \[\leadsto 0.5 \cdot NaChar \]
                                    8. Applied rewrites20.3%

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

                                    Reproduce

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