Quotient of sum of exps

Percentage Accurate: 98.9% → 98.9%
Time: 9.1s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 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.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 99.2%

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

Alternative 2: 98.4% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -6000000:\\ \;\;\;\;e^{a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -6000000.0) (* (exp a) 0.5) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
	double tmp;
	if (a <= -6000000.0) {
		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 <= (-6000000.0d0)) 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 <= -6000000.0) {
		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 <= -6000000.0:
		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 <= -6000000.0)
		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 <= -6000000.0)
		tmp = exp(a) * 0.5;
	else
		tmp = 1.0 / (exp(b) + 1.0);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -6000000.0], 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 -6000000:\\
\;\;\;\;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 < -6e6

    1. Initial program 100.0%

      \[\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 -6e6 < a

        1. Initial program 98.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.1

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

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

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

      Alternative 3: 94.9% accurate, 2.7× speedup?

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

        1. Initial program 96.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. Applied egg-rr100.0%

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

        if -14.5999999999999996 < b < 5.8e50

        1. Initial program 100.0%

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

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

              \[\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-*.f6495.1

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

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

            if 5.8e50 < b < 1.6000000000000001e77

            1. Initial program 100.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. 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.f644.3

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

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            9. Step-by-step derivation
              1. lift-fma.f64N/A

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) - 2 \cdot 2\right)}{\left(\left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) - 2 \cdot 2\right) \cdot \mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), 2\right)}} \]
            10. Applied egg-rr91.3%

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

            if 1.6000000000000001e77 < b < 2.00000000000000007e154

            1. Initial program 100.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. 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.f646.1

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

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            9. Step-by-step derivation
              1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\color{blue}{\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot b\right)} \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
              10. associate-*l*N/A

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot \left(b \cdot \color{blue}{\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot b\right)}\right) + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
              12. associate-*r*N/A

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right), \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot b, \mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
            10. Applied egg-rr100.0%

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

            if 2.00000000000000007e154 < b

            1. Initial program 100.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. 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.f64100.0

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

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            9. Taylor expanded in b around inf

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

                \[\leadsto \color{blue}{\frac{2}{{b}^{2}}} \]
              2. unpow2N/A

                \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
              3. lower-*.f64100.0

                \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
            11. Simplified100.0%

              \[\leadsto \color{blue}{\frac{2}{b \cdot b}} \]
          4. Recombined 5 regimes into one program.
          5. Final simplification96.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -14.6:\\ \;\;\;\;e^{b} + 1\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{+50}:\\ \;\;\;\;e^{a} \cdot 0.5\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{+77}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(b, 0.5, 1\right), b \cdot \mathsf{fma}\left(0.5, b \cdot b, b\right), -4\right)}{\mathsf{fma}\left(\mathsf{fma}\left(b, 0.5, 1\right), b \cdot \mathsf{fma}\left(0.5, b \cdot b, b\right), -4\right) \cdot \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+154}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), -2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(b, 0.5, 1\right), b \cdot \mathsf{fma}\left(0.5, b \cdot b, b\right), -4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \]
          6. Add Preprocessing

          Alternative 4: 77.1% accurate, 2.9× speedup?

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

            1. Initial program 96.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. Applied egg-rr100.0%

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

            if -1.6000000000000001 < b < 1.6000000000000001e77

            1. Initial program 100.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.f6467.7

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

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

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

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            9. Step-by-step derivation
              1. lift-fma.f64N/A

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) - 2 \cdot 2\right)}{\left(\left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) - 2 \cdot 2\right) \cdot \mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), 2\right)}} \]
            10. Applied egg-rr62.7%

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

            if 1.6000000000000001e77 < b < 2.00000000000000007e154

            1. Initial program 100.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. 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.f646.1

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

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            9. Step-by-step derivation
              1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\color{blue}{\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot b\right)} \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
              10. associate-*l*N/A

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot \left(b \cdot \color{blue}{\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot b\right)}\right) + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
              12. associate-*r*N/A

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right), \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot b, \mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
            10. Applied egg-rr100.0%

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

            if 2.00000000000000007e154 < b

            1. Initial program 100.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. 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.f64100.0

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

              \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
            9. Taylor expanded in b around inf

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

                \[\leadsto \color{blue}{\frac{2}{{b}^{2}}} \]
              2. unpow2N/A

                \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
              3. lower-*.f64100.0

                \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
            11. Simplified100.0%

              \[\leadsto \color{blue}{\frac{2}{b \cdot b}} \]
          3. Recombined 4 regimes into one program.
          4. Final simplification77.4%

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

          Alternative 5: 62.2% accurate, 3.2× speedup?

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

            1. Initial program 98.9%

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left({a}^{2}, \frac{1}{480} \cdot {a}^{2} - \frac{1}{48}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                5. unpow2N/A

                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\color{blue}{a \cdot a}, \frac{1}{480} \cdot {a}^{2} - \frac{1}{48}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                6. lower-*.f64N/A

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

                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\frac{1}{480} \cdot {a}^{2} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right)}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                8. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{{a}^{2} \cdot \frac{1}{480}} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right), \frac{1}{4}\right), \frac{1}{2}\right) \]
                9. unpow2N/A

                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\left(a \cdot a\right)} \cdot \frac{1}{480} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right), \frac{1}{4}\right), \frac{1}{2}\right) \]
                10. associate-*l*N/A

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

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

                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\mathsf{fma}\left(a, a \cdot \frac{1}{480}, \frac{-1}{48}\right)}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                13. lower-*.f6452.3

                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, \color{blue}{a \cdot 0.0020833333333333333}, -0.020833333333333332\right), 0.25\right), 0.5\right) \]
              4. Simplified52.3%

                \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, a \cdot 0.0020833333333333333, -0.020833333333333332\right), 0.25\right), 0.5\right)} \]

              if 9.6000000000000006e-65 < b < 1.6000000000000001e77

              1. Initial program 100.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.f6472.8

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

                \[\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.f6418.8

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

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
              9. Step-by-step derivation
                1. lift-fma.f64N/A

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) - 2 \cdot 2\right)}{\left(\left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) - 2 \cdot 2\right) \cdot \mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), 2\right)}} \]
              10. Applied egg-rr48.7%

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

              if 1.6000000000000001e77 < b < 2.00000000000000007e154

              1. Initial program 100.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. 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.f646.1

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

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
              9. Step-by-step derivation
                1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\color{blue}{\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot b\right)} \cdot \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
                10. associate-*l*N/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot \left(b \cdot \color{blue}{\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right) \cdot b\right)}\right) + \left(\mathsf{neg}\left(2 \cdot 2\right)\right)} \]
                12. associate-*r*N/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{2}, 1\right), -2\right)}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(b, \frac{1}{2}, 1\right), \left(b \cdot \mathsf{fma}\left(b, \frac{1}{2}, 1\right)\right) \cdot b, \mathsf{neg}\left(2 \cdot 2\right)\right)}} \]
              10. Applied egg-rr100.0%

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

              if 2.00000000000000007e154 < b

              1. Initial program 100.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. 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.f64100.0

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

                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
              9. Taylor expanded in b around inf

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

                  \[\leadsto \color{blue}{\frac{2}{{b}^{2}}} \]
                2. unpow2N/A

                  \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
                3. lower-*.f64100.0

                  \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
              11. Simplified100.0%

                \[\leadsto \color{blue}{\frac{2}{b \cdot b}} \]
            5. Recombined 4 regimes into one program.
            6. Final simplification60.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 9.6 \cdot 10^{-65}:\\ \;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, a \cdot 0.0020833333333333333, -0.020833333333333332\right), 0.25\right), 0.5\right)\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{+77}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(b, 0.5, 1\right), b \cdot \mathsf{fma}\left(0.5, b \cdot b, b\right), -4\right)}{\mathsf{fma}\left(\mathsf{fma}\left(b, 0.5, 1\right), b \cdot \mathsf{fma}\left(0.5, b \cdot b, b\right), -4\right) \cdot \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+154}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), -2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(b, 0.5, 1\right), b \cdot \mathsf{fma}\left(0.5, b \cdot b, b\right), -4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \]
            7. Add Preprocessing

            Alternative 6: 60.7% accurate, 7.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.1 \cdot 10^{-9}:\\ \;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, a \cdot 0.0020833333333333333, -0.020833333333333332\right), 0.25\right), 0.5\right)\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{+94}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\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.1e-9)
               (fma
                a
                (fma
                 (* a a)
                 (fma a (* a 0.0020833333333333333) -0.020833333333333332)
                 0.25)
                0.5)
               (if (<= b 1.65e+94)
                 (* -0.020833333333333332 (* a (* a a)))
                 (/ 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.1e-9) {
            		tmp = fma(a, fma((a * a), fma(a, (a * 0.0020833333333333333), -0.020833333333333332), 0.25), 0.5);
            	} else if (b <= 1.65e+94) {
            		tmp = -0.020833333333333332 * (a * (a * a));
            	} 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.1e-9)
            		tmp = fma(a, fma(Float64(a * a), fma(a, Float64(a * 0.0020833333333333333), -0.020833333333333332), 0.25), 0.5);
            	elseif (b <= 1.65e+94)
            		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
            	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.1e-9], N[(a * N[(N[(a * a), $MachinePrecision] * N[(a * N[(a * 0.0020833333333333333), $MachinePrecision] + -0.020833333333333332), $MachinePrecision] + 0.25), $MachinePrecision] + 0.5), $MachinePrecision], If[LessEqual[b, 1.65e+94], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $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.1 \cdot 10^{-9}:\\
            \;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, a \cdot 0.0020833333333333333, -0.020833333333333332\right), 0.25\right), 0.5\right)\\
            
            \mathbf{elif}\;b \leq 1.65 \cdot 10^{+94}:\\
            \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\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 3 regimes
            2. if b < 1.0999999999999999e-9

              1. Initial program 98.9%

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left({a}^{2}, \frac{1}{480} \cdot {a}^{2} - \frac{1}{48}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                  5. unpow2N/A

                    \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\color{blue}{a \cdot a}, \frac{1}{480} \cdot {a}^{2} - \frac{1}{48}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                  6. lower-*.f64N/A

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

                    \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\frac{1}{480} \cdot {a}^{2} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right)}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                  8. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{{a}^{2} \cdot \frac{1}{480}} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right), \frac{1}{4}\right), \frac{1}{2}\right) \]
                  9. unpow2N/A

                    \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\left(a \cdot a\right)} \cdot \frac{1}{480} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right), \frac{1}{4}\right), \frac{1}{2}\right) \]
                  10. associate-*l*N/A

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

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

                    \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\mathsf{fma}\left(a, a \cdot \frac{1}{480}, \frac{-1}{48}\right)}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                  13. lower-*.f6452.0

                    \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, \color{blue}{a \cdot 0.0020833333333333333}, -0.020833333333333332\right), 0.25\right), 0.5\right) \]
                4. Simplified52.0%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, a \cdot 0.0020833333333333333, -0.020833333333333332\right), 0.25\right), 0.5\right)} \]

                if 1.0999999999999999e-9 < b < 1.65e94

                1. Initial program 100.0%

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                    5. unpow2N/A

                      \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                    6. lower-*.f642.6

                      \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                  4. Simplified2.6%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]
                  5. Taylor expanded in a around inf

                    \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                  6. Step-by-step derivation
                    1. lower-*.f64N/A

                      \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                    2. cube-multN/A

                      \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
                    3. unpow2N/A

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

                      \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot {a}^{2}\right)} \]
                    5. unpow2N/A

                      \[\leadsto \frac{-1}{48} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                    6. lower-*.f6440.1

                      \[\leadsto -0.020833333333333332 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                  7. Simplified40.1%

                    \[\leadsto \color{blue}{-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)} \]

                  if 1.65e94 < b

                  1. Initial program 100.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. 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.f6497.8

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

                    \[\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)}} \]
                5. Recombined 3 regimes into one program.
                6. Add Preprocessing

                Alternative 7: 61.0% accurate, 7.9× speedup?

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

                  1. Initial program 98.9%

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left({a}^{2}, \frac{1}{480} \cdot {a}^{2} - \frac{1}{48}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                      5. unpow2N/A

                        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\color{blue}{a \cdot a}, \frac{1}{480} \cdot {a}^{2} - \frac{1}{48}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                      6. lower-*.f64N/A

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

                        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\frac{1}{480} \cdot {a}^{2} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right)}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                      8. *-commutativeN/A

                        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{{a}^{2} \cdot \frac{1}{480}} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right), \frac{1}{4}\right), \frac{1}{2}\right) \]
                      9. unpow2N/A

                        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\left(a \cdot a\right)} \cdot \frac{1}{480} + \left(\mathsf{neg}\left(\frac{1}{48}\right)\right), \frac{1}{4}\right), \frac{1}{2}\right) \]
                      10. associate-*l*N/A

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

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

                        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \color{blue}{\mathsf{fma}\left(a, a \cdot \frac{1}{480}, \frac{-1}{48}\right)}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                      13. lower-*.f6452.0

                        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, \color{blue}{a \cdot 0.0020833333333333333}, -0.020833333333333332\right), 0.25\right), 0.5\right) \]
                    4. Simplified52.0%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a \cdot a, \mathsf{fma}\left(a, a \cdot 0.0020833333333333333, -0.020833333333333332\right), 0.25\right), 0.5\right)} \]

                    if 1.0999999999999999e-9 < b < 5.49999999999999981e102

                    1. Initial program 100.0%

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                        5. unpow2N/A

                          \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                        6. lower-*.f642.6

                          \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                      4. Simplified2.6%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]
                      5. Taylor expanded in a around inf

                        \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                      6. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                        2. cube-multN/A

                          \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
                        3. unpow2N/A

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

                          \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot {a}^{2}\right)} \]
                        5. unpow2N/A

                          \[\leadsto \frac{-1}{48} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                        6. lower-*.f6438.9

                          \[\leadsto -0.020833333333333332 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                      7. Simplified38.9%

                        \[\leadsto \color{blue}{-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)} \]

                      if 5.49999999999999981e102 < b

                      1. Initial program 100.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. 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.f6483.7

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

                        \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
                      9. Taylor expanded in b around inf

                        \[\leadsto \color{blue}{\frac{2 - 4 \cdot \frac{1}{b}}{{b}^{2}}} \]
                      10. Step-by-step derivation
                        1. unpow2N/A

                          \[\leadsto \frac{2 - 4 \cdot \frac{1}{b}}{\color{blue}{b \cdot b}} \]
                        2. associate-/r*N/A

                          \[\leadsto \color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{b}}{b}} \]
                        3. *-lft-identityN/A

                          \[\leadsto \frac{\frac{2 - 4 \cdot \frac{1}{b}}{\color{blue}{1 \cdot b}}}{b} \]
                        4. lft-mult-inverseN/A

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

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

                          \[\leadsto \frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b} \cdot \color{blue}{{b}^{2}}}}{b} \]
                        7. associate-/r*N/A

                          \[\leadsto \frac{\color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{{b}^{2}}}}{b} \]
                        8. associate-/l/N/A

                          \[\leadsto \color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{b \cdot {b}^{2}}} \]
                        9. unpow2N/A

                          \[\leadsto \frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{b \cdot \color{blue}{\left(b \cdot b\right)}} \]
                        10. cube-multN/A

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

                          \[\leadsto \color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{{b}^{3}}} \]
                        12. div-subN/A

                          \[\leadsto \frac{\color{blue}{\frac{2}{\frac{1}{b}} - \frac{4 \cdot \frac{1}{b}}{\frac{1}{b}}}}{{b}^{3}} \]
                        13. associate-/l*N/A

                          \[\leadsto \frac{\frac{2}{\frac{1}{b}} - \color{blue}{4 \cdot \frac{\frac{1}{b}}{\frac{1}{b}}}}{{b}^{3}} \]
                        14. *-inversesN/A

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

                          \[\leadsto \frac{\frac{2}{\frac{1}{b}} - \color{blue}{4}}{{b}^{3}} \]
                        16. sub-negN/A

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

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

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

                          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, b, \mathsf{neg}\left(4\right)\right)}}{{b}^{3}} \]
                        20. metadata-evalN/A

                          \[\leadsto \frac{\mathsf{fma}\left(2, b, \color{blue}{-4}\right)}{{b}^{3}} \]
                        21. cube-multN/A

                          \[\leadsto \frac{\mathsf{fma}\left(2, b, -4\right)}{\color{blue}{b \cdot \left(b \cdot b\right)}} \]
                      11. Simplified100.0%

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

                    Alternative 8: 60.9% accurate, 7.9× speedup?

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

                      1. Initial program 98.9%

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                          5. unpow2N/A

                            \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                          6. lower-*.f6451.9

                            \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                        4. Simplified51.9%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]

                        if 1.0999999999999999e-9 < b < 5.49999999999999981e102

                        1. Initial program 100.0%

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                            5. unpow2N/A

                              \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                            6. lower-*.f642.6

                              \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                          4. Simplified2.6%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]
                          5. Taylor expanded in a around inf

                            \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                          6. Step-by-step derivation
                            1. lower-*.f64N/A

                              \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                            2. cube-multN/A

                              \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
                            3. unpow2N/A

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

                              \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot {a}^{2}\right)} \]
                            5. unpow2N/A

                              \[\leadsto \frac{-1}{48} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                            6. lower-*.f6438.9

                              \[\leadsto -0.020833333333333332 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                          7. Simplified38.9%

                            \[\leadsto \color{blue}{-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)} \]

                          if 5.49999999999999981e102 < b

                          1. Initial program 100.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. 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.f6483.7

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

                            \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
                          9. Taylor expanded in b around inf

                            \[\leadsto \color{blue}{\frac{2 - 4 \cdot \frac{1}{b}}{{b}^{2}}} \]
                          10. Step-by-step derivation
                            1. unpow2N/A

                              \[\leadsto \frac{2 - 4 \cdot \frac{1}{b}}{\color{blue}{b \cdot b}} \]
                            2. associate-/r*N/A

                              \[\leadsto \color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{b}}{b}} \]
                            3. *-lft-identityN/A

                              \[\leadsto \frac{\frac{2 - 4 \cdot \frac{1}{b}}{\color{blue}{1 \cdot b}}}{b} \]
                            4. lft-mult-inverseN/A

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

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

                              \[\leadsto \frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b} \cdot \color{blue}{{b}^{2}}}}{b} \]
                            7. associate-/r*N/A

                              \[\leadsto \frac{\color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{{b}^{2}}}}{b} \]
                            8. associate-/l/N/A

                              \[\leadsto \color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{b \cdot {b}^{2}}} \]
                            9. unpow2N/A

                              \[\leadsto \frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{b \cdot \color{blue}{\left(b \cdot b\right)}} \]
                            10. cube-multN/A

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

                              \[\leadsto \color{blue}{\frac{\frac{2 - 4 \cdot \frac{1}{b}}{\frac{1}{b}}}{{b}^{3}}} \]
                            12. div-subN/A

                              \[\leadsto \frac{\color{blue}{\frac{2}{\frac{1}{b}} - \frac{4 \cdot \frac{1}{b}}{\frac{1}{b}}}}{{b}^{3}} \]
                            13. associate-/l*N/A

                              \[\leadsto \frac{\frac{2}{\frac{1}{b}} - \color{blue}{4 \cdot \frac{\frac{1}{b}}{\frac{1}{b}}}}{{b}^{3}} \]
                            14. *-inversesN/A

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

                              \[\leadsto \frac{\frac{2}{\frac{1}{b}} - \color{blue}{4}}{{b}^{3}} \]
                            16. sub-negN/A

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

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

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

                              \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(2, b, \mathsf{neg}\left(4\right)\right)}}{{b}^{3}} \]
                            20. metadata-evalN/A

                              \[\leadsto \frac{\mathsf{fma}\left(2, b, \color{blue}{-4}\right)}{{b}^{3}} \]
                            21. cube-multN/A

                              \[\leadsto \frac{\mathsf{fma}\left(2, b, -4\right)}{\color{blue}{b \cdot \left(b \cdot b\right)}} \]
                          11. Simplified100.0%

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

                        Alternative 9: 57.1% accurate, 10.5× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -8.5 \cdot 10^{+34}:\\ \;\;\;\;b \cdot \left(\left(b \cdot b\right) \cdot 0.020833333333333332\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 (<= a -8.5e+34)
                           (* b (* (* b b) 0.020833333333333332))
                           (/ 1.0 (fma b (fma b 0.5 1.0) 2.0))))
                        double code(double a, double b) {
                        	double tmp;
                        	if (a <= -8.5e+34) {
                        		tmp = b * ((b * b) * 0.020833333333333332);
                        	} else {
                        		tmp = 1.0 / fma(b, fma(b, 0.5, 1.0), 2.0);
                        	}
                        	return tmp;
                        }
                        
                        function code(a, b)
                        	tmp = 0.0
                        	if (a <= -8.5e+34)
                        		tmp = Float64(b * Float64(Float64(b * b) * 0.020833333333333332));
                        	else
                        		tmp = Float64(1.0 / fma(b, fma(b, 0.5, 1.0), 2.0));
                        	end
                        	return tmp
                        end
                        
                        code[a_, b_] := If[LessEqual[a, -8.5e+34], N[(b * N[(N[(b * b), $MachinePrecision] * 0.020833333333333332), $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}\;a \leq -8.5 \cdot 10^{+34}:\\
                        \;\;\;\;b \cdot \left(\left(b \cdot b\right) \cdot 0.020833333333333332\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 a < -8.5000000000000003e34

                          1. Initial program 100.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.f6433.5

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(b, \color{blue}{{b}^{2} \cdot \frac{1}{48}} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right), \frac{1}{2}\right) \]
                            5. unpow2N/A

                              \[\leadsto \mathsf{fma}\left(b, \color{blue}{\left(b \cdot b\right)} \cdot \frac{1}{48} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right), \frac{1}{2}\right) \]
                            6. associate-*l*N/A

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

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

                              \[\leadsto \mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, b \cdot \frac{1}{48}, \frac{-1}{4}\right)}, \frac{1}{2}\right) \]
                            9. lower-*.f642.7

                              \[\leadsto \mathsf{fma}\left(b, \mathsf{fma}\left(b, \color{blue}{b \cdot 0.020833333333333332}, -0.25\right), 0.5\right) \]
                          8. Simplified2.7%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, b \cdot 0.020833333333333332, -0.25\right), 0.5\right)} \]
                          9. Taylor expanded in b around inf

                            \[\leadsto \color{blue}{\frac{1}{48} \cdot {b}^{3}} \]
                          10. Step-by-step derivation
                            1. unpow3N/A

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

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

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

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

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

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

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

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

                              \[\leadsto b \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot 0.020833333333333332\right) \]
                          11. Simplified45.0%

                            \[\leadsto \color{blue}{b \cdot \left(\left(b \cdot b\right) \cdot 0.020833333333333332\right)} \]

                          if -8.5000000000000003e34 < a

                          1. Initial program 98.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.f6497.1

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

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

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

                            \[\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 10: 57.2% accurate, 10.9× speedup?

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

                          1. Initial program 98.9%

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                              5. unpow2N/A

                                \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                              6. lower-*.f6451.9

                                \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                            4. Simplified51.9%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]

                            if 1.0999999999999999e-9 < b < 1.14999999999999998e113

                            1. Initial program 100.0%

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                                5. unpow2N/A

                                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                                6. lower-*.f642.6

                                  \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                              4. Simplified2.6%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]
                              5. Taylor expanded in a around inf

                                \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                              6. Step-by-step derivation
                                1. lower-*.f64N/A

                                  \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                                2. cube-multN/A

                                  \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
                                3. unpow2N/A

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

                                  \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot {a}^{2}\right)} \]
                                5. unpow2N/A

                                  \[\leadsto \frac{-1}{48} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                                6. lower-*.f6438.9

                                  \[\leadsto -0.020833333333333332 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                              7. Simplified38.9%

                                \[\leadsto \color{blue}{-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)} \]

                              if 1.14999999999999998e113 < b

                              1. Initial program 100.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. 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.f6483.7

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

                                \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
                              9. Taylor expanded in b around inf

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

                                  \[\leadsto \color{blue}{\frac{2}{{b}^{2}}} \]
                                2. unpow2N/A

                                  \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
                                3. lower-*.f6483.7

                                  \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
                              11. Simplified83.7%

                                \[\leadsto \color{blue}{\frac{2}{b \cdot b}} \]
                            5. Recombined 3 regimes into one program.
                            6. Add Preprocessing

                            Alternative 11: 57.4% accurate, 10.9× speedup?

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

                              1. Initial program 98.9%

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

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

                                  \[\leadsto \color{blue}{\frac{1}{2} + \frac{1}{4} \cdot a} \]
                                3. Step-by-step derivation
                                  1. +-commutativeN/A

                                    \[\leadsto \color{blue}{\frac{1}{4} \cdot a + \frac{1}{2}} \]
                                  2. *-commutativeN/A

                                    \[\leadsto \color{blue}{a \cdot \frac{1}{4}} + \frac{1}{2} \]
                                  3. lower-fma.f6451.0

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]
                                4. Simplified51.0%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]

                                if 340 < b < 1.14999999999999998e113

                                1. Initial program 100.0%

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                                    5. unpow2N/A

                                      \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                                    6. lower-*.f642.7

                                      \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                                  4. Simplified2.7%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]
                                  5. Taylor expanded in a around inf

                                    \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                                  6. Step-by-step derivation
                                    1. lower-*.f64N/A

                                      \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                                    2. cube-multN/A

                                      \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
                                    3. unpow2N/A

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

                                      \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot {a}^{2}\right)} \]
                                    5. unpow2N/A

                                      \[\leadsto \frac{-1}{48} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                                    6. lower-*.f6443.5

                                      \[\leadsto -0.020833333333333332 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                                  7. Simplified43.5%

                                    \[\leadsto \color{blue}{-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)} \]

                                  if 1.14999999999999998e113 < b

                                  1. Initial program 100.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. 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.f6483.7

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

                                    \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}} \]
                                  9. Taylor expanded in b around inf

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

                                      \[\leadsto \color{blue}{\frac{2}{{b}^{2}}} \]
                                    2. unpow2N/A

                                      \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
                                    3. lower-*.f6483.7

                                      \[\leadsto \frac{2}{\color{blue}{b \cdot b}} \]
                                  11. Simplified83.7%

                                    \[\leadsto \color{blue}{\frac{2}{b \cdot b}} \]
                                5. Recombined 3 regimes into one program.
                                6. Add Preprocessing

                                Alternative 12: 50.9% accurate, 14.3× speedup?

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

                                  1. Initial program 98.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.f6435.9

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(b, \color{blue}{{b}^{2} \cdot \frac{1}{48}} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right), \frac{1}{2}\right) \]
                                    5. unpow2N/A

                                      \[\leadsto \mathsf{fma}\left(b, \color{blue}{\left(b \cdot b\right)} \cdot \frac{1}{48} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right), \frac{1}{2}\right) \]
                                    6. associate-*l*N/A

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

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

                                      \[\leadsto \mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, b \cdot \frac{1}{48}, \frac{-1}{4}\right)}, \frac{1}{2}\right) \]
                                    9. lower-*.f642.7

                                      \[\leadsto \mathsf{fma}\left(b, \mathsf{fma}\left(b, \color{blue}{b \cdot 0.020833333333333332}, -0.25\right), 0.5\right) \]
                                  8. Simplified2.7%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, b \cdot 0.020833333333333332, -0.25\right), 0.5\right)} \]
                                  9. Taylor expanded in b around inf

                                    \[\leadsto \color{blue}{\frac{1}{48} \cdot {b}^{3}} \]
                                  10. Step-by-step derivation
                                    1. unpow3N/A

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

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

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

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

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

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

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

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

                                      \[\leadsto b \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot 0.020833333333333332\right) \]
                                  11. Simplified41.0%

                                    \[\leadsto \color{blue}{b \cdot \left(\left(b \cdot b\right) \cdot 0.020833333333333332\right)} \]

                                  if -2 < a

                                  1. Initial program 99.4%

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

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

                                      \[\leadsto \color{blue}{\frac{1}{2} + \frac{1}{4} \cdot a} \]
                                    3. Step-by-step derivation
                                      1. +-commutativeN/A

                                        \[\leadsto \color{blue}{\frac{1}{4} \cdot a + \frac{1}{2}} \]
                                      2. *-commutativeN/A

                                        \[\leadsto \color{blue}{a \cdot \frac{1}{4}} + \frac{1}{2} \]
                                      3. lower-fma.f6453.9

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]
                                    4. Simplified53.9%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]
                                  5. Recombined 2 regimes into one program.
                                  6. Add Preprocessing

                                  Alternative 13: 51.1% accurate, 14.3× speedup?

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

                                    1. Initial program 98.9%

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

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

                                        \[\leadsto \color{blue}{\frac{1}{2} + \frac{1}{4} \cdot a} \]
                                      3. Step-by-step derivation
                                        1. +-commutativeN/A

                                          \[\leadsto \color{blue}{\frac{1}{4} \cdot a + \frac{1}{2}} \]
                                        2. *-commutativeN/A

                                          \[\leadsto \color{blue}{a \cdot \frac{1}{4}} + \frac{1}{2} \]
                                        3. lower-fma.f6451.0

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]
                                      4. Simplified51.0%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]

                                      if 340 < b

                                      1. Initial program 100.0%

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(\frac{-1}{48}, {a}^{2}, \frac{1}{4}\right)}, \frac{1}{2}\right) \]
                                          5. unpow2N/A

                                            \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{48}, \color{blue}{a \cdot a}, \frac{1}{4}\right), \frac{1}{2}\right) \]
                                          6. lower-*.f642.6

                                            \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, \color{blue}{a \cdot a}, 0.25\right), 0.5\right) \]
                                        4. Simplified2.6%

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(-0.020833333333333332, a \cdot a, 0.25\right), 0.5\right)} \]
                                        5. Taylor expanded in a around inf

                                          \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                                        6. Step-by-step derivation
                                          1. lower-*.f64N/A

                                            \[\leadsto \color{blue}{\frac{-1}{48} \cdot {a}^{3}} \]
                                          2. cube-multN/A

                                            \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
                                          3. unpow2N/A

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

                                            \[\leadsto \frac{-1}{48} \cdot \color{blue}{\left(a \cdot {a}^{2}\right)} \]
                                          5. unpow2N/A

                                            \[\leadsto \frac{-1}{48} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                                          6. lower-*.f6440.0

                                            \[\leadsto -0.020833333333333332 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
                                        7. Simplified40.0%

                                          \[\leadsto \color{blue}{-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)} \]
                                      5. Recombined 2 regimes into one program.
                                      6. Add Preprocessing

                                      Alternative 14: 39.5% accurate, 45.0× speedup?

                                      \[\begin{array}{l} \\ \mathsf{fma}\left(a, 0.25, 0.5\right) \end{array} \]
                                      (FPCore (a b) :precision binary64 (fma a 0.25 0.5))
                                      double code(double a, double b) {
                                      	return fma(a, 0.25, 0.5);
                                      }
                                      
                                      function code(a, b)
                                      	return fma(a, 0.25, 0.5)
                                      end
                                      
                                      code[a_, b_] := N[(a * 0.25 + 0.5), $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \mathsf{fma}\left(a, 0.25, 0.5\right)
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 99.2%

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

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

                                          \[\leadsto \color{blue}{\frac{1}{2} + \frac{1}{4} \cdot a} \]
                                        3. Step-by-step derivation
                                          1. +-commutativeN/A

                                            \[\leadsto \color{blue}{\frac{1}{4} \cdot a + \frac{1}{2}} \]
                                          2. *-commutativeN/A

                                            \[\leadsto \color{blue}{a \cdot \frac{1}{4}} + \frac{1}{2} \]
                                          3. lower-fma.f6439.0

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(a, 0.25, 0.5\right)} \]
                                        4. Simplified39.0%

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

                                        Alternative 15: 39.3% 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 99.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.f6480.5

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

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

                                            \[\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 2024215 
                                          (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))))