Quotient of sum of exps

Percentage Accurate: 98.9% → 99.3%
Time: 9.0s
Alternatives: 17
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right)\\ \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{e^{a}}{1 + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, t\_0, 1\right)}{\mathsf{fma}\left(a, t\_0, e^{b} + 1\right)}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (fma a (fma a 0.16666666666666666 0.5) 1.0)))
   (if (<= (exp a) 0.0)
     (/ (exp a) (+ 1.0 1.0))
     (/ (fma a t_0 1.0) (fma a t_0 (+ (exp b) 1.0))))))
double code(double a, double b) {
	double t_0 = fma(a, fma(a, 0.16666666666666666, 0.5), 1.0);
	double tmp;
	if (exp(a) <= 0.0) {
		tmp = exp(a) / (1.0 + 1.0);
	} else {
		tmp = fma(a, t_0, 1.0) / fma(a, t_0, (exp(b) + 1.0));
	}
	return tmp;
}
function code(a, b)
	t_0 = fma(a, fma(a, 0.16666666666666666, 0.5), 1.0)
	tmp = 0.0
	if (exp(a) <= 0.0)
		tmp = Float64(exp(a) / Float64(1.0 + 1.0));
	else
		tmp = Float64(fma(a, t_0, 1.0) / fma(a, t_0, Float64(exp(b) + 1.0)));
	end
	return tmp
