Quotient of sum of exps

Percentage Accurate: 98.8% → 98.4%
Time: 9.0s
Alternatives: 16
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 98.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 100.0%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
    4. Step-by-step derivation
      1. Simplified100.0%

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

      if 0.999999999000000028 < (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. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
        3. exp-lowering-exp.f6499.9%

          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
      5. Simplified99.9%

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

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

    Alternative 2: 98.8% accurate, 1.0× speedup?

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

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

        \[\leadsto e^{a} \cdot \color{blue}{\frac{1}{e^{a} + e^{b}}} \]
      2. flip3-+N/A

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

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

        \[\leadsto \frac{e^{a} \cdot e^{a} + \left(e^{b} \cdot e^{b} - e^{a} \cdot e^{b}\right)}{{\left(e^{a}\right)}^{3} + {\left(e^{b}\right)}^{3}} \cdot \color{blue}{e^{a}} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{e^{a} \cdot e^{a} + \left(e^{b} \cdot e^{b} - e^{a} \cdot e^{b}\right)}{{\left(e^{a}\right)}^{3} + {\left(e^{b}\right)}^{3}}\right), \color{blue}{\left(e^{a}\right)}\right) \]
    4. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{1}{e^{a} + e^{b}} \cdot e^{a}} \]
    5. Final simplification99.6%

      \[\leadsto e^{a} \cdot \frac{1}{e^{a} + e^{b}} \]
    6. Add Preprocessing

    Alternative 3: 98.8% 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.6%

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

    Alternative 4: 98.0% accurate, 1.5× speedup?

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

      1. Initial program 100.0%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
      4. Step-by-step derivation
        1. Simplified100.0%

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{2}\right) \]
        3. Step-by-step derivation
          1. Simplified95.6%

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

          if 0.999999900000000053 < (exp.f64 a)

          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. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
            2. +-lowering-+.f64N/A

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
            3. exp-lowering-exp.f6499.8%

              \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
          5. Simplified99.8%

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

        Alternative 5: 78.5% accurate, 2.8× speedup?

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

          1. Initial program 99.5%

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
          4. Step-by-step derivation
            1. Simplified76.6%

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{2}\right) \]
            3. Step-by-step derivation
              1. Simplified75.0%

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

              if 1.25000000000000005e47 < b < 1.00000000000000004e154

              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. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                2. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                3. exp-lowering-exp.f64100.0%

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
              5. Simplified100.0%

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                7. *-lowering-*.f6450.9%

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
              8. Simplified50.9%

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

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

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \left(\frac{1 \cdot 1 - \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right) \cdot \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)}{1 - b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)} \cdot b\right)\right)\right) \]
                3. associate-*l/N/A

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

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(1 \cdot 1 - \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right) \cdot \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)\right) \cdot b\right), \color{blue}{\left(1 - b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)}\right)\right)\right) \]
              10. Applied egg-rr94.0%

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

              if 1.00000000000000004e154 < 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. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                2. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                3. exp-lowering-exp.f64100.0%

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
              5. Simplified100.0%

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

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

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                5. *-lowering-*.f64100.0%

                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
              8. Simplified100.0%

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

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

                  \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                2. unpow2N/A

                  \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                3. *-lowering-*.f64100.0%

                  \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
              11. Simplified100.0%

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

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

            Alternative 6: 61.5% accurate, 4.0× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\\ t_1 := 1 + t\_0\\ t_2 := b \cdot t\_1\\ \mathbf{if}\;b \leq -3.9 \cdot 10^{-237}:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 4.3 \cdot 10^{+51}:\\ \;\;\;\;\frac{1}{\frac{8 + t\_2 \cdot \left(b \cdot \left(t\_1 \cdot t\_2\right)\right)}{4 + t\_2 \cdot \left(t\_2 - 2\right)}}\\ \mathbf{elif}\;b \leq 10^{+154}:\\ \;\;\;\;\frac{1}{2 + \frac{b \cdot \left(1 - t\_0 \cdot t\_0\right)}{1 - t\_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (let* ((t_0 (* b (+ 0.5 (* b 0.16666666666666666))))
                    (t_1 (+ 1.0 t_0))
                    (t_2 (* b t_1)))
               (if (<= b -3.9e-237)
                 (+
                  0.5
                  (*
                   a
                   (+
                    0.25
                    (*
                     a
                     (* a (+ -0.020833333333333332 (* a (* a 0.0020833333333333333))))))))
                 (if (<= b 4.3e+51)
                   (/
                    1.0
                    (/ (+ 8.0 (* t_2 (* b (* t_1 t_2)))) (+ 4.0 (* t_2 (- t_2 2.0)))))
                   (if (<= b 1e+154)
                     (/ 1.0 (+ 2.0 (/ (* b (- 1.0 (* t_0 t_0))) (- 1.0 t_0))))
                     (/ 2.0 (* b b)))))))
            double code(double a, double b) {
            	double t_0 = b * (0.5 + (b * 0.16666666666666666));
            	double t_1 = 1.0 + t_0;
            	double t_2 = b * t_1;
            	double tmp;
            	if (b <= -3.9e-237) {
            		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
            	} else if (b <= 4.3e+51) {
            		tmp = 1.0 / ((8.0 + (t_2 * (b * (t_1 * t_2)))) / (4.0 + (t_2 * (t_2 - 2.0))));
            	} else if (b <= 1e+154) {
            		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)));
            	} else {
            		tmp = 2.0 / (b * b);
            	}
            	return tmp;
            }
            
            real(8) function code(a, b)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8) :: t_0
                real(8) :: t_1
                real(8) :: t_2
                real(8) :: tmp
                t_0 = b * (0.5d0 + (b * 0.16666666666666666d0))
                t_1 = 1.0d0 + t_0
                t_2 = b * t_1
                if (b <= (-3.9d-237)) then
                    tmp = 0.5d0 + (a * (0.25d0 + (a * (a * ((-0.020833333333333332d0) + (a * (a * 0.0020833333333333333d0)))))))
                else if (b <= 4.3d+51) then
                    tmp = 1.0d0 / ((8.0d0 + (t_2 * (b * (t_1 * t_2)))) / (4.0d0 + (t_2 * (t_2 - 2.0d0))))
                else if (b <= 1d+154) then
                    tmp = 1.0d0 / (2.0d0 + ((b * (1.0d0 - (t_0 * t_0))) / (1.0d0 - t_0)))
                else
                    tmp = 2.0d0 / (b * b)
                end if
                code = tmp
            end function
            
            public static double code(double a, double b) {
            	double t_0 = b * (0.5 + (b * 0.16666666666666666));
            	double t_1 = 1.0 + t_0;
            	double t_2 = b * t_1;
            	double tmp;
            	if (b <= -3.9e-237) {
            		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
            	} else if (b <= 4.3e+51) {
            		tmp = 1.0 / ((8.0 + (t_2 * (b * (t_1 * t_2)))) / (4.0 + (t_2 * (t_2 - 2.0))));
            	} else if (b <= 1e+154) {
            		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)));
            	} else {
            		tmp = 2.0 / (b * b);
            	}
            	return tmp;
            }
            
            def code(a, b):
            	t_0 = b * (0.5 + (b * 0.16666666666666666))
            	t_1 = 1.0 + t_0
            	t_2 = b * t_1
            	tmp = 0
            	if b <= -3.9e-237:
            		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))))
            	elif b <= 4.3e+51:
            		tmp = 1.0 / ((8.0 + (t_2 * (b * (t_1 * t_2)))) / (4.0 + (t_2 * (t_2 - 2.0))))
            	elif b <= 1e+154:
            		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)))
            	else:
            		tmp = 2.0 / (b * b)
            	return tmp
            
            function code(a, b)
            	t_0 = Float64(b * Float64(0.5 + Float64(b * 0.16666666666666666)))
            	t_1 = Float64(1.0 + t_0)
            	t_2 = Float64(b * t_1)
            	tmp = 0.0
            	if (b <= -3.9e-237)
            		tmp = Float64(0.5 + Float64(a * Float64(0.25 + Float64(a * Float64(a * Float64(-0.020833333333333332 + Float64(a * Float64(a * 0.0020833333333333333))))))));
            	elseif (b <= 4.3e+51)
            		tmp = Float64(1.0 / Float64(Float64(8.0 + Float64(t_2 * Float64(b * Float64(t_1 * t_2)))) / Float64(4.0 + Float64(t_2 * Float64(t_2 - 2.0)))));
            	elseif (b <= 1e+154)
            		tmp = Float64(1.0 / Float64(2.0 + Float64(Float64(b * Float64(1.0 - Float64(t_0 * t_0))) / Float64(1.0 - t_0))));
            	else
            		tmp = Float64(2.0 / Float64(b * b));
            	end
            	return tmp
            end
            
            function tmp_2 = code(a, b)
            	t_0 = b * (0.5 + (b * 0.16666666666666666));
            	t_1 = 1.0 + t_0;
            	t_2 = b * t_1;
            	tmp = 0.0;
            	if (b <= -3.9e-237)
            		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
            	elseif (b <= 4.3e+51)
            		tmp = 1.0 / ((8.0 + (t_2 * (b * (t_1 * t_2)))) / (4.0 + (t_2 * (t_2 - 2.0))));
            	elseif (b <= 1e+154)
            		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)));
            	else
            		tmp = 2.0 / (b * b);
            	end
            	tmp_2 = tmp;
            end
            
            code[a_, b_] := Block[{t$95$0 = N[(b * N[(0.5 + N[(b * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(b * t$95$1), $MachinePrecision]}, If[LessEqual[b, -3.9e-237], N[(0.5 + N[(a * N[(0.25 + N[(a * N[(a * N[(-0.020833333333333332 + N[(a * N[(a * 0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.3e+51], N[(1.0 / N[(N[(8.0 + N[(t$95$2 * N[(b * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 + N[(t$95$2 * N[(t$95$2 - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e+154], N[(1.0 / N[(2.0 + N[(N[(b * N[(1.0 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\\
            t_1 := 1 + t\_0\\
            t_2 := b \cdot t\_1\\
            \mathbf{if}\;b \leq -3.9 \cdot 10^{-237}:\\
            \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\
            
            \mathbf{elif}\;b \leq 4.3 \cdot 10^{+51}:\\
            \;\;\;\;\frac{1}{\frac{8 + t\_2 \cdot \left(b \cdot \left(t\_1 \cdot t\_2\right)\right)}{4 + t\_2 \cdot \left(t\_2 - 2\right)}}\\
            
            \mathbf{elif}\;b \leq 10^{+154}:\\
            \;\;\;\;\frac{1}{2 + \frac{b \cdot \left(1 - t\_0 \cdot t\_0\right)}{1 - t\_0}}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{2}{b \cdot b}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 4 regimes
            2. if b < -3.8999999999999998e-237

              1. Initial program 99.0%

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

                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
              4. Step-by-step derivation
                1. Simplified60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{1}{480}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                  16. *-lowering-*.f6446.2%

                    \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{480}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                4. Simplified46.2%

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

                if -3.8999999999999998e-237 < b < 4.2999999999999997e51

                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. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                  2. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                  3. exp-lowering-exp.f6476.9%

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                5. Simplified76.9%

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                  7. *-lowering-*.f6465.0%

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                8. Simplified65.0%

                  \[\leadsto \frac{1}{\color{blue}{2 + b \cdot \left(1 + b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right)}} \]
                9. Step-by-step derivation
                  1. flip3-+N/A

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

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left({2}^{3} + {\left(b \cdot \left(1 + b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)\right)}^{3}\right), \color{blue}{\left(2 \cdot 2 + \left(\left(b \cdot \left(1 + b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)\right) \cdot \left(b \cdot \left(1 + b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)\right) - 2 \cdot \left(b \cdot \left(1 + b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)\right)\right)\right)}\right)\right) \]
                10. Applied egg-rr70.9%

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

                if 4.2999999999999997e51 < b < 1.00000000000000004e154

                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. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                  2. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                  3. exp-lowering-exp.f64100.0%

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                5. Simplified100.0%

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                  7. *-lowering-*.f6452.4%

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                8. Simplified52.4%

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

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

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \left(\frac{1 \cdot 1 - \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right) \cdot \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)}{1 - b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)} \cdot b\right)\right)\right) \]
                  3. associate-*l/N/A

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

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\left(\left(1 \cdot 1 - \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right) \cdot \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)\right) \cdot b\right), \color{blue}{\left(1 - b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)}\right)\right)\right) \]
                10. Applied egg-rr96.9%

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

                if 1.00000000000000004e154 < 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. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                  2. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                  3. exp-lowering-exp.f64100.0%

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                5. Simplified100.0%

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

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

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

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

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

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                  5. *-lowering-*.f64100.0%

                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                8. Simplified100.0%

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

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

                    \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                  2. unpow2N/A

                    \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                  3. *-lowering-*.f64100.0%

                    \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
                11. Simplified100.0%

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.9 \cdot 10^{-237}:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 4.3 \cdot 10^{+51}:\\ \;\;\;\;\frac{1}{\frac{8 + \left(b \cdot \left(1 + b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right)\right) \cdot \left(b \cdot \left(\left(1 + b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right) \cdot \left(b \cdot \left(1 + b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right)\right)\right)\right)}{4 + \left(b \cdot \left(1 + b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right)\right) \cdot \left(b \cdot \left(1 + b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right) - 2\right)}}\\ \mathbf{elif}\;b \leq 10^{+154}:\\ \;\;\;\;\frac{1}{2 + \frac{b \cdot \left(1 - \left(b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right) \cdot \left(b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right)\right)}{1 - b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \]
              7. Add Preprocessing

              Alternative 7: 61.9% accurate, 6.3× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\\ \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 9 \cdot 10^{+61}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{elif}\;b \leq 10^{+154}:\\ \;\;\;\;\frac{1}{2 + \frac{b \cdot \left(1 - t\_0 \cdot t\_0\right)}{1 - t\_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \end{array} \]
              (FPCore (a b)
               :precision binary64
               (let* ((t_0 (* b (+ 0.5 (* b 0.16666666666666666)))))
                 (if (<= b 36000000000.0)
                   (+
                    0.5
                    (*
                     a
                     (+
                      0.25
                      (*
                       a
                       (* a (+ -0.020833333333333332 (* a (* a 0.0020833333333333333))))))))
                   (if (<= b 9e+61)
                     (* -0.020833333333333332 (* a (* a a)))
                     (if (<= b 1e+154)
                       (/ 1.0 (+ 2.0 (/ (* b (- 1.0 (* t_0 t_0))) (- 1.0 t_0))))
                       (/ 2.0 (* b b)))))))
              double code(double a, double b) {
              	double t_0 = b * (0.5 + (b * 0.16666666666666666));
              	double tmp;
              	if (b <= 36000000000.0) {
              		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
              	} else if (b <= 9e+61) {
              		tmp = -0.020833333333333332 * (a * (a * a));
              	} else if (b <= 1e+154) {
              		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)));
              	} else {
              		tmp = 2.0 / (b * b);
              	}
              	return tmp;
              }
              
              real(8) function code(a, b)
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = b * (0.5d0 + (b * 0.16666666666666666d0))
                  if (b <= 36000000000.0d0) then
                      tmp = 0.5d0 + (a * (0.25d0 + (a * (a * ((-0.020833333333333332d0) + (a * (a * 0.0020833333333333333d0)))))))
                  else if (b <= 9d+61) then
                      tmp = (-0.020833333333333332d0) * (a * (a * a))
                  else if (b <= 1d+154) then
                      tmp = 1.0d0 / (2.0d0 + ((b * (1.0d0 - (t_0 * t_0))) / (1.0d0 - t_0)))
                  else
                      tmp = 2.0d0 / (b * b)
                  end if
                  code = tmp
              end function
              
              public static double code(double a, double b) {
              	double t_0 = b * (0.5 + (b * 0.16666666666666666));
              	double tmp;
              	if (b <= 36000000000.0) {
              		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
              	} else if (b <= 9e+61) {
              		tmp = -0.020833333333333332 * (a * (a * a));
              	} else if (b <= 1e+154) {
              		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)));
              	} else {
              		tmp = 2.0 / (b * b);
              	}
              	return tmp;
              }
              
              def code(a, b):
              	t_0 = b * (0.5 + (b * 0.16666666666666666))
              	tmp = 0
              	if b <= 36000000000.0:
              		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))))
              	elif b <= 9e+61:
              		tmp = -0.020833333333333332 * (a * (a * a))
              	elif b <= 1e+154:
              		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)))
              	else:
              		tmp = 2.0 / (b * b)
              	return tmp
              
              function code(a, b)
              	t_0 = Float64(b * Float64(0.5 + Float64(b * 0.16666666666666666)))
              	tmp = 0.0
              	if (b <= 36000000000.0)
              		tmp = Float64(0.5 + Float64(a * Float64(0.25 + Float64(a * Float64(a * Float64(-0.020833333333333332 + Float64(a * Float64(a * 0.0020833333333333333))))))));
              	elseif (b <= 9e+61)
              		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
              	elseif (b <= 1e+154)
              		tmp = Float64(1.0 / Float64(2.0 + Float64(Float64(b * Float64(1.0 - Float64(t_0 * t_0))) / Float64(1.0 - t_0))));
              	else
              		tmp = Float64(2.0 / Float64(b * b));
              	end
              	return tmp
              end
              
              function tmp_2 = code(a, b)
              	t_0 = b * (0.5 + (b * 0.16666666666666666));
              	tmp = 0.0;
              	if (b <= 36000000000.0)
              		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
              	elseif (b <= 9e+61)
              		tmp = -0.020833333333333332 * (a * (a * a));
              	elseif (b <= 1e+154)
              		tmp = 1.0 / (2.0 + ((b * (1.0 - (t_0 * t_0))) / (1.0 - t_0)));
              	else
              		tmp = 2.0 / (b * b);
              	end
              	tmp_2 = tmp;
              end
              
              code[a_, b_] := Block[{t$95$0 = N[(b * N[(0.5 + N[(b * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * N[(0.25 + N[(a * N[(a * N[(-0.020833333333333332 + N[(a * N[(a * 0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e+61], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e+154], N[(1.0 / N[(2.0 + N[(N[(b * N[(1.0 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\\
              \mathbf{if}\;b \leq 36000000000:\\
              \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\
              
              \mathbf{elif}\;b \leq 9 \cdot 10^{+61}:\\
              \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
              
              \mathbf{elif}\;b \leq 10^{+154}:\\
              \;\;\;\;\frac{1}{2 + \frac{b \cdot \left(1 - t\_0 \cdot t\_0\right)}{1 - t\_0}}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{2}{b \cdot b}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if b < 3.6e10

                1. Initial program 99.4%

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

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                4. Step-by-step derivation
                  1. Simplified78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{1}{480}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                    16. *-lowering-*.f6458.0%

                      \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{480}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                  4. Simplified58.0%

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

                  if 3.6e10 < b < 9e61

                  1. Initial program 100.0%

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

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                  4. Step-by-step derivation
                    1. Simplified35.4%

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                      7. *-lowering-*.f64N/A

                        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                      8. *-lowering-*.f642.7%

                        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                    4. Simplified2.7%

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

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

                        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                      2. cube-multN/A

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                      6. *-lowering-*.f6459.3%

                        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                    7. Simplified59.3%

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

                    if 9e61 < b < 1.00000000000000004e154

                    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. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                      2. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                      3. exp-lowering-exp.f64100.0%

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                    5. Simplified100.0%

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                      7. *-lowering-*.f6454.0%

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                    8. Simplified54.0%

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

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

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \left(\frac{1 \cdot 1 - \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right) \cdot \left(b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)\right)}{1 - b \cdot \left(\frac{1}{2} + b \cdot \frac{1}{6}\right)} \cdot b\right)\right)\right) \]
                      3. associate-*l/N/A

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

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

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

                    if 1.00000000000000004e154 < 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. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                      2. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                      3. exp-lowering-exp.f64100.0%

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                    5. Simplified100.0%

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

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

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

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

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

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                      5. *-lowering-*.f64100.0%

                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                    8. Simplified100.0%

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

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

                        \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                      2. unpow2N/A

                        \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                      3. *-lowering-*.f64100.0%

                        \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
                    11. Simplified100.0%

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 9 \cdot 10^{+61}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{elif}\;b \leq 10^{+154}:\\ \;\;\;\;\frac{1}{2 + \frac{b \cdot \left(1 - \left(b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right) \cdot \left(b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)\right)\right)}{1 - b \cdot \left(0.5 + b \cdot 0.16666666666666666\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \]
                  7. Add Preprocessing

                  Alternative 8: 61.2% accurate, 6.6× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{+73}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{elif}\;b \leq 10^{+154}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{b \cdot \left(0.125 + \left(b \cdot \left(b \cdot b\right)\right) \cdot 0.004629629629629629\right)}{0.25 + \left(b \cdot 0.16666666666666666\right) \cdot \left(b \cdot 0.16666666666666666 - 0.5\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \end{array} \]
                  (FPCore (a b)
                   :precision binary64
                   (if (<= b 36000000000.0)
                     (+
                      0.5
                      (*
                       a
                       (+
                        0.25
                        (*
                         a
                         (* a (+ -0.020833333333333332 (* a (* a 0.0020833333333333333))))))))
                     (if (<= b 8.2e+73)
                       (* -0.020833333333333332 (* a (* a a)))
                       (if (<= b 1e+154)
                         (/
                          1.0
                          (+
                           2.0
                           (*
                            b
                            (+
                             1.0
                             (/
                              (* b (+ 0.125 (* (* b (* b b)) 0.004629629629629629)))
                              (+
                               0.25
                               (*
                                (* b 0.16666666666666666)
                                (- (* b 0.16666666666666666) 0.5))))))))
                         (/ 2.0 (* b b))))))
                  double code(double a, double b) {
                  	double tmp;
                  	if (b <= 36000000000.0) {
                  		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                  	} else if (b <= 8.2e+73) {
                  		tmp = -0.020833333333333332 * (a * (a * a));
                  	} else if (b <= 1e+154) {
                  		tmp = 1.0 / (2.0 + (b * (1.0 + ((b * (0.125 + ((b * (b * b)) * 0.004629629629629629))) / (0.25 + ((b * 0.16666666666666666) * ((b * 0.16666666666666666) - 0.5)))))));
                  	} else {
                  		tmp = 2.0 / (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 <= 36000000000.0d0) then
                          tmp = 0.5d0 + (a * (0.25d0 + (a * (a * ((-0.020833333333333332d0) + (a * (a * 0.0020833333333333333d0)))))))
                      else if (b <= 8.2d+73) then
                          tmp = (-0.020833333333333332d0) * (a * (a * a))
                      else if (b <= 1d+154) then
                          tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + ((b * (0.125d0 + ((b * (b * b)) * 0.004629629629629629d0))) / (0.25d0 + ((b * 0.16666666666666666d0) * ((b * 0.16666666666666666d0) - 0.5d0)))))))
                      else
                          tmp = 2.0d0 / (b * b)
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double a, double b) {
                  	double tmp;
                  	if (b <= 36000000000.0) {
                  		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                  	} else if (b <= 8.2e+73) {
                  		tmp = -0.020833333333333332 * (a * (a * a));
                  	} else if (b <= 1e+154) {
                  		tmp = 1.0 / (2.0 + (b * (1.0 + ((b * (0.125 + ((b * (b * b)) * 0.004629629629629629))) / (0.25 + ((b * 0.16666666666666666) * ((b * 0.16666666666666666) - 0.5)))))));
                  	} else {
                  		tmp = 2.0 / (b * b);
                  	}
                  	return tmp;
                  }
                  
                  def code(a, b):
                  	tmp = 0
                  	if b <= 36000000000.0:
                  		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))))
                  	elif b <= 8.2e+73:
                  		tmp = -0.020833333333333332 * (a * (a * a))
                  	elif b <= 1e+154:
                  		tmp = 1.0 / (2.0 + (b * (1.0 + ((b * (0.125 + ((b * (b * b)) * 0.004629629629629629))) / (0.25 + ((b * 0.16666666666666666) * ((b * 0.16666666666666666) - 0.5)))))))
                  	else:
                  		tmp = 2.0 / (b * b)
                  	return tmp
                  
                  function code(a, b)
                  	tmp = 0.0
                  	if (b <= 36000000000.0)
                  		tmp = Float64(0.5 + Float64(a * Float64(0.25 + Float64(a * Float64(a * Float64(-0.020833333333333332 + Float64(a * Float64(a * 0.0020833333333333333))))))));
                  	elseif (b <= 8.2e+73)
                  		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
                  	elseif (b <= 1e+154)
                  		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(Float64(b * Float64(0.125 + Float64(Float64(b * Float64(b * b)) * 0.004629629629629629))) / Float64(0.25 + Float64(Float64(b * 0.16666666666666666) * Float64(Float64(b * 0.16666666666666666) - 0.5))))))));
                  	else
                  		tmp = Float64(2.0 / Float64(b * b));
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(a, b)
                  	tmp = 0.0;
                  	if (b <= 36000000000.0)
                  		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                  	elseif (b <= 8.2e+73)
                  		tmp = -0.020833333333333332 * (a * (a * a));
                  	elseif (b <= 1e+154)
                  		tmp = 1.0 / (2.0 + (b * (1.0 + ((b * (0.125 + ((b * (b * b)) * 0.004629629629629629))) / (0.25 + ((b * 0.16666666666666666) * ((b * 0.16666666666666666) - 0.5)))))));
                  	else
                  		tmp = 2.0 / (b * b);
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[a_, b_] := If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * N[(0.25 + N[(a * N[(a * N[(-0.020833333333333332 + N[(a * N[(a * 0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.2e+73], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e+154], N[(1.0 / N[(2.0 + N[(b * N[(1.0 + N[(N[(b * N[(0.125 + N[(N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.25 + N[(N[(b * 0.16666666666666666), $MachinePrecision] * N[(N[(b * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;b \leq 36000000000:\\
                  \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\
                  
                  \mathbf{elif}\;b \leq 8.2 \cdot 10^{+73}:\\
                  \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
                  
                  \mathbf{elif}\;b \leq 10^{+154}:\\
                  \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{b \cdot \left(0.125 + \left(b \cdot \left(b \cdot b\right)\right) \cdot 0.004629629629629629\right)}{0.25 + \left(b \cdot 0.16666666666666666\right) \cdot \left(b \cdot 0.16666666666666666 - 0.5\right)}\right)}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{2}{b \cdot b}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 4 regimes
                  2. if b < 3.6e10

                    1. Initial program 99.4%

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

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                    4. Step-by-step derivation
                      1. Simplified78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{1}{480}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                        16. *-lowering-*.f6458.0%

                          \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{480}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                      4. Simplified58.0%

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

                      if 3.6e10 < b < 8.1999999999999996e73

                      1. Initial program 100.0%

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

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                      4. Step-by-step derivation
                        1. Simplified37.7%

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                          7. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                          8. *-lowering-*.f642.7%

                            \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                        4. Simplified2.7%

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

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

                            \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                          2. cube-multN/A

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                          6. *-lowering-*.f6458.1%

                            \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                        7. Simplified58.1%

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

                        if 8.1999999999999996e73 < b < 1.00000000000000004e154

                        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. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                          2. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                          3. exp-lowering-exp.f64100.0%

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                        5. Simplified100.0%

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                          7. *-lowering-*.f6457.5%

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                        8. Simplified57.5%

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

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

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(\frac{{\frac{1}{2}}^{3} + {\left(b \cdot \frac{1}{6}\right)}^{3}}{\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)} \cdot b\right)\right)\right)\right)\right) \]
                          3. associate-*l/N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(\frac{\left({\frac{1}{2}}^{3} + {\left(b \cdot \frac{1}{6}\right)}^{3}\right) \cdot b}{\color{blue}{\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)}}\right)\right)\right)\right)\right) \]
                          4. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\left({\frac{1}{2}}^{3} + {\left(b \cdot \frac{1}{6}\right)}^{3}\right) \cdot b\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)}\right)\right)\right)\right)\right) \]
                          5. *-lowering-*.f64N/A

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

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\left({\frac{1}{2}}^{3}\right), \left({\left(b \cdot \frac{1}{6}\right)}^{3}\right)\right), b\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          7. metadata-evalN/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \left({\left(b \cdot \frac{1}{6}\right)}^{3}\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          8. unpow-prod-downN/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \left({b}^{3} \cdot {\frac{1}{6}}^{3}\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          9. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\left({b}^{3}\right), \left({\frac{1}{6}}^{3}\right)\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          10. cube-multN/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\left(b \cdot \left(b \cdot b\right)\right), \left({\frac{1}{6}}^{3}\right)\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          11. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \left(b \cdot b\right)\right), \left({\frac{1}{6}}^{3}\right)\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          12. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \left({\frac{1}{6}}^{3}\right)\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          13. metadata-evalN/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          14. metadata-evalN/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \left(\frac{1}{4} + \left(\color{blue}{\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right)} - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          15. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \mathsf{+.f64}\left(\frac{1}{4}, \color{blue}{\left(\left(b \cdot \frac{1}{6}\right) \cdot \left(b \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(b \cdot \frac{1}{6}\right)\right)}\right)\right)\right)\right)\right)\right) \]
                          16. distribute-rgt-out--N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(\left(b \cdot \frac{1}{6}\right) \cdot \color{blue}{\left(b \cdot \frac{1}{6} - \frac{1}{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                          17. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(b \cdot \frac{1}{6}\right), \color{blue}{\left(b \cdot \frac{1}{6} - \frac{1}{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                          18. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \frac{1}{6}\right), \left(\color{blue}{b \cdot \frac{1}{6}} - \frac{1}{2}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          19. --lowering--.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, b\right)\right), \frac{1}{216}\right)\right), b\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \frac{1}{6}\right), \mathsf{\_.f64}\left(\left(b \cdot \frac{1}{6}\right), \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                        10. Applied egg-rr96.6%

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

                        if 1.00000000000000004e154 < 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. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                          2. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                          3. exp-lowering-exp.f64100.0%

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                        5. Simplified100.0%

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

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

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

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

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

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                          5. *-lowering-*.f64100.0%

                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                        8. Simplified100.0%

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

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

                            \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                          2. unpow2N/A

                            \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                          3. *-lowering-*.f64100.0%

                            \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
                        11. Simplified100.0%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{+73}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{elif}\;b \leq 10^{+154}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{b \cdot \left(0.125 + \left(b \cdot \left(b \cdot b\right)\right) \cdot 0.004629629629629629\right)}{0.25 + \left(b \cdot 0.16666666666666666\right) \cdot \left(b \cdot 0.16666666666666666 - 0.5\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 9: 61.2% accurate, 7.6× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{+73}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{2 + \frac{0.25 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right) - b \cdot b}{b \cdot \left(b \cdot 0.5\right) - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \end{array} \]
                      (FPCore (a b)
                       :precision binary64
                       (if (<= b 36000000000.0)
                         (+
                          0.5
                          (*
                           a
                           (+
                            0.25
                            (*
                             a
                             (* a (+ -0.020833333333333332 (* a (* a 0.0020833333333333333))))))))
                         (if (<= b 8.2e+73)
                           (* -0.020833333333333332 (* a (* a a)))
                           (if (<= b 1.35e+154)
                             (/
                              1.0
                              (+
                               2.0
                               (/ (- (* 0.25 (* (* b b) (* b b))) (* b b)) (- (* b (* b 0.5)) b))))
                             (/ 2.0 (* b b))))))
                      double code(double a, double b) {
                      	double tmp;
                      	if (b <= 36000000000.0) {
                      		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                      	} else if (b <= 8.2e+73) {
                      		tmp = -0.020833333333333332 * (a * (a * a));
                      	} else if (b <= 1.35e+154) {
                      		tmp = 1.0 / (2.0 + (((0.25 * ((b * b) * (b * b))) - (b * b)) / ((b * (b * 0.5)) - b)));
                      	} else {
                      		tmp = 2.0 / (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 <= 36000000000.0d0) then
                              tmp = 0.5d0 + (a * (0.25d0 + (a * (a * ((-0.020833333333333332d0) + (a * (a * 0.0020833333333333333d0)))))))
                          else if (b <= 8.2d+73) then
                              tmp = (-0.020833333333333332d0) * (a * (a * a))
                          else if (b <= 1.35d+154) then
                              tmp = 1.0d0 / (2.0d0 + (((0.25d0 * ((b * b) * (b * b))) - (b * b)) / ((b * (b * 0.5d0)) - b)))
                          else
                              tmp = 2.0d0 / (b * b)
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double a, double b) {
                      	double tmp;
                      	if (b <= 36000000000.0) {
                      		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                      	} else if (b <= 8.2e+73) {
                      		tmp = -0.020833333333333332 * (a * (a * a));
                      	} else if (b <= 1.35e+154) {
                      		tmp = 1.0 / (2.0 + (((0.25 * ((b * b) * (b * b))) - (b * b)) / ((b * (b * 0.5)) - b)));
                      	} else {
                      		tmp = 2.0 / (b * b);
                      	}
                      	return tmp;
                      }
                      
                      def code(a, b):
                      	tmp = 0
                      	if b <= 36000000000.0:
                      		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))))
                      	elif b <= 8.2e+73:
                      		tmp = -0.020833333333333332 * (a * (a * a))
                      	elif b <= 1.35e+154:
                      		tmp = 1.0 / (2.0 + (((0.25 * ((b * b) * (b * b))) - (b * b)) / ((b * (b * 0.5)) - b)))
                      	else:
                      		tmp = 2.0 / (b * b)
                      	return tmp
                      
                      function code(a, b)
                      	tmp = 0.0
                      	if (b <= 36000000000.0)
                      		tmp = Float64(0.5 + Float64(a * Float64(0.25 + Float64(a * Float64(a * Float64(-0.020833333333333332 + Float64(a * Float64(a * 0.0020833333333333333))))))));
                      	elseif (b <= 8.2e+73)
                      		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
                      	elseif (b <= 1.35e+154)
                      		tmp = Float64(1.0 / Float64(2.0 + Float64(Float64(Float64(0.25 * Float64(Float64(b * b) * Float64(b * b))) - Float64(b * b)) / Float64(Float64(b * Float64(b * 0.5)) - b))));
                      	else
                      		tmp = Float64(2.0 / Float64(b * b));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(a, b)
                      	tmp = 0.0;
                      	if (b <= 36000000000.0)
                      		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                      	elseif (b <= 8.2e+73)
                      		tmp = -0.020833333333333332 * (a * (a * a));
                      	elseif (b <= 1.35e+154)
                      		tmp = 1.0 / (2.0 + (((0.25 * ((b * b) * (b * b))) - (b * b)) / ((b * (b * 0.5)) - b)));
                      	else
                      		tmp = 2.0 / (b * b);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[a_, b_] := If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * N[(0.25 + N[(a * N[(a * N[(-0.020833333333333332 + N[(a * N[(a * 0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.2e+73], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.35e+154], N[(1.0 / N[(2.0 + N[(N[(N[(0.25 * N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(b * N[(b * 0.5), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;b \leq 36000000000:\\
                      \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\
                      
                      \mathbf{elif}\;b \leq 8.2 \cdot 10^{+73}:\\
                      \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
                      
                      \mathbf{elif}\;b \leq 1.35 \cdot 10^{+154}:\\
                      \;\;\;\;\frac{1}{2 + \frac{0.25 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right) - b \cdot b}{b \cdot \left(b \cdot 0.5\right) - b}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{2}{b \cdot b}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 4 regimes
                      2. if b < 3.6e10

                        1. Initial program 99.4%

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

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                        4. Step-by-step derivation
                          1. Simplified78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{1}{480}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                            16. *-lowering-*.f6458.0%

                              \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{480}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                          4. Simplified58.0%

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

                          if 3.6e10 < b < 8.1999999999999996e73

                          1. Initial program 100.0%

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

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                          4. Step-by-step derivation
                            1. Simplified37.7%

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                              7. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                              8. *-lowering-*.f642.7%

                                \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                            4. Simplified2.7%

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

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

                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                              2. cube-multN/A

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

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

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

                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                              6. *-lowering-*.f6458.1%

                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                            7. Simplified58.1%

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

                            if 8.1999999999999996e73 < b < 1.35000000000000003e154

                            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. /-lowering-/.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                              2. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                              3. exp-lowering-exp.f64100.0%

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                            5. Simplified100.0%

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

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

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

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

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

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                              5. *-lowering-*.f647.2%

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                            8. Simplified7.2%

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

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \left(b \cdot \left(b \cdot \frac{1}{2} + \color{blue}{1}\right)\right)\right)\right) \]
                              2. distribute-rgt-inN/A

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

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

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

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

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

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(b \cdot \frac{1}{2}\right) \cdot b\right)\right), \left(b \cdot b\right)\right), \left(\left(b \cdot \frac{1}{2}\right) \cdot b - b\right)\right)\right)\right) \]
                              8. associate-*l*N/A

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

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

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\left(\frac{1}{2} \cdot \left(b \cdot b\right)\right) \cdot \left(\frac{1}{2} \cdot \left(b \cdot b\right)\right)\right), \left(b \cdot b\right)\right), \left(\left(b \cdot \color{blue}{\frac{1}{2}}\right) \cdot b - b\right)\right)\right)\right) \]
                              11. swap-sqrN/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\left(\frac{1}{2} \cdot \frac{1}{2}\right) \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right), \left(b \cdot b\right)\right), \left(\color{blue}{\left(b \cdot \frac{1}{2}\right)} \cdot b - b\right)\right)\right)\right) \]
                              12. metadata-evalN/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right), \left(b \cdot b\right)\right), \left(\left(\color{blue}{b} \cdot \frac{1}{2}\right) \cdot b - b\right)\right)\right)\right) \]
                              13. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right)\right), \left(b \cdot b\right)\right), \left(\color{blue}{\left(b \cdot \frac{1}{2}\right)} \cdot b - b\right)\right)\right)\right) \]
                              14. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(b \cdot b\right), \left(b \cdot b\right)\right)\right), \left(b \cdot b\right)\right), \left(\left(b \cdot \color{blue}{\frac{1}{2}}\right) \cdot b - b\right)\right)\right)\right) \]
                              15. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(b \cdot b\right)\right)\right), \left(b \cdot b\right)\right), \left(\left(b \cdot \frac{1}{2}\right) \cdot b - b\right)\right)\right)\right) \]
                              16. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \left(b \cdot b\right)\right), \left(\left(b \cdot \frac{1}{2}\right) \cdot b - b\right)\right)\right)\right) \]
                              17. *-lowering-*.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{*.f64}\left(b, b\right)\right), \left(\left(b \cdot \frac{1}{2}\right) \cdot \color{blue}{b} - b\right)\right)\right)\right) \]
                              18. --lowering--.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(b, b\right)\right)\right), \mathsf{*.f64}\left(b, b\right)\right), \mathsf{\_.f64}\left(\left(\left(b \cdot \frac{1}{2}\right) \cdot b\right), \color{blue}{b}\right)\right)\right)\right) \]
                            10. Applied egg-rr96.6%

                              \[\leadsto \frac{1}{2 + \color{blue}{\frac{0.25 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right) - b \cdot b}{b \cdot \left(0.5 \cdot b\right) - b}}} \]

                            if 1.35000000000000003e154 < 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. /-lowering-/.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                              2. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                              3. exp-lowering-exp.f64100.0%

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                            5. Simplified100.0%

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

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

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

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

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

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                              5. *-lowering-*.f64100.0%

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                            8. Simplified100.0%

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

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

                                \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                              2. unpow2N/A

                                \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                              3. *-lowering-*.f64100.0%

                                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
                            11. Simplified100.0%

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

                            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{+73}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{2 + \frac{0.25 \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right)\right) - b \cdot b}{b \cdot \left(b \cdot 0.5\right) - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \]
                          7. Add Preprocessing

                          Alternative 10: 60.1% accurate, 13.9× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{+102}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\ \end{array} \end{array} \]
                          (FPCore (a b)
                           :precision binary64
                           (if (<= b 36000000000.0)
                             (+
                              0.5
                              (*
                               a
                               (+
                                0.25
                                (*
                                 a
                                 (* a (+ -0.020833333333333332 (* a (* a 0.0020833333333333333))))))))
                             (if (<= b 2.7e+102)
                               (* -0.020833333333333332 (* a (* a a)))
                               (/ 6.0 (* b (* b b))))))
                          double code(double a, double b) {
                          	double tmp;
                          	if (b <= 36000000000.0) {
                          		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                          	} else if (b <= 2.7e+102) {
                          		tmp = -0.020833333333333332 * (a * (a * a));
                          	} else {
                          		tmp = 6.0 / (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 <= 36000000000.0d0) then
                                  tmp = 0.5d0 + (a * (0.25d0 + (a * (a * ((-0.020833333333333332d0) + (a * (a * 0.0020833333333333333d0)))))))
                              else if (b <= 2.7d+102) then
                                  tmp = (-0.020833333333333332d0) * (a * (a * a))
                              else
                                  tmp = 6.0d0 / (b * (b * b))
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double a, double b) {
                          	double tmp;
                          	if (b <= 36000000000.0) {
                          		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                          	} else if (b <= 2.7e+102) {
                          		tmp = -0.020833333333333332 * (a * (a * a));
                          	} else {
                          		tmp = 6.0 / (b * (b * b));
                          	}
                          	return tmp;
                          }
                          
                          def code(a, b):
                          	tmp = 0
                          	if b <= 36000000000.0:
                          		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))))
                          	elif b <= 2.7e+102:
                          		tmp = -0.020833333333333332 * (a * (a * a))
                          	else:
                          		tmp = 6.0 / (b * (b * b))
                          	return tmp
                          
                          function code(a, b)
                          	tmp = 0.0
                          	if (b <= 36000000000.0)
                          		tmp = Float64(0.5 + Float64(a * Float64(0.25 + Float64(a * Float64(a * Float64(-0.020833333333333332 + Float64(a * Float64(a * 0.0020833333333333333))))))));
                          	elseif (b <= 2.7e+102)
                          		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
                          	else
                          		tmp = Float64(6.0 / Float64(b * Float64(b * b)));
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(a, b)
                          	tmp = 0.0;
                          	if (b <= 36000000000.0)
                          		tmp = 0.5 + (a * (0.25 + (a * (a * (-0.020833333333333332 + (a * (a * 0.0020833333333333333)))))));
                          	elseif (b <= 2.7e+102)
                          		tmp = -0.020833333333333332 * (a * (a * a));
                          	else
                          		tmp = 6.0 / (b * (b * b));
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[a_, b_] := If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * N[(0.25 + N[(a * N[(a * N[(-0.020833333333333332 + N[(a * N[(a * 0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e+102], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;b \leq 36000000000:\\
                          \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot \left(-0.020833333333333332 + a \cdot \left(a \cdot 0.0020833333333333333\right)\right)\right)\right)\\
                          
                          \mathbf{elif}\;b \leq 2.7 \cdot 10^{+102}:\\
                          \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if b < 3.6e10

                            1. Initial program 99.4%

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

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                            4. Step-by-step derivation
                              1. Simplified78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{1}{480}\right)}\right)\right)\right)\right)\right)\right)\right) \]
                                16. *-lowering-*.f6458.0%

                                  \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{480}}\right)\right)\right)\right)\right)\right)\right)\right) \]
                              4. Simplified58.0%

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

                              if 3.6e10 < b < 2.7000000000000001e102

                              1. Initial program 100.0%

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

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                              4. Step-by-step derivation
                                1. Simplified32.9%

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                  7. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                  8. *-lowering-*.f642.7%

                                    \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                                4. Simplified2.7%

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

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

                                    \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                                  2. cube-multN/A

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

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

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

                                    \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                                  6. *-lowering-*.f6447.7%

                                    \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                                7. Simplified47.7%

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

                                if 2.7000000000000001e102 < 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. /-lowering-/.f64N/A

                                    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                                  2. +-lowering-+.f64N/A

                                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                                  3. exp-lowering-exp.f64100.0%

                                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                                5. Simplified100.0%

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                                  7. *-lowering-*.f6498.1%

                                    \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                                8. Simplified98.1%

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

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

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

                                    \[\leadsto \mathsf{/.f64}\left(6, \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
                                  3. unpow2N/A

                                    \[\leadsto \mathsf{/.f64}\left(6, \left(b \cdot {b}^{\color{blue}{2}}\right)\right) \]
                                  4. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \color{blue}{\left({b}^{2}\right)}\right)\right) \]
                                  5. unpow2N/A

                                    \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \left(b \cdot \color{blue}{b}\right)\right)\right) \]
                                  6. *-lowering-*.f6498.1%

                                    \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right)\right) \]
                                11. Simplified98.1%

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

                              Alternative 11: 60.1% accurate, 17.9× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{+102}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\ \end{array} \end{array} \]
                              (FPCore (a b)
                               :precision binary64
                               (if (<= b 36000000000.0)
                                 (+ 0.5 (* a (+ 0.25 (* a (* a -0.020833333333333332)))))
                                 (if (<= b 2.7e+102)
                                   (* -0.020833333333333332 (* a (* a a)))
                                   (/ 6.0 (* b (* b b))))))
                              double code(double a, double b) {
                              	double tmp;
                              	if (b <= 36000000000.0) {
                              		tmp = 0.5 + (a * (0.25 + (a * (a * -0.020833333333333332))));
                              	} else if (b <= 2.7e+102) {
                              		tmp = -0.020833333333333332 * (a * (a * a));
                              	} else {
                              		tmp = 6.0 / (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 <= 36000000000.0d0) then
                                      tmp = 0.5d0 + (a * (0.25d0 + (a * (a * (-0.020833333333333332d0)))))
                                  else if (b <= 2.7d+102) then
                                      tmp = (-0.020833333333333332d0) * (a * (a * a))
                                  else
                                      tmp = 6.0d0 / (b * (b * b))
                                  end if
                                  code = tmp
                              end function
                              
                              public static double code(double a, double b) {
                              	double tmp;
                              	if (b <= 36000000000.0) {
                              		tmp = 0.5 + (a * (0.25 + (a * (a * -0.020833333333333332))));
                              	} else if (b <= 2.7e+102) {
                              		tmp = -0.020833333333333332 * (a * (a * a));
                              	} else {
                              		tmp = 6.0 / (b * (b * b));
                              	}
                              	return tmp;
                              }
                              
                              def code(a, b):
                              	tmp = 0
                              	if b <= 36000000000.0:
                              		tmp = 0.5 + (a * (0.25 + (a * (a * -0.020833333333333332))))
                              	elif b <= 2.7e+102:
                              		tmp = -0.020833333333333332 * (a * (a * a))
                              	else:
                              		tmp = 6.0 / (b * (b * b))
                              	return tmp
                              
                              function code(a, b)
                              	tmp = 0.0
                              	if (b <= 36000000000.0)
                              		tmp = Float64(0.5 + Float64(a * Float64(0.25 + Float64(a * Float64(a * -0.020833333333333332)))));
                              	elseif (b <= 2.7e+102)
                              		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
                              	else
                              		tmp = Float64(6.0 / Float64(b * Float64(b * b)));
                              	end
                              	return tmp
                              end
                              
                              function tmp_2 = code(a, b)
                              	tmp = 0.0;
                              	if (b <= 36000000000.0)
                              		tmp = 0.5 + (a * (0.25 + (a * (a * -0.020833333333333332))));
                              	elseif (b <= 2.7e+102)
                              		tmp = -0.020833333333333332 * (a * (a * a));
                              	else
                              		tmp = 6.0 / (b * (b * b));
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              code[a_, b_] := If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * N[(0.25 + N[(a * N[(a * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e+102], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;b \leq 36000000000:\\
                              \;\;\;\;0.5 + a \cdot \left(0.25 + a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\
                              
                              \mathbf{elif}\;b \leq 2.7 \cdot 10^{+102}:\\
                              \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if b < 3.6e10

                                1. Initial program 99.4%

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

                                  \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                4. Step-by-step derivation
                                  1. Simplified78.5%

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                    7. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                    8. *-lowering-*.f6457.9%

                                      \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                                  4. Simplified57.9%

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

                                  if 3.6e10 < b < 2.7000000000000001e102

                                  1. Initial program 100.0%

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

                                    \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                  4. Step-by-step derivation
                                    1. Simplified32.9%

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

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

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

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

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

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

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

                                        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                      7. *-lowering-*.f64N/A

                                        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                      8. *-lowering-*.f642.7%

                                        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                                    4. Simplified2.7%

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

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

                                        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                                      2. cube-multN/A

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

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

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

                                        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                                      6. *-lowering-*.f6447.7%

                                        \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                                    7. Simplified47.7%

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

                                    if 2.7000000000000001e102 < 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. /-lowering-/.f64N/A

                                        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                                      2. +-lowering-+.f64N/A

                                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                                      3. exp-lowering-exp.f64100.0%

                                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                                    5. Simplified100.0%

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

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

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

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

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

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

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

                                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                                      7. *-lowering-*.f6498.1%

                                        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                                    8. Simplified98.1%

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

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

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

                                        \[\leadsto \mathsf{/.f64}\left(6, \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
                                      3. unpow2N/A

                                        \[\leadsto \mathsf{/.f64}\left(6, \left(b \cdot {b}^{\color{blue}{2}}\right)\right) \]
                                      4. *-lowering-*.f64N/A

                                        \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \color{blue}{\left({b}^{2}\right)}\right)\right) \]
                                      5. unpow2N/A

                                        \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \left(b \cdot \color{blue}{b}\right)\right)\right) \]
                                      6. *-lowering-*.f6498.1%

                                        \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right)\right) \]
                                    11. Simplified98.1%

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

                                  Alternative 12: 60.1% accurate, 17.9× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot 0.25\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{+102}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\ \end{array} \end{array} \]
                                  (FPCore (a b)
                                   :precision binary64
                                   (if (<= b 36000000000.0)
                                     (+ 0.5 (* a 0.25))
                                     (if (<= b 2.7e+102)
                                       (* -0.020833333333333332 (* a (* a a)))
                                       (/ 6.0 (* b (* b b))))))
                                  double code(double a, double b) {
                                  	double tmp;
                                  	if (b <= 36000000000.0) {
                                  		tmp = 0.5 + (a * 0.25);
                                  	} else if (b <= 2.7e+102) {
                                  		tmp = -0.020833333333333332 * (a * (a * a));
                                  	} else {
                                  		tmp = 6.0 / (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 <= 36000000000.0d0) then
                                          tmp = 0.5d0 + (a * 0.25d0)
                                      else if (b <= 2.7d+102) then
                                          tmp = (-0.020833333333333332d0) * (a * (a * a))
                                      else
                                          tmp = 6.0d0 / (b * (b * b))
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double a, double b) {
                                  	double tmp;
                                  	if (b <= 36000000000.0) {
                                  		tmp = 0.5 + (a * 0.25);
                                  	} else if (b <= 2.7e+102) {
                                  		tmp = -0.020833333333333332 * (a * (a * a));
                                  	} else {
                                  		tmp = 6.0 / (b * (b * b));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(a, b):
                                  	tmp = 0
                                  	if b <= 36000000000.0:
                                  		tmp = 0.5 + (a * 0.25)
                                  	elif b <= 2.7e+102:
                                  		tmp = -0.020833333333333332 * (a * (a * a))
                                  	else:
                                  		tmp = 6.0 / (b * (b * b))
                                  	return tmp
                                  
                                  function code(a, b)
                                  	tmp = 0.0
                                  	if (b <= 36000000000.0)
                                  		tmp = Float64(0.5 + Float64(a * 0.25));
                                  	elseif (b <= 2.7e+102)
                                  		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
                                  	else
                                  		tmp = Float64(6.0 / Float64(b * Float64(b * b)));
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(a, b)
                                  	tmp = 0.0;
                                  	if (b <= 36000000000.0)
                                  		tmp = 0.5 + (a * 0.25);
                                  	elseif (b <= 2.7e+102)
                                  		tmp = -0.020833333333333332 * (a * (a * a));
                                  	else
                                  		tmp = 6.0 / (b * (b * b));
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[a_, b_] := If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e+102], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;b \leq 36000000000:\\
                                  \;\;\;\;0.5 + a \cdot 0.25\\
                                  
                                  \mathbf{elif}\;b \leq 2.7 \cdot 10^{+102}:\\
                                  \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if b < 3.6e10

                                    1. Initial program 99.4%

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

                                      \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                    4. Step-by-step derivation
                                      1. Simplified78.5%

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

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

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

                                          \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \left(a \cdot \color{blue}{\frac{1}{4}}\right)\right) \]
                                        3. *-lowering-*.f6457.7%

                                          \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{4}}\right)\right) \]
                                      4. Simplified57.7%

                                        \[\leadsto \color{blue}{0.5 + a \cdot 0.25} \]

                                      if 3.6e10 < b < 2.7000000000000001e102

                                      1. Initial program 100.0%

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

                                        \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                      4. Step-by-step derivation
                                        1. Simplified32.9%

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                          7. *-lowering-*.f64N/A

                                            \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                          8. *-lowering-*.f642.7%

                                            \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                                        4. Simplified2.7%

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

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

                                            \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                                          2. cube-multN/A

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

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

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

                                            \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                                          6. *-lowering-*.f6447.7%

                                            \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                                        7. Simplified47.7%

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

                                        if 2.7000000000000001e102 < 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. /-lowering-/.f64N/A

                                            \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                                          2. +-lowering-+.f64N/A

                                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                                          3. exp-lowering-exp.f64100.0%

                                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                                        5. Simplified100.0%

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                                          7. *-lowering-*.f6498.1%

                                            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
                                        8. Simplified98.1%

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

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

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

                                            \[\leadsto \mathsf{/.f64}\left(6, \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
                                          3. unpow2N/A

                                            \[\leadsto \mathsf{/.f64}\left(6, \left(b \cdot {b}^{\color{blue}{2}}\right)\right) \]
                                          4. *-lowering-*.f64N/A

                                            \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \color{blue}{\left({b}^{2}\right)}\right)\right) \]
                                          5. unpow2N/A

                                            \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \left(b \cdot \color{blue}{b}\right)\right)\right) \]
                                          6. *-lowering-*.f6498.1%

                                            \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right)\right) \]
                                        11. Simplified98.1%

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

                                      Alternative 13: 57.3% accurate, 17.9× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 36000000000:\\ \;\;\;\;0.5 + a \cdot 0.25\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \end{array} \]
                                      (FPCore (a b)
                                       :precision binary64
                                       (if (<= b 36000000000.0)
                                         (+ 0.5 (* a 0.25))
                                         (if (<= b 1.35e+154)
                                           (* -0.020833333333333332 (* a (* a a)))
                                           (/ 2.0 (* b b)))))
                                      double code(double a, double b) {
                                      	double tmp;
                                      	if (b <= 36000000000.0) {
                                      		tmp = 0.5 + (a * 0.25);
                                      	} else if (b <= 1.35e+154) {
                                      		tmp = -0.020833333333333332 * (a * (a * a));
                                      	} else {
                                      		tmp = 2.0 / (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 <= 36000000000.0d0) then
                                              tmp = 0.5d0 + (a * 0.25d0)
                                          else if (b <= 1.35d+154) then
                                              tmp = (-0.020833333333333332d0) * (a * (a * a))
                                          else
                                              tmp = 2.0d0 / (b * b)
                                          end if
                                          code = tmp
                                      end function
                                      
                                      public static double code(double a, double b) {
                                      	double tmp;
                                      	if (b <= 36000000000.0) {
                                      		tmp = 0.5 + (a * 0.25);
                                      	} else if (b <= 1.35e+154) {
                                      		tmp = -0.020833333333333332 * (a * (a * a));
                                      	} else {
                                      		tmp = 2.0 / (b * b);
                                      	}
                                      	return tmp;
                                      }
                                      
                                      def code(a, b):
                                      	tmp = 0
                                      	if b <= 36000000000.0:
                                      		tmp = 0.5 + (a * 0.25)
                                      	elif b <= 1.35e+154:
                                      		tmp = -0.020833333333333332 * (a * (a * a))
                                      	else:
                                      		tmp = 2.0 / (b * b)
                                      	return tmp
                                      
                                      function code(a, b)
                                      	tmp = 0.0
                                      	if (b <= 36000000000.0)
                                      		tmp = Float64(0.5 + Float64(a * 0.25));
                                      	elseif (b <= 1.35e+154)
                                      		tmp = Float64(-0.020833333333333332 * Float64(a * Float64(a * a)));
                                      	else
                                      		tmp = Float64(2.0 / Float64(b * b));
                                      	end
                                      	return tmp
                                      end
                                      
                                      function tmp_2 = code(a, b)
                                      	tmp = 0.0;
                                      	if (b <= 36000000000.0)
                                      		tmp = 0.5 + (a * 0.25);
                                      	elseif (b <= 1.35e+154)
                                      		tmp = -0.020833333333333332 * (a * (a * a));
                                      	else
                                      		tmp = 2.0 / (b * b);
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      code[a_, b_] := If[LessEqual[b, 36000000000.0], N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.35e+154], N[(-0.020833333333333332 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;b \leq 36000000000:\\
                                      \;\;\;\;0.5 + a \cdot 0.25\\
                                      
                                      \mathbf{elif}\;b \leq 1.35 \cdot 10^{+154}:\\
                                      \;\;\;\;-0.020833333333333332 \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{2}{b \cdot b}\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if b < 3.6e10

                                        1. Initial program 99.4%

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

                                          \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                        4. Step-by-step derivation
                                          1. Simplified78.5%

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

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

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

                                              \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \left(a \cdot \color{blue}{\frac{1}{4}}\right)\right) \]
                                            3. *-lowering-*.f6457.7%

                                              \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{4}}\right)\right) \]
                                          4. Simplified57.7%

                                            \[\leadsto \color{blue}{0.5 + a \cdot 0.25} \]

                                          if 3.6e10 < b < 1.35000000000000003e154

                                          1. Initial program 100.0%

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

                                            \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                          4. Step-by-step derivation
                                            1. Simplified35.4%

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

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

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

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

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

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

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

                                                \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \left(a \cdot \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                              7. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \color{blue}{\left(a \cdot \frac{-1}{48}\right)}\right)\right)\right)\right) \]
                                              8. *-lowering-*.f642.7%

                                                \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{\frac{-1}{48}}\right)\right)\right)\right)\right) \]
                                            4. Simplified2.7%

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

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

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \color{blue}{\left({a}^{3}\right)}\right) \]
                                              2. cube-multN/A

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

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

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

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \left(a \cdot \color{blue}{a}\right)\right)\right) \]
                                              6. *-lowering-*.f6442.5%

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{48}, \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(a, \color{blue}{a}\right)\right)\right) \]
                                            7. Simplified42.5%

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

                                            if 1.35000000000000003e154 < 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. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                                              2. +-lowering-+.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                                              3. exp-lowering-exp.f64100.0%

                                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                                            5. Simplified100.0%

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

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

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

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

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

                                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                                              5. *-lowering-*.f64100.0%

                                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                                            8. Simplified100.0%

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

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

                                                \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                                              2. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                                              3. *-lowering-*.f64100.0%

                                                \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
                                            11. Simplified100.0%

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

                                          Alternative 14: 52.5% accurate, 30.5× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.8:\\ \;\;\;\;0.5 + a \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{b \cdot b}\\ \end{array} \end{array} \]
                                          (FPCore (a b)
                                           :precision binary64
                                           (if (<= b 1.8) (+ 0.5 (* a 0.25)) (/ 2.0 (* b b))))
                                          double code(double a, double b) {
                                          	double tmp;
                                          	if (b <= 1.8) {
                                          		tmp = 0.5 + (a * 0.25);
                                          	} else {
                                          		tmp = 2.0 / (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 <= 1.8d0) then
                                                  tmp = 0.5d0 + (a * 0.25d0)
                                              else
                                                  tmp = 2.0d0 / (b * b)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double a, double b) {
                                          	double tmp;
                                          	if (b <= 1.8) {
                                          		tmp = 0.5 + (a * 0.25);
                                          	} else {
                                          		tmp = 2.0 / (b * b);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(a, b):
                                          	tmp = 0
                                          	if b <= 1.8:
                                          		tmp = 0.5 + (a * 0.25)
                                          	else:
                                          		tmp = 2.0 / (b * b)
                                          	return tmp
                                          
                                          function code(a, b)
                                          	tmp = 0.0
                                          	if (b <= 1.8)
                                          		tmp = Float64(0.5 + Float64(a * 0.25));
                                          	else
                                          		tmp = Float64(2.0 / Float64(b * b));
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(a, b)
                                          	tmp = 0.0;
                                          	if (b <= 1.8)
                                          		tmp = 0.5 + (a * 0.25);
                                          	else
                                          		tmp = 2.0 / (b * b);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[a_, b_] := If[LessEqual[b, 1.8], N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;b \leq 1.8:\\
                                          \;\;\;\;0.5 + a \cdot 0.25\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\frac{2}{b \cdot b}\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if b < 1.80000000000000004

                                            1. Initial program 99.4%

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

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                            4. Step-by-step derivation
                                              1. Simplified78.4%

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

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

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

                                                  \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \left(a \cdot \color{blue}{\frac{1}{4}}\right)\right) \]
                                                3. *-lowering-*.f6458.0%

                                                  \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{4}}\right)\right) \]
                                              4. Simplified58.0%

                                                \[\leadsto \color{blue}{0.5 + a \cdot 0.25} \]

                                              if 1.80000000000000004 < 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. /-lowering-/.f64N/A

                                                  \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                                                2. +-lowering-+.f64N/A

                                                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                                                3. exp-lowering-exp.f64100.0%

                                                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                                              5. Simplified100.0%

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

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

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

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

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

                                                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \left(b \cdot \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                                                5. *-lowering-*.f6443.1%

                                                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\frac{1}{2}}\right)\right)\right)\right)\right) \]
                                              8. Simplified43.1%

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

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

                                                  \[\leadsto \mathsf{/.f64}\left(2, \color{blue}{\left({b}^{2}\right)}\right) \]
                                                2. unpow2N/A

                                                  \[\leadsto \mathsf{/.f64}\left(2, \left(b \cdot \color{blue}{b}\right)\right) \]
                                                3. *-lowering-*.f6443.1%

                                                  \[\leadsto \mathsf{/.f64}\left(2, \mathsf{*.f64}\left(b, \color{blue}{b}\right)\right) \]
                                              11. Simplified43.1%

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

                                            Alternative 15: 39.2% accurate, 61.0× speedup?

                                            \[\begin{array}{l} \\ 0.5 + a \cdot 0.25 \end{array} \]
                                            (FPCore (a b) :precision binary64 (+ 0.5 (* a 0.25)))
                                            double code(double a, double b) {
                                            	return 0.5 + (a * 0.25);
                                            }
                                            
                                            real(8) function code(a, b)
                                                real(8), intent (in) :: a
                                                real(8), intent (in) :: b
                                                code = 0.5d0 + (a * 0.25d0)
                                            end function
                                            
                                            public static double code(double a, double b) {
                                            	return 0.5 + (a * 0.25);
                                            }
                                            
                                            def code(a, b):
                                            	return 0.5 + (a * 0.25)
                                            
                                            function code(a, b)
                                            	return Float64(0.5 + Float64(a * 0.25))
                                            end
                                            
                                            function tmp = code(a, b)
                                            	tmp = 0.5 + (a * 0.25);
                                            end
                                            
                                            code[a_, b_] := N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            0.5 + a \cdot 0.25
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 99.6%

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

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{exp.f64}\left(a\right), \mathsf{+.f64}\left(\mathsf{exp.f64}\left(a\right), \color{blue}{1}\right)\right) \]
                                            4. Step-by-step derivation
                                              1. Simplified66.6%

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

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

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

                                                  \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \left(a \cdot \color{blue}{\frac{1}{4}}\right)\right) \]
                                                3. *-lowering-*.f6442.7%

                                                  \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(a, \color{blue}{\frac{1}{4}}\right)\right) \]
                                              4. Simplified42.7%

                                                \[\leadsto \color{blue}{0.5 + a \cdot 0.25} \]
                                              5. Add Preprocessing

                                              Alternative 16: 39.0% accurate, 305.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.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. /-lowering-/.f64N/A

                                                  \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(1 + e^{b}\right)}\right) \]
                                                2. +-lowering-+.f64N/A

                                                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \color{blue}{\left(e^{b}\right)}\right)\right) \]
                                                3. exp-lowering-exp.f6484.3%

                                                  \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, \mathsf{exp.f64}\left(b\right)\right)\right) \]
                                              5. Simplified84.3%

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

                                                \[\leadsto \color{blue}{\frac{1}{2}} \]
                                              7. Step-by-step derivation
                                                1. Simplified41.9%

                                                  \[\leadsto \color{blue}{0.5} \]
                                                2. Add Preprocessing

                                                Developer Target 1: 100.0% accurate, 2.9× 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 2024139 
                                                (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))))