Bulmash initializePoisson

Percentage Accurate: 100.0% → 100.0%
Time: 6.2s
Alternatives: 15
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (+
  (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
  (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}} \end{array} \]
(FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
 :precision binary64
 (+
  (/ NdChar (+ 1.0 (exp (/ (- (- (- (- Ec Vef) EDonor) mu)) KbT))))
  (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT))))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	return (NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)))) + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
}
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) + \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}
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

Alternative 2: 78.9% accurate, 1.0× 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{Vef}{KbT}}}\\ \mathbf{if}\;Vef \leq -1.75 \cdot 10^{+117}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;Vef \leq 4.9 \cdot 10^{-165}:\\ \;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \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 (/ Vef KbT)))))))
   (if (<= Vef -1.75e+117)
     t_1
     (if (<= Vef 4.9e-165) (+ t_0 (/ NaChar (+ 1.0 (exp (/ Ev KbT))))) t_1))))
double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
	double t_1 = t_0 + (NaChar / (1.0 + exp((Vef / KbT))));
	double tmp;
	if (Vef <= -1.75e+117) {
		tmp = t_1;
	} else if (Vef <= 4.9e-165) {
		tmp = t_0 + (NaChar / (1.0 + exp((Ev / KbT))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
use fmin_fmax_functions
    real(8), intent (in) :: ndchar
    real(8), intent (in) :: ec
    real(8), intent (in) :: vef
    real(8), intent (in) :: edonor
    real(8), intent (in) :: mu
    real(8), intent (in) :: kbt
    real(8), intent (in) :: nachar
    real(8), intent (in) :: ev
    real(8), intent (in) :: eaccept
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
    t_1 = t_0 + (nachar / (1.0d0 + exp((vef / kbt))))
    if (vef <= (-1.75d+117)) then
        tmp = t_1
    else if (vef <= 4.9d-165) then
        tmp = t_0 + (nachar / (1.0d0 + exp((ev / kbt))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
	double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
	double t_1 = t_0 + (NaChar / (1.0 + Math.exp((Vef / KbT))));
	double tmp;
	if (Vef <= -1.75e+117) {
		tmp = t_1;
	} else if (Vef <= 4.9e-165) {
		tmp = t_0 + (NaChar / (1.0 + Math.exp((Ev / KbT))));
	} else {
		tmp = t_1;
	}
	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((Vef / KbT))))
	tmp = 0
	if Vef <= -1.75e+117:
		tmp = t_1
	elif Vef <= 4.9e-165:
		tmp = t_0 + (NaChar / (1.0 + math.exp((Ev / KbT))))
	else:
		tmp = t_1
	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(Vef / KbT)))))
	tmp = 0.0
	if (Vef <= -1.75e+117)
		tmp = t_1;
	elseif (Vef <= 4.9e-165)
		tmp = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT)))));
	else
		tmp = t_1;
	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((Vef / KbT))));
	tmp = 0.0;
	if (Vef <= -1.75e+117)
		tmp = t_1;
	elseif (Vef <= 4.9e-165)
		tmp = t_0 + (NaChar / (1.0 + exp((Ev / KbT))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(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[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[Vef, -1.75e+117], t$95$1, If[LessEqual[Vef, 4.9e-165], N[(t$95$0 + N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\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{Vef}{KbT}}}\\
\mathbf{if}\;Vef \leq -1.75 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;Vef \leq 4.9 \cdot 10^{-165}:\\
\;\;\;\;t\_0 + \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if Vef < -1.74999999999999991e117 or 4.8999999999999996e-165 < 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. 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}}} \]
    3. Step-by-step derivation
      1. Applied rewrites77.6%

        \[\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 -1.74999999999999991e117 < Vef < 4.8999999999999996e-165

      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. Taylor expanded in Ev 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}{Ev}}{KbT}}} \]
      3. Step-by-step derivation
        1. Applied rewrites74.4%

          \[\leadsto \frac{NdChar}{1 + e^{\frac{-\left(\left(\left(Ec - Vef\right) - EDonor\right) - mu\right)}{KbT}}} + \frac{NaChar}{1 + e^{\frac{\color{blue}{Ev}}{KbT}}} \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 3: 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{Ev}{KbT}}}\\ t_2 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-200}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-304}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \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 KbT))))))
              (t_2
               (+
                t_0
                (/ NaChar (+ 1.0 (exp (/ (+ (+ (+ Ev Vef) EAccept) (- mu)) KbT)))))))
         (if (<= t_2 -5e-200)
           t_1
           (if (<= t_2 4e-304)
             (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) KbT))))
             t_1))))
      double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
      	double t_0 = NdChar / (1.0 + exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
      	double t_1 = t_0 + (NaChar / (1.0 + exp((Ev / KbT))));
      	double t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
      	double tmp;
      	if (t_2 <= -5e-200) {
      		tmp = t_1;
      	} else if (t_2 <= 4e-304) {
      		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(ndchar, ec, vef, edonor, mu, kbt, nachar, ev, eaccept)
      use fmin_fmax_functions
          real(8), intent (in) :: ndchar
          real(8), intent (in) :: ec
          real(8), intent (in) :: vef
          real(8), intent (in) :: edonor
          real(8), intent (in) :: mu
          real(8), intent (in) :: kbt
          real(8), intent (in) :: nachar
          real(8), intent (in) :: ev
          real(8), intent (in) :: eaccept
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: t_2
          real(8) :: tmp
          t_0 = ndchar / (1.0d0 + exp((-(((ec - vef) - edonor) - mu) / kbt)))
          t_1 = t_0 + (nachar / (1.0d0 + exp((ev / kbt))))
          t_2 = t_0 + (nachar / (1.0d0 + exp(((((ev + vef) + eaccept) + -mu) / kbt))))
          if (t_2 <= (-5d-200)) then
              tmp = t_1
          else if (t_2 <= 4d-304) then
              tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / kbt)))
          else
              tmp = t_1
          end if
          code = tmp
      end function
      
      public static double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
      	double t_0 = NdChar / (1.0 + Math.exp((-(((Ec - Vef) - EDonor) - mu) / KbT)));
      	double t_1 = t_0 + (NaChar / (1.0 + Math.exp((Ev / KbT))));
      	double t_2 = t_0 + (NaChar / (1.0 + Math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
      	double tmp;
      	if (t_2 <= -5e-200) {
      		tmp = t_1;
      	} else if (t_2 <= 4e-304) {
      		tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
      	} else {
      		tmp = t_1;
      	}
      	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 / KbT))))
      	t_2 = t_0 + (NaChar / (1.0 + math.exp(((((Ev + Vef) + EAccept) + -mu) / KbT))))
      	tmp = 0
      	if t_2 <= -5e-200:
      		tmp = t_1
      	elif t_2 <= 4e-304:
      		tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)))
      	else:
      		tmp = t_1
      	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(Ev / KbT)))))
      	t_2 = Float64(t_0 + Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(Float64(Ev + Vef) + EAccept) + Float64(-mu)) / KbT)))))
      	tmp = 0.0
      	if (t_2 <= -5e-200)
      		tmp = t_1;
      	elseif (t_2 <= 4e-304)
      		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT))));
      	else
      		tmp = t_1;
      	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 / KbT))));
      	t_2 = t_0 + (NaChar / (1.0 + exp(((((Ev + Vef) + EAccept) + -mu) / KbT))));
      	tmp = 0.0;
      	if (t_2 <= -5e-200)
      		tmp = t_1;
      	elseif (t_2 <= 4e-304)
      		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(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[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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[LessEqual[t$95$2, -5e-200], t$95$1, If[LessEqual[t$95$2, 4e-304], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
      
      \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{Ev}{KbT}}}\\
      t_2 := t\_0 + \frac{NaChar}{1 + e^{\frac{\left(\left(Ev + Vef\right) + EAccept\right) + \left(-mu\right)}{KbT}}}\\
      \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-200}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-304}:\\
      \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT))))) < -4.99999999999999991e-200 or 3.99999999999999988e-304 < (+.f64 (/.f64 NdChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (neg.f64 (-.f64 (-.f64 (-.f64 Ec Vef) EDonor) mu)) KbT)))) (/.f64 NaChar (+.f64 #s(literal 1 binary64) (exp.f64 (/.f64 (+.f64 (+.f64 (+.f64 Ev Vef) EAccept) (neg.f64 mu)) KbT)))))

        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. Taylor expanded in Ev 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}{Ev}}{KbT}}} \]
        3. Step-by-step derivation
          1. Applied rewrites75.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}{Ev}}{KbT}}} \]

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

          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. Taylor expanded in NdChar around 0

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

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

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

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

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

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

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

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

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

        Alternative 4: 69.9% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\ \mathbf{if}\;NdChar \leq -9.6 \cdot 10^{+62}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NdChar \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
         :precision binary64
         (let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- (+ EDonor (+ Vef mu)) Ec) KbT))))))
           (if (<= NdChar -9.6e+62)
             t_0
             (if (<= NdChar 2e+15)
               (/ NaChar (+ 1.0 (exp (/ (- (+ EAccept (+ Ev Vef)) mu) 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 = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
        	double tmp;
        	if (NdChar <= -9.6e+62) {
        		tmp = t_0;
        	} else if (NdChar <= 2e+15) {
        		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / 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 = ndchar / (1.0d0 + exp((((edonor + (vef + mu)) - ec) / kbt)))
            if (ndchar <= (-9.6d+62)) then
                tmp = t_0
            else if (ndchar <= 2d+15) then
                tmp = nachar / (1.0d0 + exp((((eaccept + (ev + vef)) - mu) / 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 = NdChar / (1.0 + Math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
        	double tmp;
        	if (NdChar <= -9.6e+62) {
        		tmp = t_0;
        	} else if (NdChar <= 2e+15) {
        		tmp = NaChar / (1.0 + Math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
        	t_0 = NdChar / (1.0 + math.exp((((EDonor + (Vef + mu)) - Ec) / KbT)))
        	tmp = 0
        	if NdChar <= -9.6e+62:
        		tmp = t_0
        	elif NdChar <= 2e+15:
        		tmp = NaChar / (1.0 + math.exp((((EAccept + (Ev + Vef)) - mu) / KbT)))
        	else:
        		tmp = t_0
        	return tmp
        
        function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
        	t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(Float64(EDonor + Float64(Vef + mu)) - Ec) / KbT))))
        	tmp = 0.0
        	if (NdChar <= -9.6e+62)
        		tmp = t_0;
        	elseif (NdChar <= 2e+15)
        		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Float64(EAccept + Float64(Ev + Vef)) - mu) / KbT))));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
        	t_0 = NdChar / (1.0 + exp((((EDonor + (Vef + mu)) - Ec) / KbT)));
        	tmp = 0.0;
        	if (NdChar <= -9.6e+62)
        		tmp = t_0;
        	elseif (NdChar <= 2e+15)
        		tmp = NaChar / (1.0 + exp((((EAccept + (Ev + Vef)) - mu) / 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[(NdChar / N[(1.0 + N[Exp[N[(N[(N[(EDonor + N[(Vef + mu), $MachinePrecision]), $MachinePrecision] - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NdChar, -9.6e+62], t$95$0, If[LessEqual[NdChar, 2e+15], N[(NaChar / N[(1.0 + N[Exp[N[(N[(N[(EAccept + N[(Ev + Vef), $MachinePrecision]), $MachinePrecision] - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{NdChar}{1 + e^{\frac{\left(EDonor + \left(Vef + mu\right)\right) - Ec}{KbT}}}\\
        \mathbf{if}\;NdChar \leq -9.6 \cdot 10^{+62}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;NdChar \leq 2 \cdot 10^{+15}:\\
        \;\;\;\;\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if NdChar < -9.6e62 or 2e15 < 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. Taylor expanded in NdChar around inf

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

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

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

          if -9.6e62 < NdChar < 2e15

          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. Taylor expanded in NdChar around 0

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

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

            \[\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. Add Preprocessing

        Alternative 5: 63.0% accurate, 1.5× speedup?

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

          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. Taylor expanded in NdChar around 0

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

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

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

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

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

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

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

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

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

          if -1.05000000000000003e284 < NdChar < -1.4500000000000001e90 or 2.1999999999999999e122 < 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. Taylor expanded in NdChar around inf

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 6: 53.1% accurate, 2.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\ \mathbf{if}\;NdChar \leq -3.2 \cdot 10^{+85}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NdChar \leq 2.1 \cdot 10^{+122}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
           :precision binary64
           (let* ((t_0 (/ NdChar (+ 1.0 (exp (/ (- mu Ec) KbT))))))
             (if (<= NdChar -3.2e+85)
               t_0
               (if (<= NdChar 2.1e+122)
                 (/ NaChar (+ 1.0 (exp (/ (- Vef mu) 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 = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
          	double tmp;
          	if (NdChar <= -3.2e+85) {
          		tmp = t_0;
          	} else if (NdChar <= 2.1e+122) {
          		tmp = NaChar / (1.0 + exp(((Vef - mu) / 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 = ndchar / (1.0d0 + exp(((mu - ec) / kbt)))
              if (ndchar <= (-3.2d+85)) then
                  tmp = t_0
              else if (ndchar <= 2.1d+122) then
                  tmp = nachar / (1.0d0 + exp(((vef - mu) / 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 = NdChar / (1.0 + Math.exp(((mu - Ec) / KbT)));
          	double tmp;
          	if (NdChar <= -3.2e+85) {
          		tmp = t_0;
          	} else if (NdChar <= 2.1e+122) {
          		tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
          	t_0 = NdChar / (1.0 + math.exp(((mu - Ec) / KbT)))
          	tmp = 0
          	if NdChar <= -3.2e+85:
          		tmp = t_0
          	elif NdChar <= 2.1e+122:
          		tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT)))
          	else:
          		tmp = t_0
          	return tmp
          
          function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
          	t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Float64(mu - Ec) / KbT))))
          	tmp = 0.0
          	if (NdChar <= -3.2e+85)
          		tmp = t_0;
          	elseif (NdChar <= 2.1e+122)
          		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT))));
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
          	t_0 = NdChar / (1.0 + exp(((mu - Ec) / KbT)));
          	tmp = 0.0;
          	if (NdChar <= -3.2e+85)
          		tmp = t_0;
          	elseif (NdChar <= 2.1e+122)
          		tmp = NaChar / (1.0 + exp(((Vef - mu) / 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[(NdChar / N[(1.0 + N[Exp[N[(N[(mu - Ec), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NdChar, -3.2e+85], t$95$0, If[LessEqual[NdChar, 2.1e+122], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{NdChar}{1 + e^{\frac{mu - Ec}{KbT}}}\\
          \mathbf{if}\;NdChar \leq -3.2 \cdot 10^{+85}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;NdChar \leq 2.1 \cdot 10^{+122}:\\
          \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if NdChar < -3.20000000000000018e85 or 2.10000000000000016e122 < 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. Taylor expanded in NdChar around inf

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

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

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

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

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

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

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

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

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

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

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

              if -3.20000000000000018e85 < NdChar < 2.10000000000000016e122

              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. Taylor expanded in NdChar around 0

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}} \]
              7. Recombined 2 regimes into one program.
              8. Add Preprocessing

              Alternative 7: 49.6% accurate, 2.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{if}\;NdChar \leq -4.4 \cdot 10^{+63}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NdChar \leq 9.6 \cdot 10^{-45}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (NdChar Ec Vef EDonor mu KbT NaChar Ev EAccept)
               :precision binary64
               (let* ((t_0 (/ NdChar (+ 1.0 (exp (/ Vef KbT))))))
                 (if (<= NdChar -4.4e+63)
                   t_0
                   (if (<= NdChar 9.6e-45)
                     (/ NaChar (+ 1.0 (exp (/ (- Vef mu) 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 = NdChar / (1.0 + exp((Vef / KbT)));
              	double tmp;
              	if (NdChar <= -4.4e+63) {
              		tmp = t_0;
              	} else if (NdChar <= 9.6e-45) {
              		tmp = NaChar / (1.0 + exp(((Vef - mu) / 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 = ndchar / (1.0d0 + exp((vef / kbt)))
                  if (ndchar <= (-4.4d+63)) then
                      tmp = t_0
                  else if (ndchar <= 9.6d-45) then
                      tmp = nachar / (1.0d0 + exp(((vef - mu) / 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 = NdChar / (1.0 + Math.exp((Vef / KbT)));
              	double tmp;
              	if (NdChar <= -4.4e+63) {
              		tmp = t_0;
              	} else if (NdChar <= 9.6e-45) {
              		tmp = NaChar / (1.0 + Math.exp(((Vef - mu) / KbT)));
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept):
              	t_0 = NdChar / (1.0 + math.exp((Vef / KbT)))
              	tmp = 0
              	if NdChar <= -4.4e+63:
              		tmp = t_0
              	elif NdChar <= 9.6e-45:
              		tmp = NaChar / (1.0 + math.exp(((Vef - mu) / KbT)))
              	else:
              		tmp = t_0
              	return tmp
              
              function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
              	t_0 = Float64(NdChar / Float64(1.0 + exp(Float64(Vef / KbT))))
              	tmp = 0.0
              	if (NdChar <= -4.4e+63)
              		tmp = t_0;
              	elseif (NdChar <= 9.6e-45)
              		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Float64(Vef - mu) / KbT))));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
              	t_0 = NdChar / (1.0 + exp((Vef / KbT)));
              	tmp = 0.0;
              	if (NdChar <= -4.4e+63)
              		tmp = t_0;
              	elseif (NdChar <= 9.6e-45)
              		tmp = NaChar / (1.0 + exp(((Vef - mu) / 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[(NdChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[NdChar, -4.4e+63], t$95$0, If[LessEqual[NdChar, 9.6e-45], N[(NaChar / N[(1.0 + N[Exp[N[(N[(Vef - mu), $MachinePrecision] / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{NdChar}{1 + e^{\frac{Vef}{KbT}}}\\
              \mathbf{if}\;NdChar \leq -4.4 \cdot 10^{+63}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;NdChar \leq 9.6 \cdot 10^{-45}:\\
              \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if NdChar < -4.3999999999999997e63 or 9.5999999999999996e-45 < 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. Taylor expanded in NdChar around inf

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

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

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

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

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

                  if -4.3999999999999997e63 < NdChar < 9.5999999999999996e-45

                  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. Taylor expanded in NdChar around 0

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

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

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

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

                      \[\leadsto \frac{NaChar}{1 + e^{\frac{Vef - mu}{KbT}}} \]
                  7. Recombined 2 regimes into one program.
                  8. Add Preprocessing

                  Alternative 8: 43.6% accurate, 1.9× speedup?

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

                    1. Initial program 100.0%

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

                      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                    3. 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.8

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

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

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

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

                      if -2.2e16 < NaChar < 6.09999999999999999e-254

                      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. Taylor expanded in NdChar around inf

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

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

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

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

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

                        if 6.09999999999999999e-254 < NaChar < 8.19999999999999956e64

                        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. Taylor expanded in NdChar around inf

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

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

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

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

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

                        Alternative 9: 42.5% accurate, 2.2× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{if}\;NaChar \leq -2.2 \cdot 10^{+16}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;NaChar \leq 1.45 \cdot 10^{-229}:\\ \;\;\;\;\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 (<= NaChar -2.2e+16)
                             t_0
                             (if (<= NaChar 1.45e-229) (/ 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 (NaChar <= -2.2e+16) {
                        		tmp = t_0;
                        	} else if (NaChar <= 1.45e-229) {
                        		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 (nachar <= (-2.2d+16)) then
                                tmp = t_0
                            else if (nachar <= 1.45d-229) 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 (NaChar <= -2.2e+16) {
                        		tmp = t_0;
                        	} else if (NaChar <= 1.45e-229) {
                        		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 NaChar <= -2.2e+16:
                        		tmp = t_0
                        	elif NaChar <= 1.45e-229:
                        		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 (NaChar <= -2.2e+16)
                        		tmp = t_0;
                        	elseif (NaChar <= 1.45e-229)
                        		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 (NaChar <= -2.2e+16)
                        		tmp = t_0;
                        	elseif (NaChar <= 1.45e-229)
                        		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[NaChar, -2.2e+16], t$95$0, If[LessEqual[NaChar, 1.45e-229], 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}\;NaChar \leq -2.2 \cdot 10^{+16}:\\
                        \;\;\;\;t\_0\\
                        
                        \mathbf{elif}\;NaChar \leq 1.45 \cdot 10^{-229}:\\
                        \;\;\;\;\frac{NdChar}{1 + e^{\frac{EDonor}{KbT}}}\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;t\_0\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if NaChar < -2.2e16 or 1.45e-229 < NaChar

                          1. Initial program 100.0%

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

                            \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                          3. 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-+.f6465.8

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

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

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

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

                            if -2.2e16 < NaChar < 1.45e-229

                            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. Taylor expanded in NdChar around inf

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

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

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

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

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

                            Alternative 10: 42.1% accurate, 1.9× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{if}\;KbT \leq -7.2 \cdot 10^{+165}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq 1.02 \cdot 10^{-212}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\ \mathbf{elif}\;KbT \leq 3.7 \cdot 10^{+141}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{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 -7.2e+165)
                                 t_0
                                 (if (<= KbT 1.02e-212)
                                   (/ NaChar (+ 1.0 (exp (/ Vef KbT))))
                                   (if (<= KbT 3.7e+141) (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) t_0)))))
                            double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                            	double t_0 = fma(0.5, NaChar, (0.5 * NdChar));
                            	double tmp;
                            	if (KbT <= -7.2e+165) {
                            		tmp = t_0;
                            	} else if (KbT <= 1.02e-212) {
                            		tmp = NaChar / (1.0 + exp((Vef / KbT)));
                            	} else if (KbT <= 3.7e+141) {
                            		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                            	} else {
                            		tmp = t_0;
                            	}
                            	return tmp;
                            }
                            
                            function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                            	t_0 = fma(0.5, NaChar, Float64(0.5 * NdChar))
                            	tmp = 0.0
                            	if (KbT <= -7.2e+165)
                            		tmp = t_0;
                            	elseif (KbT <= 1.02e-212)
                            		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Vef / KbT))));
                            	elseif (KbT <= 3.7e+141)
                            		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))));
                            	else
                            		tmp = t_0;
                            	end
                            	return tmp
                            end
                            
                            code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -7.2e+165], t$95$0, If[LessEqual[KbT, 1.02e-212], N[(NaChar / N[(1.0 + N[Exp[N[(Vef / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 3.7e+141], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
                            \mathbf{if}\;KbT \leq -7.2 \cdot 10^{+165}:\\
                            \;\;\;\;t\_0\\
                            
                            \mathbf{elif}\;KbT \leq 1.02 \cdot 10^{-212}:\\
                            \;\;\;\;\frac{NaChar}{1 + e^{\frac{Vef}{KbT}}}\\
                            
                            \mathbf{elif}\;KbT \leq 3.7 \cdot 10^{+141}:\\
                            \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;t\_0\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if KbT < -7.1999999999999996e165 or 3.7000000000000003e141 < KbT

                              1. Initial program 99.9%

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

                                \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
                              3. 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-*.f6462.1

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

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

                              if -7.1999999999999996e165 < KbT < 1.0199999999999999e-212

                              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. Taylor expanded in NdChar around 0

                                \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                              3. 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}}} \]
                              4. Applied rewrites63.6%

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

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

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

                                if 1.0199999999999999e-212 < KbT < 3.7000000000000003e141

                                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. Taylor expanded in NdChar around 0

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

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

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

                                  \[\leadsto \frac{NaChar}{1 + e^{\frac{Ev}{KbT}}} \]
                                6. Step-by-step derivation
                                  1. Applied rewrites32.4%

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

                                Alternative 11: 41.3% accurate, 1.9× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{if}\;KbT \leq -7.5 \cdot 10^{+100}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq -1 \cdot 10^{-301}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\ \mathbf{elif}\;KbT \leq 3.7 \cdot 10^{+141}:\\ \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{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 -7.5e+100)
                                     t_0
                                     (if (<= KbT -1e-301)
                                       (/ NaChar (+ 1.0 (exp (/ EAccept KbT))))
                                       (if (<= KbT 3.7e+141) (/ NaChar (+ 1.0 (exp (/ Ev KbT)))) t_0)))))
                                double code(double NdChar, double Ec, double Vef, double EDonor, double mu, double KbT, double NaChar, double Ev, double EAccept) {
                                	double t_0 = fma(0.5, NaChar, (0.5 * NdChar));
                                	double tmp;
                                	if (KbT <= -7.5e+100) {
                                		tmp = t_0;
                                	} else if (KbT <= -1e-301) {
                                		tmp = NaChar / (1.0 + exp((EAccept / KbT)));
                                	} else if (KbT <= 3.7e+141) {
                                		tmp = NaChar / (1.0 + exp((Ev / KbT)));
                                	} else {
                                		tmp = t_0;
                                	}
                                	return tmp;
                                }
                                
                                function code(NdChar, Ec, Vef, EDonor, mu, KbT, NaChar, Ev, EAccept)
                                	t_0 = fma(0.5, NaChar, Float64(0.5 * NdChar))
                                	tmp = 0.0
                                	if (KbT <= -7.5e+100)
                                		tmp = t_0;
                                	elseif (KbT <= -1e-301)
                                		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(EAccept / KbT))));
                                	elseif (KbT <= 3.7e+141)
                                		tmp = Float64(NaChar / Float64(1.0 + exp(Float64(Ev / KbT))));
                                	else
                                		tmp = t_0;
                                	end
                                	return tmp
                                end
                                
                                code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := Block[{t$95$0 = N[(0.5 * NaChar + N[(0.5 * NdChar), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[KbT, -7.5e+100], t$95$0, If[LessEqual[KbT, -1e-301], N[(NaChar / N[(1.0 + N[Exp[N[(EAccept / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[KbT, 3.7e+141], N[(NaChar / N[(1.0 + N[Exp[N[(Ev / KbT), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\
                                \mathbf{if}\;KbT \leq -7.5 \cdot 10^{+100}:\\
                                \;\;\;\;t\_0\\
                                
                                \mathbf{elif}\;KbT \leq -1 \cdot 10^{-301}:\\
                                \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                                
                                \mathbf{elif}\;KbT \leq 3.7 \cdot 10^{+141}:\\
                                \;\;\;\;\frac{NaChar}{1 + e^{\frac{Ev}{KbT}}}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_0\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if KbT < -7.49999999999999983e100 or 3.7000000000000003e141 < KbT

                                  1. Initial program 99.9%

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

                                    \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
                                  3. 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-*.f6456.6

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

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

                                  if -7.49999999999999983e100 < KbT < -1.00000000000000007e-301

                                  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. Taylor expanded in NdChar around 0

                                    \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                  3. 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}}} \]
                                  4. Applied rewrites63.5%

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

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

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

                                    if -1.00000000000000007e-301 < KbT < 3.7000000000000003e141

                                    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. Taylor expanded in NdChar around 0

                                      \[\leadsto \color{blue}{\frac{NaChar}{1 + e^{\frac{\left(EAccept + \left(Ev + Vef\right)\right) - mu}{KbT}}}} \]
                                    3. 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.0

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

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

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

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

                                    Alternative 12: 40.7% accurate, 2.2× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(0.5, NaChar, 0.5 \cdot NdChar\right)\\ \mathbf{if}\;KbT \leq -7.5 \cdot 10^{+100}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;KbT \leq 1.15 \cdot 10^{+121}:\\ \;\;\;\;\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 -7.5e+100)
                                         t_0
                                         (if (<= KbT 1.15e+121) (/ 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 <= -7.5e+100) {
                                    		tmp = t_0;
                                    	} else if (KbT <= 1.15e+121) {
                                    		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 <= -7.5e+100)
                                    		tmp = t_0;
                                    	elseif (KbT <= 1.15e+121)
                                    		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, -7.5e+100], t$95$0, If[LessEqual[KbT, 1.15e+121], 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 -7.5 \cdot 10^{+100}:\\
                                    \;\;\;\;t\_0\\
                                    
                                    \mathbf{elif}\;KbT \leq 1.15 \cdot 10^{+121}:\\
                                    \;\;\;\;\frac{NaChar}{1 + e^{\frac{EAccept}{KbT}}}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;t\_0\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if KbT < -7.49999999999999983e100 or 1.1499999999999999e121 < KbT

                                      1. Initial program 99.9%

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

                                        \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
                                      3. Step-by-step derivation
                                        1. lower-fma.f64N/A

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

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

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

                                      if -7.49999999999999983e100 < KbT < 1.1499999999999999e121

                                      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. Taylor expanded in NdChar around 0

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

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

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

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

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

                                      Alternative 13: 27.3% accurate, 6.8× 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. Taylor expanded in KbT around inf

                                        \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
                                      3. Step-by-step derivation
                                        1. lower-fma.f64N/A

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

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

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

                                      Alternative 14: 22.3% accurate, 5.3× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;NaChar \leq -2.9 \cdot 10^{+16}:\\ \;\;\;\;0.5 \cdot NaChar\\ \mathbf{elif}\;NaChar \leq 7.6 \cdot 10^{+64}:\\ \;\;\;\;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 (<= NaChar -2.9e+16)
                                         (* 0.5 NaChar)
                                         (if (<= NaChar 7.6e+64) (* 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 (NaChar <= -2.9e+16) {
                                      		tmp = 0.5 * NaChar;
                                      	} else if (NaChar <= 7.6e+64) {
                                      		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 (nachar <= (-2.9d+16)) then
                                              tmp = 0.5d0 * nachar
                                          else if (nachar <= 7.6d+64) 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 (NaChar <= -2.9e+16) {
                                      		tmp = 0.5 * NaChar;
                                      	} else if (NaChar <= 7.6e+64) {
                                      		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 NaChar <= -2.9e+16:
                                      		tmp = 0.5 * NaChar
                                      	elif NaChar <= 7.6e+64:
                                      		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 (NaChar <= -2.9e+16)
                                      		tmp = Float64(0.5 * NaChar);
                                      	elseif (NaChar <= 7.6e+64)
                                      		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 (NaChar <= -2.9e+16)
                                      		tmp = 0.5 * NaChar;
                                      	elseif (NaChar <= 7.6e+64)
                                      		tmp = 0.5 * NdChar;
                                      	else
                                      		tmp = 0.5 * NaChar;
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      code[NdChar_, Ec_, Vef_, EDonor_, mu_, KbT_, NaChar_, Ev_, EAccept_] := If[LessEqual[NaChar, -2.9e+16], N[(0.5 * NaChar), $MachinePrecision], If[LessEqual[NaChar, 7.6e+64], N[(0.5 * NdChar), $MachinePrecision], N[(0.5 * NaChar), $MachinePrecision]]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;NaChar \leq -2.9 \cdot 10^{+16}:\\
                                      \;\;\;\;0.5 \cdot NaChar\\
                                      
                                      \mathbf{elif}\;NaChar \leq 7.6 \cdot 10^{+64}:\\
                                      \;\;\;\;0.5 \cdot NdChar\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;0.5 \cdot NaChar\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if NaChar < -2.9e16 or 7.6000000000000002e64 < NaChar

                                        1. Initial program 100.0%

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

                                          \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
                                        3. 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-*.f6426.8

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

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

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

                                            \[\leadsto 0.5 \cdot NaChar \]
                                        7. Applied rewrites22.3%

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

                                        if -2.9e16 < NaChar < 7.6000000000000002e64

                                        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. Taylor expanded in NdChar around inf

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

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

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

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

                                            \[\leadsto 0.5 \cdot NdChar \]
                                        7. Applied rewrites22.4%

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

                                      Alternative 15: 17.8% accurate, 15.4× 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. Taylor expanded in KbT around inf

                                        \[\leadsto \color{blue}{\frac{1}{2} \cdot NaChar + \frac{1}{2} \cdot NdChar} \]
                                      3. Step-by-step derivation
                                        1. lower-fma.f64N/A

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

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

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

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

                                          \[\leadsto 0.5 \cdot NaChar \]
                                      7. Applied rewrites17.8%

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

                                      Reproduce

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