Quotient of sum of exps

Percentage Accurate: 98.9% → 98.3%
Time: 11.5s
Alternatives: 17
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{e^{a}}{e^{a} + e^{b}} \end{array} \]
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{e^{a}}{e^{a} + e^{b}} \end{array} \]
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}

Alternative 1: 98.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{a} \leq 0.998:\\ \;\;\;\;\frac{1}{e^{-a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= (exp a) 0.998) (/ 1.0 (+ (exp (- a)) 1.0)) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
	double tmp;
	if (exp(a) <= 0.998) {
		tmp = 1.0 / (exp(-a) + 1.0);
	} else {
		tmp = 1.0 / (exp(b) + 1.0);
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (exp(a) <= 0.998d0) then
        tmp = 1.0d0 / (exp(-a) + 1.0d0)
    else
        tmp = 1.0d0 / (exp(b) + 1.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (Math.exp(a) <= 0.998) {
		tmp = 1.0 / (Math.exp(-a) + 1.0);
	} else {
		tmp = 1.0 / (Math.exp(b) + 1.0);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if math.exp(a) <= 0.998:
		tmp = 1.0 / (math.exp(-a) + 1.0)
	else:
		tmp = 1.0 / (math.exp(b) + 1.0)
	return tmp
function code(a, b)
	tmp = 0.0
	if (exp(a) <= 0.998)
		tmp = Float64(1.0 / Float64(exp(Float64(-a)) + 1.0));
	else
		tmp = Float64(1.0 / Float64(exp(b) + 1.0));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (exp(a) <= 0.998)
		tmp = 1.0 / (exp(-a) + 1.0);
	else
		tmp = 1.0 / (exp(b) + 1.0);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 0.998], N[(1.0 / N[(N[Exp[(-a)], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 0.998:\\
\;\;\;\;\frac{1}{e^{-a} + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.998

    1. Initial program 96.8%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-exp.f64N/A

        \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
      2. lift-exp.f64N/A

        \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
      3. lift-exp.f64N/A

        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
      5. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
      6. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
      7. inv-powN/A

        \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
      8. pow-to-expN/A

        \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
      9. lift-exp.f64N/A

        \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
      10. prod-expN/A

        \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
      11. lower-exp.f64N/A

        \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
      12. lower-fma.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
      13. lower-log.f6496.9

        \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
    4. Applied egg-rr96.9%

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
      2. unsub-negN/A

        \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
      3. exp-diffN/A

        \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
      4. remove-double-divN/A

        \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
      5. exp-negN/A

        \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
      6. rem-exp-logN/A

        \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
      7. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
      9. +-commutativeN/A

        \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
      10. distribute-lft-inN/A

        \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
      11. exp-negN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
      12. lft-mult-inverseN/A

        \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
      14. lower-+.f64N/A

        \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
      15. neg-mul-1N/A

        \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
      16. lower-exp.f64N/A

        \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
      17. neg-mul-1N/A

        \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
      18. lower-neg.f6498.4

        \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
    7. Simplified98.4%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]

    if 0.998 < (exp.f64 a)

    1. Initial program 98.4%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
      3. lower-exp.f6499.4

        \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
    5. Simplified99.4%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0.998:\\ \;\;\;\;\frac{1}{e^{-a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)} \end{array} \]
(FPCore (a b) :precision binary64 (exp (fma (log (+ (exp a) (exp b))) -1.0 a)))
double code(double a, double b) {
	return exp(fma(log((exp(a) + exp(b))), -1.0, a));
}
function code(a, b)
	return exp(fma(log(Float64(exp(a) + exp(b))), -1.0, a))
end
code[a_, b_] := N[Exp[N[(N[Log[N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0 + a), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}
\end{array}
Derivation
  1. Initial program 98.0%

    \[\frac{e^{a}}{e^{a} + e^{b}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
    2. lift-exp.f64N/A

      \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
    3. lift-exp.f64N/A

      \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
    4. lift-+.f64N/A

      \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
    5. clear-numN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
    6. associate-/r/N/A

      \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
    7. inv-powN/A

      \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
    8. pow-to-expN/A

      \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
    9. lift-exp.f64N/A

      \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
    10. prod-expN/A

      \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
    11. lower-exp.f64N/A

      \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
    12. lower-fma.f64N/A

      \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
    13. lower-log.f6498.8

      \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
  4. Applied egg-rr98.8%

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
  5. Add Preprocessing

Alternative 3: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{e^{a}}{e^{a} + e^{b}} \end{array} \]
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}
Derivation
  1. Initial program 98.0%

    \[\frac{e^{a}}{e^{a} + e^{b}} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 4: 97.6% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -4.2 \cdot 10^{+24}:\\ \;\;\;\;e^{a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -4.2e+24) (* (exp a) 0.5) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
	double tmp;
	if (a <= -4.2e+24) {
		tmp = exp(a) * 0.5;
	} else {
		tmp = 1.0 / (exp(b) + 1.0);
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-4.2d+24)) then
        tmp = exp(a) * 0.5d0
    else
        tmp = 1.0d0 / (exp(b) + 1.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (a <= -4.2e+24) {
		tmp = Math.exp(a) * 0.5;
	} else {
		tmp = 1.0 / (Math.exp(b) + 1.0);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -4.2e+24:
		tmp = math.exp(a) * 0.5
	else:
		tmp = 1.0 / (math.exp(b) + 1.0)
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -4.2e+24)
		tmp = Float64(exp(a) * 0.5);
	else
		tmp = Float64(1.0 / Float64(exp(b) + 1.0));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -4.2e+24)
		tmp = exp(a) * 0.5;
	else
		tmp = 1.0 / (exp(b) + 1.0);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -4.2e+24], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(1.0 / N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{+24}:\\
\;\;\;\;e^{a} \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.2000000000000003e24

    1. Initial program 98.3%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in b around 0

      \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{1}} \]
    4. Step-by-step derivation
      1. Simplified100.0%

        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{1}} \]
      2. Taylor expanded in a around 0

        \[\leadsto \frac{e^{a}}{\color{blue}{2}} \]
      3. Step-by-step derivation
        1. Simplified100.0%

          \[\leadsto \frac{e^{a}}{\color{blue}{2}} \]
        2. Step-by-step derivation
          1. lift-exp.f64N/A

            \[\leadsto \frac{\color{blue}{e^{a}}}{2} \]
          2. div-invN/A

            \[\leadsto \color{blue}{e^{a} \cdot \frac{1}{2}} \]
          3. metadata-evalN/A

            \[\leadsto e^{a} \cdot \color{blue}{\frac{1}{2}} \]
          4. lower-*.f64100.0

            \[\leadsto \color{blue}{e^{a} \cdot 0.5} \]
        3. Applied egg-rr100.0%

          \[\leadsto \color{blue}{e^{a} \cdot 0.5} \]

        if -4.2000000000000003e24 < a

        1. Initial program 97.9%

          \[\frac{e^{a}}{e^{a} + e^{b}} \]
        2. Add Preprocessing
        3. Taylor expanded in a around 0

          \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
          2. lower-+.f64N/A

            \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
          3. lower-exp.f6498.7

            \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
        5. Simplified98.7%

          \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
      4. Recombined 2 regimes into one program.
      5. Final simplification99.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -4.2 \cdot 10^{+24}:\\ \;\;\;\;e^{a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \]
      6. Add Preprocessing

      Alternative 5: 95.7% accurate, 2.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq -7400:\\ \;\;\;\;e^{b} + 1\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{+32}:\\ \;\;\;\;e^{a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\ \end{array} \end{array} \]
      (FPCore (a b)
       :precision binary64
       (let* ((t_0 (* b (* b b))))
         (if (<= b -7400.0)
           (+ (exp b) 1.0)
           (if (<= b 1.3e+32)
             (* (exp a) 0.5)
             (/ 1.0 (* b (* b (* b (* t_0 t_0)))))))))
      double code(double a, double b) {
      	double t_0 = b * (b * b);
      	double tmp;
      	if (b <= -7400.0) {
      		tmp = exp(b) + 1.0;
      	} else if (b <= 1.3e+32) {
      		tmp = exp(a) * 0.5;
      	} else {
      		tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
      	}
      	return tmp;
      }
      
      real(8) function code(a, b)
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8) :: t_0
          real(8) :: tmp
          t_0 = b * (b * b)
          if (b <= (-7400.0d0)) then
              tmp = exp(b) + 1.0d0
          else if (b <= 1.3d+32) then
              tmp = exp(a) * 0.5d0
          else
              tmp = 1.0d0 / (b * (b * (b * (t_0 * t_0))))
          end if
          code = tmp
      end function
      
      public static double code(double a, double b) {
      	double t_0 = b * (b * b);
      	double tmp;
      	if (b <= -7400.0) {
      		tmp = Math.exp(b) + 1.0;
      	} else if (b <= 1.3e+32) {
      		tmp = Math.exp(a) * 0.5;
      	} else {
      		tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
      	}
      	return tmp;
      }
      
      def code(a, b):
      	t_0 = b * (b * b)
      	tmp = 0
      	if b <= -7400.0:
      		tmp = math.exp(b) + 1.0
      	elif b <= 1.3e+32:
      		tmp = math.exp(a) * 0.5
      	else:
      		tmp = 1.0 / (b * (b * (b * (t_0 * t_0))))
      	return tmp
      
      function code(a, b)
      	t_0 = Float64(b * Float64(b * b))
      	tmp = 0.0
      	if (b <= -7400.0)
      		tmp = Float64(exp(b) + 1.0);
      	elseif (b <= 1.3e+32)
      		tmp = Float64(exp(a) * 0.5);
      	else
      		tmp = Float64(1.0 / Float64(b * Float64(b * Float64(b * Float64(t_0 * t_0)))));
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b)
      	t_0 = b * (b * b);
      	tmp = 0.0;
      	if (b <= -7400.0)
      		tmp = exp(b) + 1.0;
      	elseif (b <= 1.3e+32)
      		tmp = exp(a) * 0.5;
      	else
      		tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -7400.0], N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[b, 1.3e+32], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := b \cdot \left(b \cdot b\right)\\
      \mathbf{if}\;b \leq -7400:\\
      \;\;\;\;e^{b} + 1\\
      
      \mathbf{elif}\;b \leq 1.3 \cdot 10^{+32}:\\
      \;\;\;\;e^{a} \cdot 0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if b < -7400

        1. Initial program 98.0%

          \[\frac{e^{a}}{e^{a} + e^{b}} \]
        2. Add Preprocessing
        3. Taylor expanded in a around 0

          \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
          2. lower-+.f64N/A

            \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
          3. lower-exp.f64100.0

            \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
        5. Simplified100.0%

          \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
        6. Applied egg-rr100.0%

          \[\leadsto \color{blue}{e^{b} + 1} \]

        if -7400 < b < 1.3000000000000001e32

        1. Initial program 98.5%

          \[\frac{e^{a}}{e^{a} + e^{b}} \]
        2. Add Preprocessing
        3. Taylor expanded in b around 0

          \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{1}} \]
        4. Step-by-step derivation
          1. Simplified95.1%

            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{1}} \]
          2. Taylor expanded in a around 0

            \[\leadsto \frac{e^{a}}{\color{blue}{2}} \]
          3. Step-by-step derivation
            1. Simplified93.9%

              \[\leadsto \frac{e^{a}}{\color{blue}{2}} \]
            2. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{2} \]
              2. div-invN/A

                \[\leadsto \color{blue}{e^{a} \cdot \frac{1}{2}} \]
              3. metadata-evalN/A

                \[\leadsto e^{a} \cdot \color{blue}{\frac{1}{2}} \]
              4. lower-*.f6493.9

                \[\leadsto \color{blue}{e^{a} \cdot 0.5} \]
            3. Applied egg-rr93.9%

              \[\leadsto \color{blue}{e^{a} \cdot 0.5} \]

            if 1.3000000000000001e32 < b

            1. Initial program 97.1%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f64100.0

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Taylor expanded in b around 0

              \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              2. lower-+.f645.6

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            8. Simplified5.6%

              \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            9. Step-by-step derivation
              1. flip3-+N/A

                \[\leadsto \frac{1}{\color{blue}{\frac{{b}^{3} + {2}^{3}}{b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)}}} \]
              2. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{3} + {2}^{3}} \cdot \left(b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)\right)} \]
              3. lift-*.f64N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \left(\color{blue}{b \cdot b} + \left(2 \cdot 2 - b \cdot 2\right)\right) \]
              4. flip-+N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)}{b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)}} \]
              5. frac-timesN/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
            10. Applied egg-rr7.6%

              \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{fma}\left(b, b, 4\right) + -2 \cdot b\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)\right)}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)}} \]
            11. Taylor expanded in b around -inf

              \[\leadsto \color{blue}{\frac{1}{{b}^{9}}} \]
            12. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{9}}} \]
              2. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(8 + 1\right)}}} \]
              3. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{8} \cdot b}} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{8} \cdot b}} \]
              5. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(7 + 1\right)}} \cdot b} \]
              6. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{7} \cdot b\right)} \cdot b} \]
              7. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{7} \cdot b\right)} \cdot b} \]
              8. metadata-evalN/A

                \[\leadsto \frac{1}{\left({b}^{\color{blue}{\left(6 + 1\right)}} \cdot b\right) \cdot b} \]
              9. pow-plusN/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left({b}^{6} \cdot b\right)} \cdot b\right) \cdot b} \]
              10. *-commutativeN/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b\right) \cdot b} \]
              11. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b\right) \cdot b} \]
              12. metadata-evalN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot {b}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \cdot b\right) \cdot b} \]
              13. pow-sqrN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b\right) \cdot b} \]
              14. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b\right) \cdot b} \]
              15. cube-multN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              16. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              17. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              18. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              19. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              20. cube-multN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right)\right) \cdot b\right) \cdot b} \]
              21. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{{b}^{2}}\right)\right)\right) \cdot b\right) \cdot b} \]
              22. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot {b}^{2}\right)}\right)\right) \cdot b\right) \cdot b} \]
              23. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b\right) \cdot b} \]
              24. lower-*.f6498.7

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b\right) \cdot b} \]
            13. Simplified98.7%

              \[\leadsto \color{blue}{\frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right) \cdot b\right) \cdot b}} \]
          4. Recombined 3 regimes into one program.
          5. Final simplification96.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7400:\\ \;\;\;\;e^{b} + 1\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{+32}:\\ \;\;\;\;e^{a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)\right)}\\ \end{array} \]
          6. Add Preprocessing

          Alternative 6: 90.2% accurate, 2.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq -7400:\\ \;\;\;\;e^{b} + 1\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\ \end{array} \end{array} \]
          (FPCore (a b)
           :precision binary64
           (let* ((t_0 (* b (* b b))))
             (if (<= b -7400.0)
               (+ (exp b) 1.0)
               (if (<= b 6.5e+18)
                 (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
                 (/ 1.0 (* b (* b (* b (* t_0 t_0)))))))))
          double code(double a, double b) {
          	double t_0 = b * (b * b);
          	double tmp;
          	if (b <= -7400.0) {
          		tmp = exp(b) + 1.0;
          	} else if (b <= 6.5e+18) {
          		tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
          	} else {
          		tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
          	}
          	return tmp;
          }
          
          function code(a, b)
          	t_0 = Float64(b * Float64(b * b))
          	tmp = 0.0
          	if (b <= -7400.0)
          		tmp = Float64(exp(b) + 1.0);
          	elseif (b <= 6.5e+18)
          		tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0));
          	else
          		tmp = Float64(1.0 / Float64(b * Float64(b * Float64(b * Float64(t_0 * t_0)))));
          	end
          	return tmp
          end
          
          code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -7400.0], N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[b, 6.5e+18], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := b \cdot \left(b \cdot b\right)\\
          \mathbf{if}\;b \leq -7400:\\
          \;\;\;\;e^{b} + 1\\
          
          \mathbf{elif}\;b \leq 6.5 \cdot 10^{+18}:\\
          \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if b < -7400

            1. Initial program 98.0%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f64100.0

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Applied egg-rr100.0%

              \[\leadsto \color{blue}{e^{b} + 1} \]

            if -7400 < b < 6.5e18

            1. Initial program 98.5%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
              2. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
              3. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
              5. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
              6. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
              7. inv-powN/A

                \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
              8. pow-to-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
              9. lift-exp.f64N/A

                \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
              10. prod-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              11. lower-exp.f64N/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              12. lower-fma.f64N/A

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              13. lower-log.f6498.5

                \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
            4. Applied egg-rr98.5%

              \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
            5. Taylor expanded in b around 0

              \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
              3. exp-diffN/A

                \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
              4. remove-double-divN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              5. exp-negN/A

                \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              6. rem-exp-logN/A

                \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
              7. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              8. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              9. +-commutativeN/A

                \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
              10. distribute-lft-inN/A

                \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
              11. exp-negN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              12. lft-mult-inverseN/A

                \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              13. *-rgt-identityN/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
              14. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
              15. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
              16. lower-exp.f64N/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
              17. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
              18. lower-neg.f6496.5

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
            7. Simplified96.5%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
            8. Taylor expanded in a around 0

              \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right)}} \]
            9. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right) + 2}} \]
              2. lower-fma.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1, 2\right)}} \]
              3. sub-negN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
              4. metadata-evalN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \color{blue}{-1}, 2\right)} \]
              5. lower-fma.f64N/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, \frac{1}{2} + \frac{-1}{6} \cdot a, -1\right)}, 2\right)} \]
              6. +-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{6} \cdot a + \frac{1}{2}}, -1\right), 2\right)} \]
              7. *-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{a \cdot \frac{-1}{6}} + \frac{1}{2}, -1\right), 2\right)} \]
              8. lower-fma.f6486.3

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, -0.16666666666666666, 0.5\right)}, -1\right), 2\right)} \]
            10. Simplified86.3%

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}} \]

            if 6.5e18 < b

            1. Initial program 97.1%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f64100.0

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Taylor expanded in b around 0

              \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              2. lower-+.f645.5

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            8. Simplified5.5%

              \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            9. Step-by-step derivation
              1. flip3-+N/A

                \[\leadsto \frac{1}{\color{blue}{\frac{{b}^{3} + {2}^{3}}{b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)}}} \]
              2. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{3} + {2}^{3}} \cdot \left(b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)\right)} \]
              3. lift-*.f64N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \left(\color{blue}{b \cdot b} + \left(2 \cdot 2 - b \cdot 2\right)\right) \]
              4. flip-+N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)}{b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)}} \]
              5. frac-timesN/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
            10. Applied egg-rr7.5%

              \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{fma}\left(b, b, 4\right) + -2 \cdot b\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)\right)}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)}} \]
            11. Taylor expanded in b around -inf

              \[\leadsto \color{blue}{\frac{1}{{b}^{9}}} \]
            12. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{9}}} \]
              2. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(8 + 1\right)}}} \]
              3. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{8} \cdot b}} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{8} \cdot b}} \]
              5. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(7 + 1\right)}} \cdot b} \]
              6. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{7} \cdot b\right)} \cdot b} \]
              7. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{7} \cdot b\right)} \cdot b} \]
              8. metadata-evalN/A

                \[\leadsto \frac{1}{\left({b}^{\color{blue}{\left(6 + 1\right)}} \cdot b\right) \cdot b} \]
              9. pow-plusN/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left({b}^{6} \cdot b\right)} \cdot b\right) \cdot b} \]
              10. *-commutativeN/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b\right) \cdot b} \]
              11. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b\right) \cdot b} \]
              12. metadata-evalN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot {b}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \cdot b\right) \cdot b} \]
              13. pow-sqrN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b\right) \cdot b} \]
              14. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b\right) \cdot b} \]
              15. cube-multN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              16. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              17. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              18. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              19. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              20. cube-multN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right)\right) \cdot b\right) \cdot b} \]
              21. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{{b}^{2}}\right)\right)\right) \cdot b\right) \cdot b} \]
              22. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot {b}^{2}\right)}\right)\right) \cdot b\right) \cdot b} \]
              23. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b\right) \cdot b} \]
              24. lower-*.f6496.0

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b\right) \cdot b} \]
            13. Simplified96.0%

              \[\leadsto \color{blue}{\frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right) \cdot b\right) \cdot b}} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification91.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7400:\\ \;\;\;\;e^{b} + 1\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)\right)}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 7: 75.3% accurate, 5.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\ \end{array} \end{array} \]
          (FPCore (a b)
           :precision binary64
           (let* ((t_0 (* b (* b b))))
             (if (<= b 6.5e+18)
               (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
               (/ 1.0 (* b (* b (* b (* t_0 t_0))))))))
          double code(double a, double b) {
          	double t_0 = b * (b * b);
          	double tmp;
          	if (b <= 6.5e+18) {
          		tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
          	} else {
          		tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
          	}
          	return tmp;
          }
          
          function code(a, b)
          	t_0 = Float64(b * Float64(b * b))
          	tmp = 0.0
          	if (b <= 6.5e+18)
          		tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0));
          	else
          		tmp = Float64(1.0 / Float64(b * Float64(b * Float64(b * Float64(t_0 * t_0)))));
          	end
          	return tmp
          end
          
          code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 6.5e+18], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := b \cdot \left(b \cdot b\right)\\
          \mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\
          \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if b < 6.5e18

            1. Initial program 98.4%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
              2. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
              3. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
              5. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
              6. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
              7. inv-powN/A

                \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
              8. pow-to-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
              9. lift-exp.f64N/A

                \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
              10. prod-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              11. lower-exp.f64N/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              12. lower-fma.f64N/A

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              13. lower-log.f6498.4

                \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
            4. Applied egg-rr98.4%

              \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
            5. Taylor expanded in b around 0

              \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
              3. exp-diffN/A

                \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
              4. remove-double-divN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              5. exp-negN/A

                \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              6. rem-exp-logN/A

                \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
              7. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              8. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              9. +-commutativeN/A

                \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
              10. distribute-lft-inN/A

                \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
              11. exp-negN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              12. lft-mult-inverseN/A

                \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              13. *-rgt-identityN/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
              14. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
              15. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
              16. lower-exp.f64N/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
              17. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
              18. lower-neg.f6475.5

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
            7. Simplified75.5%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
            8. Taylor expanded in a around 0

              \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right)}} \]
            9. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right) + 2}} \]
              2. lower-fma.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1, 2\right)}} \]
              3. sub-negN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
              4. metadata-evalN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \color{blue}{-1}, 2\right)} \]
              5. lower-fma.f64N/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, \frac{1}{2} + \frac{-1}{6} \cdot a, -1\right)}, 2\right)} \]
              6. +-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{6} \cdot a + \frac{1}{2}}, -1\right), 2\right)} \]
              7. *-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{a \cdot \frac{-1}{6}} + \frac{1}{2}, -1\right), 2\right)} \]
              8. lower-fma.f6468.1

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, -0.16666666666666666, 0.5\right)}, -1\right), 2\right)} \]
            10. Simplified68.1%

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}} \]

            if 6.5e18 < b

            1. Initial program 97.1%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f64100.0

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Taylor expanded in b around 0

              \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              2. lower-+.f645.5

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            8. Simplified5.5%

              \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            9. Step-by-step derivation
              1. flip3-+N/A

                \[\leadsto \frac{1}{\color{blue}{\frac{{b}^{3} + {2}^{3}}{b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)}}} \]
              2. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{3} + {2}^{3}} \cdot \left(b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)\right)} \]
              3. lift-*.f64N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \left(\color{blue}{b \cdot b} + \left(2 \cdot 2 - b \cdot 2\right)\right) \]
              4. flip-+N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)}{b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)}} \]
              5. frac-timesN/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
            10. Applied egg-rr7.5%

              \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{fma}\left(b, b, 4\right) + -2 \cdot b\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)\right)}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)}} \]
            11. Taylor expanded in b around -inf

              \[\leadsto \color{blue}{\frac{1}{{b}^{9}}} \]
            12. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{9}}} \]
              2. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(8 + 1\right)}}} \]
              3. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{8} \cdot b}} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{8} \cdot b}} \]
              5. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(7 + 1\right)}} \cdot b} \]
              6. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{7} \cdot b\right)} \cdot b} \]
              7. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{7} \cdot b\right)} \cdot b} \]
              8. metadata-evalN/A

                \[\leadsto \frac{1}{\left({b}^{\color{blue}{\left(6 + 1\right)}} \cdot b\right) \cdot b} \]
              9. pow-plusN/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left({b}^{6} \cdot b\right)} \cdot b\right) \cdot b} \]
              10. *-commutativeN/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b\right) \cdot b} \]
              11. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b\right) \cdot b} \]
              12. metadata-evalN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot {b}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \cdot b\right) \cdot b} \]
              13. pow-sqrN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b\right) \cdot b} \]
              14. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b\right) \cdot b} \]
              15. cube-multN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              16. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              17. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              18. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              19. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b\right) \cdot b} \]
              20. cube-multN/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right)\right) \cdot b\right) \cdot b} \]
              21. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{{b}^{2}}\right)\right)\right) \cdot b\right) \cdot b} \]
              22. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot {b}^{2}\right)}\right)\right) \cdot b\right) \cdot b} \]
              23. unpow2N/A

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b\right) \cdot b} \]
              24. lower-*.f6496.0

                \[\leadsto \frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b\right) \cdot b} \]
            13. Simplified96.0%

              \[\leadsto \color{blue}{\frac{1}{\left(\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right) \cdot b\right) \cdot b}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification75.7%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)\right)}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 8: 75.0% accurate, 5.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)}\\ \end{array} \end{array} \]
          (FPCore (a b)
           :precision binary64
           (let* ((t_0 (* b (* b b))))
             (if (<= b 6.5e+18)
               (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
               (/ 1.0 (* b (* b (* t_0 t_0)))))))
          double code(double a, double b) {
          	double t_0 = b * (b * b);
          	double tmp;
          	if (b <= 6.5e+18) {
          		tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
          	} else {
          		tmp = 1.0 / (b * (b * (t_0 * t_0)));
          	}
          	return tmp;
          }
          
          function code(a, b)
          	t_0 = Float64(b * Float64(b * b))
          	tmp = 0.0
          	if (b <= 6.5e+18)
          		tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0));
          	else
          		tmp = Float64(1.0 / Float64(b * Float64(b * Float64(t_0 * t_0))));
          	end
          	return tmp
          end
          
          code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 6.5e+18], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := b \cdot \left(b \cdot b\right)\\
          \mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\
          \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if b < 6.5e18

            1. Initial program 98.4%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
              2. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
              3. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
              5. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
              6. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
              7. inv-powN/A

                \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
              8. pow-to-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
              9. lift-exp.f64N/A

                \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
              10. prod-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              11. lower-exp.f64N/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              12. lower-fma.f64N/A

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              13. lower-log.f6498.4

                \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
            4. Applied egg-rr98.4%

              \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
            5. Taylor expanded in b around 0

              \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
              3. exp-diffN/A

                \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
              4. remove-double-divN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              5. exp-negN/A

                \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              6. rem-exp-logN/A

                \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
              7. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              8. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              9. +-commutativeN/A

                \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
              10. distribute-lft-inN/A

                \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
              11. exp-negN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              12. lft-mult-inverseN/A

                \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              13. *-rgt-identityN/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
              14. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
              15. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
              16. lower-exp.f64N/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
              17. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
              18. lower-neg.f6475.5

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
            7. Simplified75.5%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
            8. Taylor expanded in a around 0

              \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right)}} \]
            9. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right) + 2}} \]
              2. lower-fma.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1, 2\right)}} \]
              3. sub-negN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
              4. metadata-evalN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \color{blue}{-1}, 2\right)} \]
              5. lower-fma.f64N/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, \frac{1}{2} + \frac{-1}{6} \cdot a, -1\right)}, 2\right)} \]
              6. +-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{6} \cdot a + \frac{1}{2}}, -1\right), 2\right)} \]
              7. *-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{a \cdot \frac{-1}{6}} + \frac{1}{2}, -1\right), 2\right)} \]
              8. lower-fma.f6468.1

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, -0.16666666666666666, 0.5\right)}, -1\right), 2\right)} \]
            10. Simplified68.1%

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}} \]

            if 6.5e18 < b

            1. Initial program 97.1%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f64100.0

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Taylor expanded in b around 0

              \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              2. lower-+.f645.5

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            8. Simplified5.5%

              \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            9. Step-by-step derivation
              1. flip3-+N/A

                \[\leadsto \frac{1}{\color{blue}{\frac{{b}^{3} + {2}^{3}}{b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)}}} \]
              2. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{3} + {2}^{3}} \cdot \left(b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)\right)} \]
              3. lift-*.f64N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \left(\color{blue}{b \cdot b} + \left(2 \cdot 2 - b \cdot 2\right)\right) \]
              4. flip-+N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)}{b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)}} \]
              5. frac-timesN/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
            10. Applied egg-rr7.5%

              \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{fma}\left(b, b, 4\right) + -2 \cdot b\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)\right)}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)}} \]
            11. Taylor expanded in b around inf

              \[\leadsto \color{blue}{\frac{1}{{b}^{8}}} \]
            12. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{8}}} \]
              2. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(7 + 1\right)}}} \]
              3. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{7} \cdot b}} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{{b}^{7} \cdot b}} \]
              5. metadata-evalN/A

                \[\leadsto \frac{1}{{b}^{\color{blue}{\left(6 + 1\right)}} \cdot b} \]
              6. pow-plusN/A

                \[\leadsto \frac{1}{\color{blue}{\left({b}^{6} \cdot b\right)} \cdot b} \]
              7. *-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b} \]
              8. lower-*.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\left(b \cdot {b}^{6}\right)} \cdot b} \]
              9. metadata-evalN/A

                \[\leadsto \frac{1}{\left(b \cdot {b}^{\color{blue}{\left(2 \cdot 3\right)}}\right) \cdot b} \]
              10. pow-sqrN/A

                \[\leadsto \frac{1}{\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b} \]
              11. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(b \cdot \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)}\right) \cdot b} \]
              12. cube-multN/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right)\right) \cdot b} \]
              13. unpow2N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot {b}^{3}\right)\right) \cdot b} \]
              14. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot {b}^{3}\right)\right) \cdot b} \]
              15. unpow2N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b} \]
              16. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right)\right) \cdot b} \]
              17. cube-multN/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right)\right) \cdot b} \]
              18. unpow2N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{{b}^{2}}\right)\right)\right) \cdot b} \]
              19. lower-*.f64N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot {b}^{2}\right)}\right)\right) \cdot b} \]
              20. unpow2N/A

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b} \]
              21. lower-*.f6496.0

                \[\leadsto \frac{1}{\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right)\right) \cdot b} \]
            13. Simplified96.0%

              \[\leadsto \color{blue}{\frac{1}{\left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right) \cdot b}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification75.7%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 9: 74.1% accurate, 6.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 7.6 \cdot 10^{+59}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-16}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b + \left(b \cdot 2 - 4\right)\right)}\\ \end{array} \end{array} \]
          (FPCore (a b)
           :precision binary64
           (if (<= b 7.6e+59)
             (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
             (/ -16.0 (* (fma b (* b b) 8.0) (+ (* b b) (- (* b 2.0) 4.0))))))
          double code(double a, double b) {
          	double tmp;
          	if (b <= 7.6e+59) {
          		tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
          	} else {
          		tmp = -16.0 / (fma(b, (b * b), 8.0) * ((b * b) + ((b * 2.0) - 4.0)));
          	}
          	return tmp;
          }
          
          function code(a, b)
          	tmp = 0.0
          	if (b <= 7.6e+59)
          		tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0));
          	else
          		tmp = Float64(-16.0 / Float64(fma(b, Float64(b * b), 8.0) * Float64(Float64(b * b) + Float64(Float64(b * 2.0) - 4.0))));
          	end
          	return tmp
          end
          
          code[a_, b_] := If[LessEqual[b, 7.6e+59], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(-16.0 / N[(N[(b * N[(b * b), $MachinePrecision] + 8.0), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(N[(b * 2.0), $MachinePrecision] - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;b \leq 7.6 \cdot 10^{+59}:\\
          \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{-16}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b + \left(b \cdot 2 - 4\right)\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if b < 7.6000000000000002e59

            1. Initial program 97.9%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
              2. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
              3. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
              5. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
              6. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
              7. inv-powN/A

                \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
              8. pow-to-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
              9. lift-exp.f64N/A

                \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
              10. prod-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              11. lower-exp.f64N/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              12. lower-fma.f64N/A

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              13. lower-log.f6498.5

                \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
            4. Applied egg-rr98.5%

              \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
            5. Taylor expanded in b around 0

              \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
              3. exp-diffN/A

                \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
              4. remove-double-divN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              5. exp-negN/A

                \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              6. rem-exp-logN/A

                \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
              7. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              8. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              9. +-commutativeN/A

                \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
              10. distribute-lft-inN/A

                \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
              11. exp-negN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              12. lft-mult-inverseN/A

                \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              13. *-rgt-identityN/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
              14. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
              15. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
              16. lower-exp.f64N/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
              17. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
              18. lower-neg.f6474.3

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
            7. Simplified74.3%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
            8. Taylor expanded in a around 0

              \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right)}} \]
            9. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right) + 2}} \]
              2. lower-fma.f64N/A

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1, 2\right)}} \]
              3. sub-negN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
              4. metadata-evalN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \color{blue}{-1}, 2\right)} \]
              5. lower-fma.f64N/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, \frac{1}{2} + \frac{-1}{6} \cdot a, -1\right)}, 2\right)} \]
              6. +-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{6} \cdot a + \frac{1}{2}}, -1\right), 2\right)} \]
              7. *-commutativeN/A

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{a \cdot \frac{-1}{6}} + \frac{1}{2}, -1\right), 2\right)} \]
              8. lower-fma.f6466.6

                \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, -0.16666666666666666, 0.5\right)}, -1\right), 2\right)} \]
            10. Simplified66.6%

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}} \]

            if 7.6000000000000002e59 < b

            1. Initial program 98.4%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f64100.0

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified100.0%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Taylor expanded in b around 0

              \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              2. lower-+.f645.7

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            8. Simplified5.7%

              \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
            9. Step-by-step derivation
              1. flip3-+N/A

                \[\leadsto \frac{1}{\color{blue}{\frac{{b}^{3} + {2}^{3}}{b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)}}} \]
              2. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{{b}^{3} + {2}^{3}} \cdot \left(b \cdot b + \left(2 \cdot 2 - b \cdot 2\right)\right)} \]
              3. lift-*.f64N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \left(\color{blue}{b \cdot b} + \left(2 \cdot 2 - b \cdot 2\right)\right) \]
              4. flip-+N/A

                \[\leadsto \frac{1}{{b}^{3} + {2}^{3}} \cdot \color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)}{b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)}} \]
              5. frac-timesN/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(2 \cdot 2 - b \cdot 2\right) \cdot \left(2 \cdot 2 - b \cdot 2\right)\right)}{\left({b}^{3} + {2}^{3}\right) \cdot \left(b \cdot b - \left(2 \cdot 2 - b \cdot 2\right)\right)}} \]
            10. Applied egg-rr7.9%

              \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{fma}\left(b, b, 4\right) + -2 \cdot b\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)\right)}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)}} \]
            11. Taylor expanded in b around 0

              \[\leadsto \frac{\color{blue}{-16}}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)} \]
            12. Step-by-step derivation
              1. Simplified98.6%

                \[\leadsto \frac{\color{blue}{-16}}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b - \left(4 - b \cdot 2\right)\right)} \]
            13. Recombined 2 regimes into one program.
            14. Final simplification74.6%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 7.6 \cdot 10^{+59}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-16}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b + \left(b \cdot 2 - 4\right)\right)}\\ \end{array} \]
            15. Add Preprocessing

            Alternative 10: 70.8% accurate, 8.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.08 \cdot 10^{+80}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right), 2\right)}\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (if (<= b 1.08e+80)
               (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
               (/ 1.0 (fma b (fma b (fma b 0.16666666666666666 0.5) 1.0) 2.0))))
            double code(double a, double b) {
            	double tmp;
            	if (b <= 1.08e+80) {
            		tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
            	} else {
            		tmp = 1.0 / fma(b, fma(b, fma(b, 0.16666666666666666, 0.5), 1.0), 2.0);
            	}
            	return tmp;
            }
            
            function code(a, b)
            	tmp = 0.0
            	if (b <= 1.08e+80)
            		tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0));
            	else
            		tmp = Float64(1.0 / fma(b, fma(b, fma(b, 0.16666666666666666, 0.5), 1.0), 2.0));
            	end
            	return tmp
            end
            
            code[a_, b_] := If[LessEqual[b, 1.08e+80], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;b \leq 1.08 \cdot 10^{+80}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right), 2\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if b < 1.08e80

              1. Initial program 98.0%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-exp.f64N/A

                  \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
                3. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                4. lift-+.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
                5. clear-numN/A

                  \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
                6. associate-/r/N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
                7. inv-powN/A

                  \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
                8. pow-to-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
                9. lift-exp.f64N/A

                  \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
                10. prod-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                11. lower-exp.f64N/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                12. lower-fma.f64N/A

                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
                13. lower-log.f6498.5

                  \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
              4. Applied egg-rr98.5%

                \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              5. Taylor expanded in b around 0

                \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
                2. unsub-negN/A

                  \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
                3. exp-diffN/A

                  \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
                4. remove-double-divN/A

                  \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                5. exp-negN/A

                  \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                6. rem-exp-logN/A

                  \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
                7. associate-/r*N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                8. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
                10. distribute-lft-inN/A

                  \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
                11. exp-negN/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                12. lft-mult-inverseN/A

                  \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                13. *-rgt-identityN/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
                14. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
                15. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
                16. lower-exp.f64N/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
                17. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
                18. lower-neg.f6473.2

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
              7. Simplified73.2%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
              8. Taylor expanded in a around 0

                \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right)}} \]
              9. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \frac{1}{\color{blue}{a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right) + 2}} \]
                2. lower-fma.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1, 2\right)}} \]
                3. sub-negN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
                4. metadata-evalN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \color{blue}{-1}, 2\right)} \]
                5. lower-fma.f64N/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, \frac{1}{2} + \frac{-1}{6} \cdot a, -1\right)}, 2\right)} \]
                6. +-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{6} \cdot a + \frac{1}{2}}, -1\right), 2\right)} \]
                7. *-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{a \cdot \frac{-1}{6}} + \frac{1}{2}, -1\right), 2\right)} \]
                8. lower-fma.f6465.8

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, -0.16666666666666666, 0.5\right)}, -1\right), 2\right)} \]
              10. Simplified65.8%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}} \]

              if 1.08e80 < b

              1. Initial program 98.2%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Taylor expanded in a around 0

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
                2. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
                3. lower-exp.f64100.0

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
              5. Simplified100.0%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              6. Taylor expanded in b around 0

                \[\leadsto \frac{1}{\color{blue}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \frac{1}{\color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right) + 2}} \]
                2. lower-fma.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, 1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right), 2\right)}} \]
                3. +-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right) + 1}, 2\right)} \]
                4. lower-fma.f64N/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, \frac{1}{2} + \frac{1}{6} \cdot b, 1\right)}, 2\right)} \]
                5. +-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \color{blue}{\frac{1}{6} \cdot b + \frac{1}{2}}, 1\right), 2\right)} \]
                6. *-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \color{blue}{b \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 2\right)} \]
                7. lower-fma.f6495.1

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, 0.16666666666666666, 0.5\right)}, 1\right), 2\right)} \]
              8. Simplified95.1%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right), 2\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 11: 67.7% accurate, 8.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.45 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (if (<= b 2.45e+148)
               (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
               (/ 1.0 (fma b (fma b 0.5 1.0) 2.0))))
            double code(double a, double b) {
            	double tmp;
            	if (b <= 2.45e+148) {
            		tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
            	} else {
            		tmp = 1.0 / fma(b, fma(b, 0.5, 1.0), 2.0);
            	}
            	return tmp;
            }
            
            function code(a, b)
            	tmp = 0.0
            	if (b <= 2.45e+148)
            		tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0));
            	else
            		tmp = Float64(1.0 / fma(b, fma(b, 0.5, 1.0), 2.0));
            	end
            	return tmp
            end
            
            code[a_, b_] := If[LessEqual[b, 2.45e+148], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * 0.5 + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;b \leq 2.45 \cdot 10^{+148}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if b < 2.45e148

              1. Initial program 98.1%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-exp.f64N/A

                  \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
                3. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                4. lift-+.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
                5. clear-numN/A

                  \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
                6. associate-/r/N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
                7. inv-powN/A

                  \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
                8. pow-to-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
                9. lift-exp.f64N/A

                  \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
                10. prod-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                11. lower-exp.f64N/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                12. lower-fma.f64N/A

                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
                13. lower-log.f6498.6

                  \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
              4. Applied egg-rr98.6%

                \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              5. Taylor expanded in b around 0

                \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
                2. unsub-negN/A

                  \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
                3. exp-diffN/A

                  \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
                4. remove-double-divN/A

                  \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                5. exp-negN/A

                  \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                6. rem-exp-logN/A

                  \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
                7. associate-/r*N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                8. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
                10. distribute-lft-inN/A

                  \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
                11. exp-negN/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                12. lft-mult-inverseN/A

                  \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                13. *-rgt-identityN/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
                14. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
                15. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
                16. lower-exp.f64N/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
                17. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
                18. lower-neg.f6469.2

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
              7. Simplified69.2%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
              8. Taylor expanded in a around 0

                \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right)}} \]
              9. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \frac{1}{\color{blue}{a \cdot \left(a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1\right) + 2}} \]
                2. lower-fma.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) - 1, 2\right)}} \]
                3. sub-negN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
                4. metadata-evalN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, a \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot a\right) + \color{blue}{-1}, 2\right)} \]
                5. lower-fma.f64N/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, \frac{1}{2} + \frac{-1}{6} \cdot a, -1\right)}, 2\right)} \]
                6. +-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\frac{-1}{6} \cdot a + \frac{1}{2}}, -1\right), 2\right)} \]
                7. *-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{a \cdot \frac{-1}{6}} + \frac{1}{2}, -1\right), 2\right)} \]
                8. lower-fma.f6461.9

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(a, -0.16666666666666666, 0.5\right)}, -1\right), 2\right)} \]
              10. Simplified61.9%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}} \]

              if 2.45e148 < b

              1. Initial program 97.6%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Taylor expanded in a around 0

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
                2. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
                3. lower-exp.f64100.0

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
              5. Simplified100.0%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              6. Taylor expanded in b around 0

                \[\leadsto \frac{1}{\color{blue}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

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

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, 1 + \frac{1}{2} \cdot b, 2\right)}} \]
                3. +-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\frac{1}{2} \cdot b + 1}, 2\right)} \]
                4. *-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{b \cdot \frac{1}{2}} + 1, 2\right)} \]
                5. lower-fma.f6495.8

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, 0.5, 1\right)}, 2\right)} \]
              8. Simplified95.8%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 12: 64.2% accurate, 10.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.45 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (if (<= b 2.45e+148)
               (/ 1.0 (fma a (fma 0.5 a -1.0) 2.0))
               (/ 1.0 (fma b (fma b 0.5 1.0) 2.0))))
            double code(double a, double b) {
            	double tmp;
            	if (b <= 2.45e+148) {
            		tmp = 1.0 / fma(a, fma(0.5, a, -1.0), 2.0);
            	} else {
            		tmp = 1.0 / fma(b, fma(b, 0.5, 1.0), 2.0);
            	}
            	return tmp;
            }
            
            function code(a, b)
            	tmp = 0.0
            	if (b <= 2.45e+148)
            		tmp = Float64(1.0 / fma(a, fma(0.5, a, -1.0), 2.0));
            	else
            		tmp = Float64(1.0 / fma(b, fma(b, 0.5, 1.0), 2.0));
            	end
            	return tmp
            end
            
            code[a_, b_] := If[LessEqual[b, 2.45e+148], N[(1.0 / N[(a * N[(0.5 * a + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * 0.5 + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;b \leq 2.45 \cdot 10^{+148}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if b < 2.45e148

              1. Initial program 98.1%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-exp.f64N/A

                  \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
                3. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                4. lift-+.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
                5. clear-numN/A

                  \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
                6. associate-/r/N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
                7. inv-powN/A

                  \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
                8. pow-to-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
                9. lift-exp.f64N/A

                  \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
                10. prod-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                11. lower-exp.f64N/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                12. lower-fma.f64N/A

                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
                13. lower-log.f6498.6

                  \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
              4. Applied egg-rr98.6%

                \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              5. Taylor expanded in b around 0

                \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
                2. unsub-negN/A

                  \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
                3. exp-diffN/A

                  \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
                4. remove-double-divN/A

                  \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                5. exp-negN/A

                  \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                6. rem-exp-logN/A

                  \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
                7. associate-/r*N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                8. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
                10. distribute-lft-inN/A

                  \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
                11. exp-negN/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                12. lft-mult-inverseN/A

                  \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                13. *-rgt-identityN/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
                14. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
                15. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
                16. lower-exp.f64N/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
                17. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
                18. lower-neg.f6469.2

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
              7. Simplified69.2%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
              8. Taylor expanded in a around 0

                \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(\frac{1}{2} \cdot a - 1\right)}} \]
              9. Step-by-step derivation
                1. +-commutativeN/A

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

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \frac{1}{2} \cdot a - 1, 2\right)}} \]
                3. sub-negN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\frac{1}{2} \cdot a + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
                4. metadata-evalN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \frac{1}{2} \cdot a + \color{blue}{-1}, 2\right)} \]
                5. lower-fma.f6458.7

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(0.5, a, -1\right)}, 2\right)} \]
              10. Simplified58.7%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}} \]

              if 2.45e148 < b

              1. Initial program 97.6%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Taylor expanded in a around 0

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
                2. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
                3. lower-exp.f64100.0

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
              5. Simplified100.0%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              6. Taylor expanded in b around 0

                \[\leadsto \frac{1}{\color{blue}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

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

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, 1 + \frac{1}{2} \cdot b, 2\right)}} \]
                3. +-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\frac{1}{2} \cdot b + 1}, 2\right)} \]
                4. *-commutativeN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{b \cdot \frac{1}{2}} + 1, 2\right)} \]
                5. lower-fma.f6495.8

                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, 0.5, 1\right)}, 2\right)} \]
              8. Simplified95.8%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 13: 64.2% accurate, 10.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.5 \cdot 10^{+148}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (if (<= b 2.5e+148)
               (/ 1.0 (fma a (fma 0.5 a -1.0) 2.0))
               (/ (+ b -2.0) (fma b b -4.0))))
            double code(double a, double b) {
            	double tmp;
            	if (b <= 2.5e+148) {
            		tmp = 1.0 / fma(a, fma(0.5, a, -1.0), 2.0);
            	} else {
            		tmp = (b + -2.0) / fma(b, b, -4.0);
            	}
            	return tmp;
            }
            
            function code(a, b)
            	tmp = 0.0
            	if (b <= 2.5e+148)
            		tmp = Float64(1.0 / fma(a, fma(0.5, a, -1.0), 2.0));
            	else
            		tmp = Float64(Float64(b + -2.0) / fma(b, b, -4.0));
            	end
            	return tmp
            end
            
            code[a_, b_] := If[LessEqual[b, 2.5e+148], N[(1.0 / N[(a * N[(0.5 * a + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(b + -2.0), $MachinePrecision] / N[(b * b + -4.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;b \leq 2.5 \cdot 10^{+148}:\\
            \;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if b < 2.50000000000000012e148

              1. Initial program 98.1%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-exp.f64N/A

                  \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
                3. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                4. lift-+.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
                5. clear-numN/A

                  \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
                6. associate-/r/N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
                7. inv-powN/A

                  \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
                8. pow-to-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
                9. lift-exp.f64N/A

                  \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
                10. prod-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                11. lower-exp.f64N/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                12. lower-fma.f64N/A

                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
                13. lower-log.f6498.6

                  \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
              4. Applied egg-rr98.6%

                \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              5. Taylor expanded in b around 0

                \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
                2. unsub-negN/A

                  \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
                3. exp-diffN/A

                  \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
                4. remove-double-divN/A

                  \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                5. exp-negN/A

                  \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                6. rem-exp-logN/A

                  \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
                7. associate-/r*N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                8. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
                10. distribute-lft-inN/A

                  \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
                11. exp-negN/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                12. lft-mult-inverseN/A

                  \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                13. *-rgt-identityN/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
                14. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
                15. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
                16. lower-exp.f64N/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
                17. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
                18. lower-neg.f6469.2

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
              7. Simplified69.2%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
              8. Taylor expanded in a around 0

                \[\leadsto \frac{1}{\color{blue}{2 + a \cdot \left(\frac{1}{2} \cdot a - 1\right)}} \]
              9. Step-by-step derivation
                1. +-commutativeN/A

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

                  \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \frac{1}{2} \cdot a - 1, 2\right)}} \]
                3. sub-negN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\frac{1}{2} \cdot a + \left(\mathsf{neg}\left(1\right)\right)}, 2\right)} \]
                4. metadata-evalN/A

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \frac{1}{2} \cdot a + \color{blue}{-1}, 2\right)} \]
                5. lower-fma.f6458.7

                  \[\leadsto \frac{1}{\mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(0.5, a, -1\right)}, 2\right)} \]
              10. Simplified58.7%

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}} \]

              if 2.50000000000000012e148 < b

              1. Initial program 97.6%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Taylor expanded in a around 0

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
                2. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
                3. lower-exp.f64100.0

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
              5. Simplified100.0%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              6. Taylor expanded in b around 0

                \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
                2. lower-+.f646.5

                  \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              8. Simplified6.5%

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              9. Step-by-step derivation
                1. flip-+N/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{b \cdot b - 2 \cdot 2}{b - 2}}} \]
                2. clear-numN/A

                  \[\leadsto \color{blue}{\frac{b - 2}{b \cdot b - 2 \cdot 2}} \]
                3. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{b - 2}{b \cdot b - 2 \cdot 2}} \]
                4. sub-negN/A

                  \[\leadsto \frac{\color{blue}{b + \left(\mathsf{neg}\left(2\right)\right)}}{b \cdot b - 2 \cdot 2} \]
                5. lower-+.f64N/A

                  \[\leadsto \frac{\color{blue}{b + \left(\mathsf{neg}\left(2\right)\right)}}{b \cdot b - 2 \cdot 2} \]
                6. metadata-evalN/A

                  \[\leadsto \frac{b + \color{blue}{-2}}{b \cdot b - 2 \cdot 2} \]
                7. lift-*.f64N/A

                  \[\leadsto \frac{b + -2}{\color{blue}{b \cdot b} - 2 \cdot 2} \]
                8. sub-negN/A

                  \[\leadsto \frac{b + -2}{\color{blue}{b \cdot b + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
                9. lift-*.f64N/A

                  \[\leadsto \frac{b + -2}{\color{blue}{b \cdot b} + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
                10. lower-fma.f64N/A

                  \[\leadsto \frac{b + -2}{\color{blue}{\mathsf{fma}\left(b, b, \mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
                11. metadata-evalN/A

                  \[\leadsto \frac{b + -2}{\mathsf{fma}\left(b, b, \mathsf{neg}\left(\color{blue}{4}\right)\right)} \]
                12. metadata-eval95.5

                  \[\leadsto \frac{b + -2}{\mathsf{fma}\left(b, b, \color{blue}{-4}\right)} \]
              10. Applied egg-rr95.5%

                \[\leadsto \color{blue}{\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 14: 53.0% accurate, 11.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 4 \cdot 10^{-64}:\\ \;\;\;\;\frac{1}{2 - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (if (<= b 4e-64) (/ 1.0 (- 2.0 a)) (/ (+ b -2.0) (fma b b -4.0))))
            double code(double a, double b) {
            	double tmp;
            	if (b <= 4e-64) {
            		tmp = 1.0 / (2.0 - a);
            	} else {
            		tmp = (b + -2.0) / fma(b, b, -4.0);
            	}
            	return tmp;
            }
            
            function code(a, b)
            	tmp = 0.0
            	if (b <= 4e-64)
            		tmp = Float64(1.0 / Float64(2.0 - a));
            	else
            		tmp = Float64(Float64(b + -2.0) / fma(b, b, -4.0));
            	end
            	return tmp
            end
            
            code[a_, b_] := If[LessEqual[b, 4e-64], N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision], N[(N[(b + -2.0), $MachinePrecision] / N[(b * b + -4.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;b \leq 4 \cdot 10^{-64}:\\
            \;\;\;\;\frac{1}{2 - a}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if b < 3.99999999999999986e-64

              1. Initial program 98.8%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-exp.f64N/A

                  \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
                2. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
                3. lift-exp.f64N/A

                  \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                4. lift-+.f64N/A

                  \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
                5. clear-numN/A

                  \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
                6. associate-/r/N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
                7. inv-powN/A

                  \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
                8. pow-to-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
                9. lift-exp.f64N/A

                  \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
                10. prod-expN/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                11. lower-exp.f64N/A

                  \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
                12. lower-fma.f64N/A

                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
                13. lower-log.f6498.8

                  \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
              4. Applied egg-rr98.8%

                \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              5. Taylor expanded in b around 0

                \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
                2. unsub-negN/A

                  \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
                3. exp-diffN/A

                  \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
                4. remove-double-divN/A

                  \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                5. exp-negN/A

                  \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
                6. rem-exp-logN/A

                  \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
                7. associate-/r*N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                8. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
                10. distribute-lft-inN/A

                  \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
                11. exp-negN/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                12. lft-mult-inverseN/A

                  \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
                13. *-rgt-identityN/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
                14. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
                15. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
                16. lower-exp.f64N/A

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
                17. neg-mul-1N/A

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
                18. lower-neg.f6474.5

                  \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
              7. Simplified74.5%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
              8. Taylor expanded in a around 0

                \[\leadsto \frac{1}{\color{blue}{2 + -1 \cdot a}} \]
              9. Step-by-step derivation
                1. neg-mul-1N/A

                  \[\leadsto \frac{1}{2 + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}} \]
                2. unsub-negN/A

                  \[\leadsto \frac{1}{\color{blue}{2 - a}} \]
                3. lower--.f6452.1

                  \[\leadsto \frac{1}{\color{blue}{2 - a}} \]
              10. Simplified52.1%

                \[\leadsto \frac{1}{\color{blue}{2 - a}} \]

              if 3.99999999999999986e-64 < b

              1. Initial program 96.5%

                \[\frac{e^{a}}{e^{a} + e^{b}} \]
              2. Add Preprocessing
              3. Taylor expanded in a around 0

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
                2. lower-+.f64N/A

                  \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
                3. lower-exp.f6499.0

                  \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
              5. Simplified99.0%

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              6. Taylor expanded in b around 0

                \[\leadsto \frac{1}{\color{blue}{2 + b}} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
                2. lower-+.f6417.7

                  \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              8. Simplified17.7%

                \[\leadsto \frac{1}{\color{blue}{b + 2}} \]
              9. Step-by-step derivation
                1. flip-+N/A

                  \[\leadsto \frac{1}{\color{blue}{\frac{b \cdot b - 2 \cdot 2}{b - 2}}} \]
                2. clear-numN/A

                  \[\leadsto \color{blue}{\frac{b - 2}{b \cdot b - 2 \cdot 2}} \]
                3. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{b - 2}{b \cdot b - 2 \cdot 2}} \]
                4. sub-negN/A

                  \[\leadsto \frac{\color{blue}{b + \left(\mathsf{neg}\left(2\right)\right)}}{b \cdot b - 2 \cdot 2} \]
                5. lower-+.f64N/A

                  \[\leadsto \frac{\color{blue}{b + \left(\mathsf{neg}\left(2\right)\right)}}{b \cdot b - 2 \cdot 2} \]
                6. metadata-evalN/A

                  \[\leadsto \frac{b + \color{blue}{-2}}{b \cdot b - 2 \cdot 2} \]
                7. lift-*.f64N/A

                  \[\leadsto \frac{b + -2}{\color{blue}{b \cdot b} - 2 \cdot 2} \]
                8. sub-negN/A

                  \[\leadsto \frac{b + -2}{\color{blue}{b \cdot b + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
                9. lift-*.f64N/A

                  \[\leadsto \frac{b + -2}{\color{blue}{b \cdot b} + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
                10. lower-fma.f64N/A

                  \[\leadsto \frac{b + -2}{\color{blue}{\mathsf{fma}\left(b, b, \mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
                11. metadata-evalN/A

                  \[\leadsto \frac{b + -2}{\mathsf{fma}\left(b, b, \mathsf{neg}\left(\color{blue}{4}\right)\right)} \]
                12. metadata-eval61.1

                  \[\leadsto \frac{b + -2}{\mathsf{fma}\left(b, b, \color{blue}{-4}\right)} \]
              10. Applied egg-rr61.1%

                \[\leadsto \color{blue}{\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 15: 40.6% accurate, 21.0× speedup?

            \[\begin{array}{l} \\ \frac{1}{2 - a} \end{array} \]
            (FPCore (a b) :precision binary64 (/ 1.0 (- 2.0 a)))
            double code(double a, double b) {
            	return 1.0 / (2.0 - a);
            }
            
            real(8) function code(a, b)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                code = 1.0d0 / (2.0d0 - a)
            end function
            
            public static double code(double a, double b) {
            	return 1.0 / (2.0 - a);
            }
            
            def code(a, b):
            	return 1.0 / (2.0 - a)
            
            function code(a, b)
            	return Float64(1.0 / Float64(2.0 - a))
            end
            
            function tmp = code(a, b)
            	tmp = 1.0 / (2.0 - a);
            end
            
            code[a_, b_] := N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{1}{2 - a}
            \end{array}
            
            Derivation
            1. Initial program 98.0%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
              2. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
              3. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
              5. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
              6. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
              7. inv-powN/A

                \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
              8. pow-to-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
              9. lift-exp.f64N/A

                \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
              10. prod-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              11. lower-exp.f64N/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              12. lower-fma.f64N/A

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              13. lower-log.f6498.8

                \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
            4. Applied egg-rr98.8%

              \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
            5. Taylor expanded in b around 0

              \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
              3. exp-diffN/A

                \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
              4. remove-double-divN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              5. exp-negN/A

                \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              6. rem-exp-logN/A

                \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
              7. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              8. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              9. +-commutativeN/A

                \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
              10. distribute-lft-inN/A

                \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
              11. exp-negN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              12. lft-mult-inverseN/A

                \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              13. *-rgt-identityN/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
              14. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
              15. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
              16. lower-exp.f64N/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
              17. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
              18. lower-neg.f6462.9

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
            7. Simplified62.9%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
            8. Taylor expanded in a around 0

              \[\leadsto \frac{1}{\color{blue}{2 + -1 \cdot a}} \]
            9. Step-by-step derivation
              1. neg-mul-1N/A

                \[\leadsto \frac{1}{2 + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto \frac{1}{\color{blue}{2 - a}} \]
              3. lower--.f6439.9

                \[\leadsto \frac{1}{\color{blue}{2 - a}} \]
            10. Simplified39.9%

              \[\leadsto \frac{1}{\color{blue}{2 - a}} \]
            11. Add Preprocessing

            Alternative 16: 39.9% accurate, 45.0× speedup?

            \[\begin{array}{l} \\ \mathsf{fma}\left(0.25, a, 0.5\right) \end{array} \]
            (FPCore (a b) :precision binary64 (fma 0.25 a 0.5))
            double code(double a, double b) {
            	return fma(0.25, a, 0.5);
            }
            
            function code(a, b)
            	return fma(0.25, a, 0.5)
            end
            
            code[a_, b_] := N[(0.25 * a + 0.5), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \mathsf{fma}\left(0.25, a, 0.5\right)
            \end{array}
            
            Derivation
            1. Initial program 98.0%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-exp.f64N/A

                \[\leadsto \frac{\color{blue}{e^{a}}}{e^{a} + e^{b}} \]
              2. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a}} + e^{b}} \]
              3. lift-exp.f64N/A

                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{e^{a}}{\color{blue}{e^{a} + e^{b}}} \]
              5. clear-numN/A

                \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}} \]
              6. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
              7. inv-powN/A

                \[\leadsto \color{blue}{{\left(e^{a} + e^{b}\right)}^{-1}} \cdot e^{a} \]
              8. pow-to-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1}} \cdot e^{a} \]
              9. lift-exp.f64N/A

                \[\leadsto e^{\log \left(e^{a} + e^{b}\right) \cdot -1} \cdot \color{blue}{e^{a}} \]
              10. prod-expN/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              11. lower-exp.f64N/A

                \[\leadsto \color{blue}{e^{\log \left(e^{a} + e^{b}\right) \cdot -1 + a}} \]
              12. lower-fma.f64N/A

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
              13. lower-log.f6498.8

                \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \left(e^{a} + e^{b}\right)}, -1, a\right)} \]
            4. Applied egg-rr98.8%

              \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}} \]
            5. Taylor expanded in b around 0

              \[\leadsto \color{blue}{e^{a + -1 \cdot \log \left(1 + e^{a}\right)}} \]
            6. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto e^{a + \color{blue}{\left(\mathsf{neg}\left(\log \left(1 + e^{a}\right)\right)\right)}} \]
              2. unsub-negN/A

                \[\leadsto e^{\color{blue}{a - \log \left(1 + e^{a}\right)}} \]
              3. exp-diffN/A

                \[\leadsto \color{blue}{\frac{e^{a}}{e^{\log \left(1 + e^{a}\right)}}} \]
              4. remove-double-divN/A

                \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{e^{a}}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              5. exp-negN/A

                \[\leadsto \frac{\frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)}}}}{e^{\log \left(1 + e^{a}\right)}} \]
              6. rem-exp-logN/A

                \[\leadsto \frac{\frac{1}{e^{\mathsf{neg}\left(a\right)}}}{\color{blue}{1 + e^{a}}} \]
              7. associate-/r*N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              8. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \left(1 + e^{a}\right)}} \]
              9. +-commutativeN/A

                \[\leadsto \frac{1}{e^{\mathsf{neg}\left(a\right)} \cdot \color{blue}{\left(e^{a} + 1\right)}} \]
              10. distribute-lft-inN/A

                \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{neg}\left(a\right)} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1}} \]
              11. exp-negN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              12. lft-mult-inverseN/A

                \[\leadsto \frac{1}{\color{blue}{1} + e^{\mathsf{neg}\left(a\right)} \cdot 1} \]
              13. *-rgt-identityN/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{\mathsf{neg}\left(a\right)}}} \]
              14. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{\mathsf{neg}\left(a\right)}}} \]
              15. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-1 \cdot a}}} \]
              16. lower-exp.f64N/A

                \[\leadsto \frac{1}{1 + \color{blue}{e^{-1 \cdot a}}} \]
              17. neg-mul-1N/A

                \[\leadsto \frac{1}{1 + e^{\color{blue}{\mathsf{neg}\left(a\right)}}} \]
              18. lower-neg.f6462.9

                \[\leadsto \frac{1}{1 + e^{\color{blue}{-a}}} \]
            7. Simplified62.9%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{-a}}} \]
            8. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{2} + \frac{1}{4} \cdot a} \]
            9. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{\frac{1}{4} \cdot a + \frac{1}{2}} \]
              2. lower-fma.f6439.3

                \[\leadsto \color{blue}{\mathsf{fma}\left(0.25, a, 0.5\right)} \]
            10. Simplified39.3%

              \[\leadsto \color{blue}{\mathsf{fma}\left(0.25, a, 0.5\right)} \]
            11. Add Preprocessing

            Alternative 17: 39.7% accurate, 315.0× speedup?

            \[\begin{array}{l} \\ 0.5 \end{array} \]
            (FPCore (a b) :precision binary64 0.5)
            double code(double a, double b) {
            	return 0.5;
            }
            
            real(8) function code(a, b)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                code = 0.5d0
            end function
            
            public static double code(double a, double b) {
            	return 0.5;
            }
            
            def code(a, b):
            	return 0.5
            
            function code(a, b)
            	return 0.5
            end
            
            function tmp = code(a, b)
            	tmp = 0.5;
            end
            
            code[a_, b_] := 0.5
            
            \begin{array}{l}
            
            \\
            0.5
            \end{array}
            
            Derivation
            1. Initial program 98.0%

              \[\frac{e^{a}}{e^{a} + e^{b}} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{1}{\color{blue}{1 + e^{b}}} \]
              3. lower-exp.f6484.2

                \[\leadsto \frac{1}{1 + \color{blue}{e^{b}}} \]
            5. Simplified84.2%

              \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
            6. Taylor expanded in b around 0

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

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

              Developer Target 1: 100.0% accurate, 2.7× speedup?

              \[\begin{array}{l} \\ \frac{1}{1 + e^{b - a}} \end{array} \]
              (FPCore (a b) :precision binary64 (/ 1.0 (+ 1.0 (exp (- b a)))))
              double code(double a, double b) {
              	return 1.0 / (1.0 + exp((b - a)));
              }
              
              real(8) function code(a, b)
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  code = 1.0d0 / (1.0d0 + exp((b - a)))
              end function
              
              public static double code(double a, double b) {
              	return 1.0 / (1.0 + Math.exp((b - a)));
              }
              
              def code(a, b):
              	return 1.0 / (1.0 + math.exp((b - a)))
              
              function code(a, b)
              	return Float64(1.0 / Float64(1.0 + exp(Float64(b - a))))
              end
              
              function tmp = code(a, b)
              	tmp = 1.0 / (1.0 + exp((b - a)));
              end
              
              code[a_, b_] := N[(1.0 / N[(1.0 + N[Exp[N[(b - a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{1}{1 + e^{b - a}}
              \end{array}
              

              Reproduce

              ?
              herbie shell --seed 2024214 
              (FPCore (a b)
                :name "Quotient of sum of exps"
                :precision binary64
              
                :alt
                (! :herbie-platform default (/ 1 (+ 1 (exp (- b a)))))
              
                (/ (exp a) (+ (exp a) (exp b))))