end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[Exp[a], $MachinePrecision], 0.0], N[(N[Exp[a], $MachinePrecision] / N[(1.0 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * t$95$0 + 1.0), $MachinePrecision] / N[(a * t$95$0 + N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right)\\
\mathbf{if}\;e^{a} \leq 0:\\
\;\;\;\;\frac{e^{a}}{1 + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t\_0, 1\right)}{\mathsf{fma}\left(a, t\_0, e^{b} + 1\right)}\\


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

    1. Initial program 98.5%

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

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

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

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

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

        if 0.0 < (exp.f64 a)

        1. Initial program 99.5%

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

          \[\leadsto \frac{e^{a}}{\color{blue}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)\right)}} \]
        4. Step-by-step derivation
          1. associate-+r+N/A

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

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

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

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

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

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

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

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

            \[\leadsto \frac{e^{a}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), \color{blue}{1 + e^{b}}\right)} \]
          10. lower-exp.f6498.7

            \[\leadsto \frac{e^{a}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + \color{blue}{e^{b}}\right)} \]
        5. Applied rewrites98.7%

          \[\leadsto \frac{e^{a}}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + e^{b}\right)}} \]
        6. Taylor expanded in a around 0

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

            \[\leadsto \frac{\color{blue}{a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right) + 1}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), 1 + e^{b}\right)} \]
        8. Applied rewrites99.7%

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1\right)}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + e^{b}\right)} \]
      4. Recombined 2 regimes into one program.
      5. Final simplification99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{e^{a}}{1 + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1\right)}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), e^{b} + 1\right)}\\ \end{array} \]
      6. Add Preprocessing

      Alternative 2: 62.2% accurate, 0.7× speedup?

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

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

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

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

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

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

            \[\leadsto \frac{1}{-1 \cdot \left({b}^{3} \cdot \color{blue}{\left(-1 \cdot \frac{\frac{1}{2} + \frac{1}{b}}{b} - \frac{1}{6}\right)}\right)} \]
          3. Step-by-step derivation
            1. Applied rewrites47.3%

              \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \color{blue}{\left(-\left(-0.16666666666666666 - \frac{0.5 + \frac{1}{b}}{b}\right)\right)}\right)} \]
            2. Step-by-step derivation
              1. Applied rewrites54.7%

                \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \left(-\left(-0.16666666666666666 - \frac{\left(0.125 + \frac{1}{b \cdot \left(b \cdot b\right)}\right) \cdot \frac{1}{b}}{0.25 + \frac{\frac{1}{b} - 0.5}{b}}\right)\right)\right)} \]

              if 0.0 < (/.f64 (exp.f64 a) (+.f64 (exp.f64 a) (exp.f64 b)))

              1. Initial program 98.7%

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

                \[\leadsto \frac{e^{a}}{\color{blue}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)\right)}} \]
              4. Step-by-step derivation
                1. associate-+r+N/A

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{e^{a}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), \color{blue}{1 + e^{b}}\right)} \]
                10. lower-exp.f6498.4

                  \[\leadsto \frac{e^{a}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + \color{blue}{e^{b}}\right)} \]
              5. Applied rewrites98.4%

                \[\leadsto \frac{e^{a}}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + e^{b}\right)}} \]
              6. Taylor expanded in a around 0

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

                  \[\leadsto \frac{\color{blue}{a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right) + 1}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), 1 + e^{b}\right)} \]
              8. Applied rewrites98.9%

                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1\right)}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + e^{b}\right)} \]
              9. Taylor expanded in b around 0

                \[\leadsto \frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), 1\right)}{2 + \color{blue}{a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}} \]
              10. Applied rewrites67.5%

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

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

            Alternative 3: 61.3% accurate, 0.8× speedup?

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

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

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

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

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

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

                  \[\leadsto \frac{1}{{b}^{3} \cdot \left(\frac{1}{6} + \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{b} + \left(\frac{1}{{b}^{2}} + 2 \cdot \frac{1}{{b}^{3}}\right)\right)}\right)} \]
                3. Step-by-step derivation
                  1. Applied rewrites52.9%

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

                  if 0.0 < (/.f64 (exp.f64 a) (+.f64 (exp.f64 a) (exp.f64 b)))

                  1. Initial program 98.7%

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

                    \[\leadsto \frac{e^{a}}{\color{blue}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)\right)}} \]
                  4. Step-by-step derivation
                    1. associate-+r+N/A

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{e^{a}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), \color{blue}{1 + e^{b}}\right)} \]
                    10. lower-exp.f6498.4

                      \[\leadsto \frac{e^{a}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + \color{blue}{e^{b}}\right)} \]
                  5. Applied rewrites98.4%

                    \[\leadsto \frac{e^{a}}{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + e^{b}\right)}} \]
                  6. Taylor expanded in a around 0

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

                      \[\leadsto \frac{\color{blue}{a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right) + 1}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), 1 + e^{b}\right)} \]
                  8. Applied rewrites98.9%

                    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1\right)}}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1 + e^{b}\right)} \]
                  9. Taylor expanded in b around 0

                    \[\leadsto \frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, \frac{1}{6}, \frac{1}{2}\right), 1\right), 1\right)}{2 + \color{blue}{a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}} \]
                  10. Applied rewrites67.5%

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

                Alternative 4: 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 5: 98.5% accurate, 1.4× speedup?

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

                  1. Initial program 98.5%

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

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

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

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

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

                      if 0.0 < (exp.f64 a)

                      1. Initial program 99.5%

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

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

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

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

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

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

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

                    Alternative 6: 57.6% accurate, 2.3× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{b} \leq 1:\\ \;\;\;\;\frac{1}{1 + \left(a + 1\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 (<= (exp b) 1.0)
                       (/ 1.0 (+ 1.0 (+ a 1.0)))
                       (/ 1.0 (fma b (fma b (fma b 0.16666666666666666 0.5) 1.0) 2.0))))
                    double code(double a, double b) {
                    	double tmp;
                    	if (exp(b) <= 1.0) {
                    		tmp = 1.0 / (1.0 + (a + 1.0));
                    	} else {
                    		tmp = 1.0 / fma(b, fma(b, fma(b, 0.16666666666666666, 0.5), 1.0), 2.0);
                    	}
                    	return tmp;
                    }
                    
                    function code(a, b)
                    	tmp = 0.0
                    	if (exp(b) <= 1.0)
                    		tmp = Float64(1.0 / Float64(1.0 + Float64(a + 1.0)));
                    	else
                    		tmp = Float64(1.0 / fma(b, fma(b, fma(b, 0.16666666666666666, 0.5), 1.0), 2.0));
                    	end
                    	return tmp
                    end
                    
                    code[a_, b_] := If[LessEqual[N[Exp[b], $MachinePrecision], 1.0], N[(1.0 / N[(1.0 + N[(a + 1.0), $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}\;e^{b} \leq 1:\\
                    \;\;\;\;\frac{1}{1 + \left(a + 1\right)}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right), 2\right)}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (exp.f64 b) < 1

                      1. Initial program 99.5%

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

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

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

                          \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                        3. Step-by-step derivation
                          1. lower-+.f6475.5

                            \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                        4. Applied rewrites75.5%

                          \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                        5. Taylor expanded in a around 0

                          \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                        6. Step-by-step derivation
                          1. Applied rewrites53.6%

                            \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]

                          if 1 < (exp.f64 b)

                          1. Initial program 98.4%

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

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

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

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

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

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

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

                              \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right)}, 2\right)} \]
                          8. Recombined 2 regimes into one program.
                          9. Final simplification58.6%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;e^{b} \leq 1:\\ \;\;\;\;\frac{1}{1 + \left(a + 1\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} \]
                          10. Add Preprocessing

                          Alternative 7: 57.5% accurate, 2.3× speedup?

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

                            1. Initial program 99.5%

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

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

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

                                \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                              3. Step-by-step derivation
                                1. lower-+.f6475.5

                                  \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                              4. Applied rewrites75.5%

                                \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                              5. Taylor expanded in a around 0

                                \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                              6. Step-by-step derivation
                                1. Applied rewrites53.6%

                                  \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]

                                if 1 < (exp.f64 b)

                                1. Initial program 98.4%

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{1}{6} \cdot b, 1\right), 2\right)} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites73.7%

                                      \[\leadsto \frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, b \cdot 0.16666666666666666, 1\right), 2\right)} \]
                                  4. Recombined 2 regimes into one program.
                                  5. Final simplification58.6%

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

                                  Alternative 8: 53.5% accurate, 2.4× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{b} \leq 1:\\ \;\;\;\;\frac{1}{1 + \left(a + 1\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 (<= (exp b) 1.0)
                                     (/ 1.0 (+ 1.0 (+ a 1.0)))
                                     (/ 1.0 (fma b (fma b 0.5 1.0) 2.0))))
                                  double code(double a, double b) {
                                  	double tmp;
                                  	if (exp(b) <= 1.0) {
                                  		tmp = 1.0 / (1.0 + (a + 1.0));
                                  	} else {
                                  		tmp = 1.0 / fma(b, fma(b, 0.5, 1.0), 2.0);
                                  	}
                                  	return tmp;
                                  }
                                  
                                  function code(a, b)
                                  	tmp = 0.0
                                  	if (exp(b) <= 1.0)
                                  		tmp = Float64(1.0 / Float64(1.0 + Float64(a + 1.0)));
                                  	else
                                  		tmp = Float64(1.0 / fma(b, fma(b, 0.5, 1.0), 2.0));
                                  	end
                                  	return tmp
                                  end
                                  
                                  code[a_, b_] := If[LessEqual[N[Exp[b], $MachinePrecision], 1.0], N[(1.0 / N[(1.0 + N[(a + 1.0), $MachinePrecision]), $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}\;e^{b} \leq 1:\\
                                  \;\;\;\;\frac{1}{1 + \left(a + 1\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 (exp.f64 b) < 1

                                    1. Initial program 99.5%

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

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

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

                                        \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                      3. Step-by-step derivation
                                        1. lower-+.f6475.5

                                          \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                      4. Applied rewrites75.5%

                                        \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                      5. Taylor expanded in a around 0

                                        \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                                      6. Step-by-step derivation
                                        1. Applied rewrites53.6%

                                          \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]

                                        if 1 < (exp.f64 b)

                                        1. Initial program 98.4%

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

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

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

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

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

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

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

                                            \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, 0.5, 1\right)}, 2\right)} \]
                                        8. Recombined 2 regimes into one program.
                                        9. Final simplification54.5%

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

                                        Alternative 9: 81.4% accurate, 2.6× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5 \cdot 10^{+133}:\\ \;\;\;\;\frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \left(\frac{\left(0.125 + \frac{1}{b \cdot \left(b \cdot b\right)}\right) \cdot \frac{1}{b}}{0.25 + \frac{\frac{1}{b} - 0.5}{b}} - -0.16666666666666666\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \end{array} \]
                                        (FPCore (a b)
                                         :precision binary64
                                         (if (<= a -5e+133)
                                           (/
                                            1.0
                                            (*
                                             (* b b)
                                             (*
                                              b
                                              (-
                                               (/
                                                (* (+ 0.125 (/ 1.0 (* b (* b b)))) (/ 1.0 b))
                                                (+ 0.25 (/ (- (/ 1.0 b) 0.5) b)))
                                               -0.16666666666666666))))
                                           (/ 1.0 (+ (exp b) 1.0))))
                                        double code(double a, double b) {
                                        	double tmp;
                                        	if (a <= -5e+133) {
                                        		tmp = 1.0 / ((b * b) * (b * ((((0.125 + (1.0 / (b * (b * b)))) * (1.0 / b)) / (0.25 + (((1.0 / b) - 0.5) / b))) - -0.16666666666666666)));
                                        	} 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 <= (-5d+133)) then
                                                tmp = 1.0d0 / ((b * b) * (b * ((((0.125d0 + (1.0d0 / (b * (b * b)))) * (1.0d0 / b)) / (0.25d0 + (((1.0d0 / b) - 0.5d0) / b))) - (-0.16666666666666666d0))))
                                            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 <= -5e+133) {
                                        		tmp = 1.0 / ((b * b) * (b * ((((0.125 + (1.0 / (b * (b * b)))) * (1.0 / b)) / (0.25 + (((1.0 / b) - 0.5) / b))) - -0.16666666666666666)));
                                        	} else {
                                        		tmp = 1.0 / (Math.exp(b) + 1.0);
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(a, b):
                                        	tmp = 0
                                        	if a <= -5e+133:
                                        		tmp = 1.0 / ((b * b) * (b * ((((0.125 + (1.0 / (b * (b * b)))) * (1.0 / b)) / (0.25 + (((1.0 / b) - 0.5) / b))) - -0.16666666666666666)))
                                        	else:
                                        		tmp = 1.0 / (math.exp(b) + 1.0)
                                        	return tmp
                                        
                                        function code(a, b)
                                        	tmp = 0.0
                                        	if (a <= -5e+133)
                                        		tmp = Float64(1.0 / Float64(Float64(b * b) * Float64(b * Float64(Float64(Float64(Float64(0.125 + Float64(1.0 / Float64(b * Float64(b * b)))) * Float64(1.0 / b)) / Float64(0.25 + Float64(Float64(Float64(1.0 / b) - 0.5) / b))) - -0.16666666666666666))));
                                        	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 <= -5e+133)
                                        		tmp = 1.0 / ((b * b) * (b * ((((0.125 + (1.0 / (b * (b * b)))) * (1.0 / b)) / (0.25 + (((1.0 / b) - 0.5) / b))) - -0.16666666666666666)));
                                        	else
                                        		tmp = 1.0 / (exp(b) + 1.0);
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[a_, b_] := If[LessEqual[a, -5e+133], N[(1.0 / N[(N[(b * b), $MachinePrecision] * N[(b * N[(N[(N[(N[(0.125 + N[(1.0 / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / b), $MachinePrecision]), $MachinePrecision] / N[(0.25 + N[(N[(N[(1.0 / b), $MachinePrecision] - 0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;a \leq -5 \cdot 10^{+133}:\\
                                        \;\;\;\;\frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \left(\frac{\left(0.125 + \frac{1}{b \cdot \left(b \cdot b\right)}\right) \cdot \frac{1}{b}}{0.25 + \frac{\frac{1}{b} - 0.5}{b}} - -0.16666666666666666\right)\right)}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\frac{1}{e^{b} + 1}\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if a < -4.99999999999999961e133

                                          1. Initial program 97.6%

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

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

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

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

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

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

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

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

                                              \[\leadsto \frac{1}{-1 \cdot \left({b}^{3} \cdot \color{blue}{\left(-1 \cdot \frac{\frac{1}{2} + \frac{1}{b}}{b} - \frac{1}{6}\right)}\right)} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites33.5%

                                                \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \color{blue}{\left(-\left(-0.16666666666666666 - \frac{0.5 + \frac{1}{b}}{b}\right)\right)}\right)} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites52.4%

                                                  \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \left(-\left(-0.16666666666666666 - \frac{\left(0.125 + \frac{1}{b \cdot \left(b \cdot b\right)}\right) \cdot \frac{1}{b}}{0.25 + \frac{\frac{1}{b} - 0.5}{b}}\right)\right)\right)} \]

                                                if -4.99999999999999961e133 < a

                                                1. Initial program 99.5%

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

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

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

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

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

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

                                                \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5 \cdot 10^{+133}:\\ \;\;\;\;\frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \left(\frac{\left(0.125 + \frac{1}{b \cdot \left(b \cdot b\right)}\right) \cdot \frac{1}{b}}{0.25 + \frac{\frac{1}{b} - 0.5}{b}} - -0.16666666666666666\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \]
                                              5. Add Preprocessing

                                              Alternative 10: 62.3% accurate, 3.4× speedup?

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

                                                1. Initial program 99.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. Applied rewrites53.0%

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

                                                    \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                  3. Step-by-step derivation
                                                    1. lower-+.f6451.9

                                                      \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                  4. Applied rewrites51.9%

                                                    \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                  5. Taylor expanded in a around 0

                                                    \[\leadsto \frac{\color{blue}{1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}}{\left(1 + a\right) + 1} \]
                                                  6. Applied rewrites39.9%

                                                    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.5, 1\right), 1\right)}}{\left(1 + a\right) + 1} \]
                                                  7. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

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

                                                  if -6.59999999999999961e-206 < b < 5e102

                                                  1. Initial program 99.1%

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

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

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

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

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

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

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

                                                      \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right)}, 2\right)} \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites66.6%

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

                                                      if 5e102 < 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. Applied rewrites100.0%

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

                                                        \[\leadsto \frac{1}{2 + \color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites100.0%

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

                                                          \[\leadsto \frac{1}{\frac{1}{6} \cdot {b}^{\color{blue}{3}}} \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites100.0%

                                                            \[\leadsto \frac{1}{b \cdot \left(0.16666666666666666 \cdot \color{blue}{\left(b \cdot b\right)}\right)} \]
                                                          2. Taylor expanded in b around inf

                                                            \[\leadsto \frac{1}{\frac{1}{6} \cdot {b}^{\color{blue}{3}}} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites100.0%

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

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

                                                          Alternative 11: 60.2% accurate, 3.9× speedup?

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

                                                            1. Initial program 99.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. Applied rewrites53.0%

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

                                                                \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                              3. Step-by-step derivation
                                                                1. lower-+.f6451.9

                                                                  \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                              4. Applied rewrites51.9%

                                                                \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                              5. Taylor expanded in a around 0

                                                                \[\leadsto \frac{\color{blue}{1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}}{\left(1 + a\right) + 1} \]
                                                              6. Applied rewrites39.9%

                                                                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.5, 1\right), 1\right)}}{\left(1 + a\right) + 1} \]
                                                              7. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

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

                                                              if -6.59999999999999961e-206 < b < 5.00000000000000018e153

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

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

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

                                                                \[\leadsto \frac{1}{2 + \color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites61.4%

                                                                  \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right)}, 2\right)} \]
                                                                2. Step-by-step derivation
                                                                  1. Applied rewrites68.8%

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

                                                                  if 5.00000000000000018e153 < 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. Applied rewrites100.0%

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

                                                                    \[\leadsto \frac{1}{2 + \color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites100.0%

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

                                                                      \[\leadsto \frac{1}{-1 \cdot \left({b}^{3} \cdot \color{blue}{\left(-1 \cdot \frac{\frac{1}{2} + \frac{1}{b}}{b} - \frac{1}{6}\right)}\right)} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites100.0%

                                                                        \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \color{blue}{\left(-\left(-0.16666666666666666 - \frac{0.5 + \frac{1}{b}}{b}\right)\right)}\right)} \]
                                                                      2. Taylor expanded in b around 0

                                                                        \[\leadsto \frac{1}{b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites100.0%

                                                                          \[\leadsto \frac{1}{\mathsf{fma}\left(0.5, b \cdot b, b\right)} \]
                                                                      4. Recombined 3 regimes into one program.
                                                                      5. Final simplification63.1%

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

                                                                      Alternative 12: 58.2% accurate, 6.2× speedup?

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

                                                                        1. Initial program 99.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. Applied rewrites53.0%

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

                                                                            \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                          3. Step-by-step derivation
                                                                            1. lower-+.f6451.9

                                                                              \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                          4. Applied rewrites51.9%

                                                                            \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                          5. Taylor expanded in a around 0

                                                                            \[\leadsto \frac{\color{blue}{1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}}{\left(1 + a\right) + 1} \]
                                                                          6. Applied rewrites39.9%

                                                                            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.5, 1\right), 1\right)}}{\left(1 + a\right) + 1} \]
                                                                          7. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

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

                                                                          if -6.59999999999999961e-206 < b

                                                                          1. Initial program 99.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.f6480.4

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

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

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

                                                                              \[\leadsto \frac{1}{\mathsf{fma}\left(b, \color{blue}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right)}, 2\right)} \]
                                                                          8. Recombined 2 regimes into one program.
                                                                          9. Final simplification59.6%

                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.6 \cdot 10^{-206}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.5, 1\right), 1\right)}{1 + \mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), 1\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} \]
                                                                          10. Add Preprocessing

                                                                          Alternative 13: 57.3% accurate, 9.3× speedup?

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

                                                                            1. Initial program 99.5%

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

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

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

                                                                                \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                              3. Step-by-step derivation
                                                                                1. lower-+.f6474.8

                                                                                  \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                              4. Applied rewrites74.8%

                                                                                \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                              5. Taylor expanded in a around 0

                                                                                \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                                                                              6. Step-by-step derivation
                                                                                1. Applied rewrites51.9%

                                                                                  \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]

                                                                                if 4.1e49 < b

                                                                                1. Initial program 98.2%

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

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

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

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

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

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

                                                                                  \[\leadsto \frac{1}{2 + \color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
                                                                                7. Step-by-step derivation
                                                                                  1. Applied rewrites82.0%

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

                                                                                    \[\leadsto \frac{1}{{b}^{3} \cdot \left(\frac{1}{6} + \color{blue}{\frac{1}{2} \cdot \frac{1}{b}}\right)} \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites82.0%

                                                                                      \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \mathsf{fma}\left(b, \color{blue}{0.16666666666666666}, 0.5\right)} \]
                                                                                  4. Recombined 2 regimes into one program.
                                                                                  5. Final simplification58.5%

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

                                                                                  Alternative 14: 57.3% accurate, 9.5× speedup?

                                                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 4.1 \cdot 10^{+49}:\\ \;\;\;\;\frac{1}{1 + \left(a + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.16666666666666666 \cdot \left(b \cdot \left(b \cdot b\right)\right)}\\ \end{array} \end{array} \]
                                                                                  (FPCore (a b)
                                                                                   :precision binary64
                                                                                   (if (<= b 4.1e+49)
                                                                                     (/ 1.0 (+ 1.0 (+ a 1.0)))
                                                                                     (/ 1.0 (* 0.16666666666666666 (* b (* b b))))))
                                                                                  double code(double a, double b) {
                                                                                  	double tmp;
                                                                                  	if (b <= 4.1e+49) {
                                                                                  		tmp = 1.0 / (1.0 + (a + 1.0));
                                                                                  	} else {
                                                                                  		tmp = 1.0 / (0.16666666666666666 * (b * (b * b)));
                                                                                  	}
                                                                                  	return tmp;
                                                                                  }
                                                                                  
                                                                                  real(8) function code(a, b)
                                                                                      real(8), intent (in) :: a
                                                                                      real(8), intent (in) :: b
                                                                                      real(8) :: tmp
                                                                                      if (b <= 4.1d+49) then
                                                                                          tmp = 1.0d0 / (1.0d0 + (a + 1.0d0))
                                                                                      else
                                                                                          tmp = 1.0d0 / (0.16666666666666666d0 * (b * (b * b)))
                                                                                      end if
                                                                                      code = tmp
                                                                                  end function
                                                                                  
                                                                                  public static double code(double a, double b) {
                                                                                  	double tmp;
                                                                                  	if (b <= 4.1e+49) {
                                                                                  		tmp = 1.0 / (1.0 + (a + 1.0));
                                                                                  	} else {
                                                                                  		tmp = 1.0 / (0.16666666666666666 * (b * (b * b)));
                                                                                  	}
                                                                                  	return tmp;
                                                                                  }
                                                                                  
                                                                                  def code(a, b):
                                                                                  	tmp = 0
                                                                                  	if b <= 4.1e+49:
                                                                                  		tmp = 1.0 / (1.0 + (a + 1.0))
                                                                                  	else:
                                                                                  		tmp = 1.0 / (0.16666666666666666 * (b * (b * b)))
                                                                                  	return tmp
                                                                                  
                                                                                  function code(a, b)
                                                                                  	tmp = 0.0
                                                                                  	if (b <= 4.1e+49)
                                                                                  		tmp = Float64(1.0 / Float64(1.0 + Float64(a + 1.0)));
                                                                                  	else
                                                                                  		tmp = Float64(1.0 / Float64(0.16666666666666666 * Float64(b * Float64(b * b))));
                                                                                  	end
                                                                                  	return tmp
                                                                                  end
                                                                                  
                                                                                  function tmp_2 = code(a, b)
                                                                                  	tmp = 0.0;
                                                                                  	if (b <= 4.1e+49)
                                                                                  		tmp = 1.0 / (1.0 + (a + 1.0));
                                                                                  	else
                                                                                  		tmp = 1.0 / (0.16666666666666666 * (b * (b * b)));
                                                                                  	end
                                                                                  	tmp_2 = tmp;
                                                                                  end
                                                                                  
                                                                                  code[a_, b_] := If[LessEqual[b, 4.1e+49], N[(1.0 / N[(1.0 + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(0.16666666666666666 * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                                  
                                                                                  \begin{array}{l}
                                                                                  
                                                                                  \\
                                                                                  \begin{array}{l}
                                                                                  \mathbf{if}\;b \leq 4.1 \cdot 10^{+49}:\\
                                                                                  \;\;\;\;\frac{1}{1 + \left(a + 1\right)}\\
                                                                                  
                                                                                  \mathbf{else}:\\
                                                                                  \;\;\;\;\frac{1}{0.16666666666666666 \cdot \left(b \cdot \left(b \cdot b\right)\right)}\\
                                                                                  
                                                                                  
                                                                                  \end{array}
                                                                                  \end{array}
                                                                                  
                                                                                  Derivation
                                                                                  1. Split input into 2 regimes
                                                                                  2. if b < 4.1e49

                                                                                    1. Initial program 99.5%

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

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

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

                                                                                        \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                      3. Step-by-step derivation
                                                                                        1. lower-+.f6474.8

                                                                                          \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                      4. Applied rewrites74.8%

                                                                                        \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                      5. Taylor expanded in a around 0

                                                                                        \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                                                                                      6. Step-by-step derivation
                                                                                        1. Applied rewrites51.9%

                                                                                          \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]

                                                                                        if 4.1e49 < b

                                                                                        1. Initial program 98.2%

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

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

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

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

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

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

                                                                                          \[\leadsto \frac{1}{2 + \color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
                                                                                        7. Step-by-step derivation
                                                                                          1. Applied rewrites82.0%

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

                                                                                            \[\leadsto \frac{1}{\frac{1}{6} \cdot {b}^{\color{blue}{3}}} \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites82.0%

                                                                                              \[\leadsto \frac{1}{b \cdot \left(0.16666666666666666 \cdot \color{blue}{\left(b \cdot b\right)}\right)} \]
                                                                                            2. Taylor expanded in b around inf

                                                                                              \[\leadsto \frac{1}{\frac{1}{6} \cdot {b}^{\color{blue}{3}}} \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites82.0%

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

                                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.1 \cdot 10^{+49}:\\ \;\;\;\;\frac{1}{1 + \left(a + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.16666666666666666 \cdot \left(b \cdot \left(b \cdot b\right)\right)}\\ \end{array} \]
                                                                                            6. Add Preprocessing

                                                                                            Alternative 15: 53.2% accurate, 10.9× speedup?

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

                                                                                              1. Initial program 99.5%

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

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

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

                                                                                                  \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                                3. Step-by-step derivation
                                                                                                  1. lower-+.f6474.8

                                                                                                    \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                                4. Applied rewrites74.8%

                                                                                                  \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                                5. Taylor expanded in a around 0

                                                                                                  \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                                                                                                6. Step-by-step derivation
                                                                                                  1. Applied rewrites51.9%

                                                                                                    \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]

                                                                                                  if 4.1e49 < b

                                                                                                  1. Initial program 98.2%

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

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

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

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

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

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

                                                                                                    \[\leadsto \frac{1}{2 + \color{blue}{b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}} \]
                                                                                                  7. Step-by-step derivation
                                                                                                    1. Applied rewrites82.0%

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

                                                                                                      \[\leadsto \frac{1}{-1 \cdot \left({b}^{3} \cdot \color{blue}{\left(-1 \cdot \frac{\frac{1}{2} + \frac{1}{b}}{b} - \frac{1}{6}\right)}\right)} \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites82.0%

                                                                                                        \[\leadsto \frac{1}{\left(b \cdot b\right) \cdot \left(b \cdot \color{blue}{\left(-\left(-0.16666666666666666 - \frac{0.5 + \frac{1}{b}}{b}\right)\right)}\right)} \]
                                                                                                      2. Taylor expanded in b around 0

                                                                                                        \[\leadsto \frac{1}{b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                                                                                      3. Step-by-step derivation
                                                                                                        1. Applied rewrites63.1%

                                                                                                          \[\leadsto \frac{1}{\mathsf{fma}\left(0.5, b \cdot b, b\right)} \]
                                                                                                      4. Recombined 2 regimes into one program.
                                                                                                      5. Final simplification54.4%

                                                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.1 \cdot 10^{+49}:\\ \;\;\;\;\frac{1}{1 + \left(a + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(0.5, b \cdot b, b\right)}\\ \end{array} \]
                                                                                                      6. Add Preprocessing

                                                                                                      Alternative 16: 39.9% accurate, 17.5× speedup?

                                                                                                      \[\begin{array}{l} \\ \frac{1}{1 + \left(a + 1\right)} \end{array} \]
                                                                                                      (FPCore (a b) :precision binary64 (/ 1.0 (+ 1.0 (+ a 1.0))))
                                                                                                      double code(double a, double b) {
                                                                                                      	return 1.0 / (1.0 + (a + 1.0));
                                                                                                      }
                                                                                                      
                                                                                                      real(8) function code(a, b)
                                                                                                          real(8), intent (in) :: a
                                                                                                          real(8), intent (in) :: b
                                                                                                          code = 1.0d0 / (1.0d0 + (a + 1.0d0))
                                                                                                      end function
                                                                                                      
                                                                                                      public static double code(double a, double b) {
                                                                                                      	return 1.0 / (1.0 + (a + 1.0));
                                                                                                      }
                                                                                                      
                                                                                                      def code(a, b):
                                                                                                      	return 1.0 / (1.0 + (a + 1.0))
                                                                                                      
                                                                                                      function code(a, b)
                                                                                                      	return Float64(1.0 / Float64(1.0 + Float64(a + 1.0)))
                                                                                                      end
                                                                                                      
                                                                                                      function tmp = code(a, b)
                                                                                                      	tmp = 1.0 / (1.0 + (a + 1.0));
                                                                                                      end
                                                                                                      
                                                                                                      code[a_, b_] := N[(1.0 / N[(1.0 + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                                                                      
                                                                                                      \begin{array}{l}
                                                                                                      
                                                                                                      \\
                                                                                                      \frac{1}{1 + \left(a + 1\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. Applied rewrites66.7%

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

                                                                                                          \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                                        3. Step-by-step derivation
                                                                                                          1. lower-+.f6466.3

                                                                                                            \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                                        4. Applied rewrites66.3%

                                                                                                          \[\leadsto \frac{e^{a}}{\color{blue}{\left(1 + a\right)} + 1} \]
                                                                                                        5. Taylor expanded in a around 0

                                                                                                          \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                                                                                                        6. Step-by-step derivation
                                                                                                          1. Applied rewrites41.5%

                                                                                                            \[\leadsto \frac{\color{blue}{1}}{\left(1 + a\right) + 1} \]
                                                                                                          2. Final simplification41.5%

                                                                                                            \[\leadsto \frac{1}{1 + \left(a + 1\right)} \]
                                                                                                          3. Add Preprocessing

                                                                                                          Alternative 17: 39.4% 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.f6482.8

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

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

                                                                                                            \[\leadsto \frac{1}{2} \]
                                                                                                          7. Step-by-step derivation
                                                                                                            1. Applied rewrites40.8%

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