Quotient of sum of exps

Percentage Accurate: 99.2% → 99.2%
Time: 3.3s
Alternatives: 17
Speedup: 1.0×

Specification

?
\[\frac{e^{a}}{e^{a} + e^{b}} \]
(FPCore (a b)
  :precision binary64
  (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, b)
use fmin_fmax_functions
    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]
\frac{e^{a}}{e^{a} + e^{b}}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 99.2% accurate, 1.0× speedup?

\[\frac{e^{a}}{e^{a} + e^{b}} \]
(FPCore (a b)
  :precision binary64
  (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, b)
use fmin_fmax_functions
    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]
\frac{e^{a}}{e^{a} + e^{b}}

Alternative 1: 99.2% accurate, 1.0× speedup?

\[\frac{e^{a}}{e^{a} + \frac{1}{e^{-b}}} \]
(FPCore (a b)
  :precision binary64
  (/ (exp a) (+ (exp a) (/ 1 (exp (- b))))))
double code(double a, double b) {
	return exp(a) / (exp(a) + (1.0 / exp(-b)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, b)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + (1.0d0 / exp(-b)))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + (1.0 / Math.exp(-b)));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + (1.0 / math.exp(-b)))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + Float64(1.0 / exp(Float64(-b)))))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + (1.0 / exp(-b)));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[(1 / N[Exp[(-b)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{e^{a}}{e^{a} + \frac{1}{e^{-b}}}
Derivation
  1. Initial program 99.2%

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

      \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
    2. sinh-+-cosh-revN/A

      \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
    3. add-flipN/A

      \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
    4. cosh-neg-revN/A

      \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
    5. sinh-neg-revN/A

      \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
    6. sinh---cosh-revN/A

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

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

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

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

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

    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\frac{1}{e^{-b}}}} \]
  4. Add Preprocessing

Alternative 2: 97.7% accurate, 1.5× speedup?

\[\frac{e^{a}}{1 + e^{b}} \]
(FPCore (a b)
  :precision binary64
  (/ (exp a) (+ 1 (exp b))))
double code(double a, double b) {
	return exp(a) / (1.0 + exp(b));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

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

      \[\leadsto \frac{e^{a}}{1 + \color{blue}{e^{b}}} \]
    2. lower-exp.f6497.7%

      \[\leadsto \frac{e^{a}}{1 + e^{b}} \]
  4. Applied rewrites97.7%

    \[\leadsto \frac{e^{a}}{\color{blue}{1 + e^{b}}} \]
  5. Add Preprocessing

Alternative 3: 94.0% accurate, 2.1× speedup?

\[\frac{1}{\left(\left(e^{b} + a\right) + \sqrt{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} \cdot \frac{1}{2}\right) - -1} \]
(FPCore (a b)
  :precision binary64
  (/ 1 (- (+ (+ (exp b) a) (* (sqrt (* (* a a) (* a a))) 1/2)) -1)))
double code(double a, double b) {
	return 1.0 / (((exp(b) + a) + (sqrt(((a * a) * (a * a))) * 0.5)) - -1.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, b)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = 1.0d0 / (((exp(b) + a) + (sqrt(((a * a) * (a * a))) * 0.5d0)) - (-1.0d0))
end function
public static double code(double a, double b) {
	return 1.0 / (((Math.exp(b) + a) + (Math.sqrt(((a * a) * (a * a))) * 0.5)) - -1.0);
}
def code(a, b):
	return 1.0 / (((math.exp(b) + a) + (math.sqrt(((a * a) * (a * a))) * 0.5)) - -1.0)
function code(a, b)
	return Float64(1.0 / Float64(Float64(Float64(exp(b) + a) + Float64(sqrt(Float64(Float64(a * a) * Float64(a * a))) * 0.5)) - -1.0))
end
function tmp = code(a, b)
	tmp = 1.0 / (((exp(b) + a) + (sqrt(((a * a) * (a * a))) * 0.5)) - -1.0);
end
code[a_, b_] := N[(1 / N[(N[(N[(N[Exp[b], $MachinePrecision] + a), $MachinePrecision] + N[(N[Sqrt[N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision]
\frac{1}{\left(\left(e^{b} + a\right) + \sqrt{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} \cdot \frac{1}{2}\right) - -1}
Derivation
  1. Initial program 99.2%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
    3. Step-by-step derivation
      1. Applied rewrites81.5%

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

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

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

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

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

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

          \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
        6. lower-*.f6489.6%

          \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
      4. Applied rewrites89.6%

        \[\leadsto \frac{1}{\color{blue}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\right)}} \]
      5. Step-by-step derivation
        1. lift-+.f64N/A

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

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

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

          \[\leadsto \frac{1}{\left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\right) - -1} \]
        5. lower--.f6489.6%

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

        \[\leadsto \frac{1}{\left(\left(e^{b} + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - \color{blue}{-1}} \]
      7. Step-by-step derivation
        1. rem-square-sqrtN/A

          \[\leadsto \frac{1}{\left(\left(e^{b} + a\right) + \left(\sqrt{a \cdot a} \cdot \sqrt{a \cdot a}\right) \cdot \frac{1}{2}\right) - -1} \]
        2. sqrt-unprodN/A

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

          \[\leadsto \frac{1}{\left(\left(e^{b} + a\right) + \sqrt{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} \cdot \frac{1}{2}\right) - -1} \]
        4. lower-*.f6494.0%

          \[\leadsto \frac{1}{\left(\left(e^{b} + a\right) + \sqrt{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} \cdot \frac{1}{2}\right) - -1} \]
      8. Applied rewrites94.0%

        \[\leadsto \frac{1}{\left(\left(e^{b} + a\right) + \sqrt{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} \cdot \frac{1}{2}\right) - -1} \]
      9. Add Preprocessing

      Alternative 4: 93.9% accurate, 2.1× speedup?

      \[\begin{array}{l} t_0 := 1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\\ \mathbf{if}\;a \leq -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{t\_0 + e^{b}}\\ \end{array} \]
      (FPCore (a b)
        :precision binary64
        (let* ((t_0 (+ 1 (* a (+ 1 (* 1/2 a))))))
        (if (<=
             a
             -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296)
          (/ 1 (+ 2 (* a (+ 1 (* a (+ 1/2 (* 1/6 a)))))))
          (/ t_0 (+ t_0 (exp b))))))
      double code(double a, double b) {
      	double t_0 = 1.0 + (a * (1.0 + (0.5 * a)));
      	double tmp;
      	if (a <= -7e+103) {
      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
      	} else {
      		tmp = t_0 / (t_0 + exp(b));
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(a, b)
      use fmin_fmax_functions
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8) :: t_0
          real(8) :: tmp
          t_0 = 1.0d0 + (a * (1.0d0 + (0.5d0 * a)))
          if (a <= (-7d+103)) then
              tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (a * (0.5d0 + (0.16666666666666666d0 * a))))))
          else
              tmp = t_0 / (t_0 + exp(b))
          end if
          code = tmp
      end function
      
      public static double code(double a, double b) {
      	double t_0 = 1.0 + (a * (1.0 + (0.5 * a)));
      	double tmp;
      	if (a <= -7e+103) {
      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
      	} else {
      		tmp = t_0 / (t_0 + Math.exp(b));
      	}
      	return tmp;
      }
      
      def code(a, b):
      	t_0 = 1.0 + (a * (1.0 + (0.5 * a)))
      	tmp = 0
      	if a <= -7e+103:
      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))))
      	else:
      		tmp = t_0 / (t_0 + math.exp(b))
      	return tmp
      
      function code(a, b)
      	t_0 = Float64(1.0 + Float64(a * Float64(1.0 + Float64(0.5 * a))))
      	tmp = 0.0
      	if (a <= -7e+103)
      		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(a * Float64(0.5 + Float64(0.16666666666666666 * a)))))));
      	else
      		tmp = Float64(t_0 / Float64(t_0 + exp(b)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b)
      	t_0 = 1.0 + (a * (1.0 + (0.5 * a)));
      	tmp = 0.0;
      	if (a <= -7e+103)
      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
      	else
      		tmp = t_0 / (t_0 + exp(b));
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_] := Block[{t$95$0 = N[(1 + N[(a * N[(1 + N[(1/2 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296], N[(1 / N[(2 + N[(a * N[(1 + N[(a * N[(1/2 + N[(1/6 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(t$95$0 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      t_0 := 1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\\
      \mathbf{if}\;a \leq -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296:\\
      \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{t\_0}{t\_0 + e^{b}}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < -7e103

        1. Initial program 99.2%

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

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

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

            \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
          3. Step-by-step derivation
            1. Applied rewrites81.5%

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

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

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

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

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

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

                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
              6. lower-*.f6489.6%

                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
            4. Applied rewrites89.6%

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

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

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

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

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

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

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

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

                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6} \cdot a}\right)\right)\right)} \]
              8. lower-*.f6486.9%

                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)\right)} \]
            7. Applied rewrites86.9%

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

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

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

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

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

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

                \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)} \]
              6. lower-*.f6456.3%

                \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)} \]
            10. Applied rewrites56.3%

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

            if -7e103 < a

            1. Initial program 99.2%

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

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

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

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

                \[\leadsto \frac{1 + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)}{e^{a} + e^{b}} \]
              4. lower-*.f6477.0%

                \[\leadsto \frac{1 + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)}{e^{a} + e^{b}} \]
            4. Applied rewrites77.0%

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

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

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

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

                \[\leadsto \frac{1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}{\left(1 + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right) + e^{b}} \]
              4. lower-*.f6477.7%

                \[\leadsto \frac{1 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}{\left(1 + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right) + e^{b}} \]
            7. Applied rewrites77.7%

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

          Alternative 5: 93.6% accurate, 2.5× speedup?

          \[\begin{array}{l} \mathbf{if}\;a \leq -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + a}{\left(1 + a\right) + e^{b}}\\ \end{array} \]
          (FPCore (a b)
            :precision binary64
            (if (<=
               a
               -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296)
            (/ 1 (+ 2 (* a (+ 1 (* a (+ 1/2 (* 1/6 a)))))))
            (/ (+ 1 a) (+ (+ 1 a) (exp b)))))
          double code(double a, double b) {
          	double tmp;
          	if (a <= -7e+103) {
          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
          	} else {
          		tmp = (1.0 + a) / ((1.0 + a) + exp(b));
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(a, b)
          use fmin_fmax_functions
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8) :: tmp
              if (a <= (-7d+103)) then
                  tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (a * (0.5d0 + (0.16666666666666666d0 * a))))))
              else
                  tmp = (1.0d0 + a) / ((1.0d0 + a) + exp(b))
              end if
              code = tmp
          end function
          
          public static double code(double a, double b) {
          	double tmp;
          	if (a <= -7e+103) {
          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
          	} else {
          		tmp = (1.0 + a) / ((1.0 + a) + Math.exp(b));
          	}
          	return tmp;
          }
          
          def code(a, b):
          	tmp = 0
          	if a <= -7e+103:
          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))))
          	else:
          		tmp = (1.0 + a) / ((1.0 + a) + math.exp(b))
          	return tmp
          
          function code(a, b)
          	tmp = 0.0
          	if (a <= -7e+103)
          		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(a * Float64(0.5 + Float64(0.16666666666666666 * a)))))));
          	else
          		tmp = Float64(Float64(1.0 + a) / Float64(Float64(1.0 + a) + exp(b)));
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b)
          	tmp = 0.0;
          	if (a <= -7e+103)
          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
          	else
          		tmp = (1.0 + a) / ((1.0 + a) + exp(b));
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_] := If[LessEqual[a, -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296], N[(1 / N[(2 + N[(a * N[(1 + N[(a * N[(1/2 + N[(1/6 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1 + a), $MachinePrecision] / N[(N[(1 + a), $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          \mathbf{if}\;a \leq -70000000000000000134097256001426811535116858908563440780696246021956552694279212917286530157572622647296:\\
          \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1 + a}{\left(1 + a\right) + e^{b}}\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if a < -7e103

            1. Initial program 99.2%

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

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

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

                \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
              3. Step-by-step derivation
                1. Applied rewrites81.5%

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

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

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

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

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

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

                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                  6. lower-*.f6489.6%

                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                4. Applied rewrites89.6%

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6} \cdot a}\right)\right)\right)} \]
                  8. lower-*.f6486.9%

                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)\right)} \]
                7. Applied rewrites86.9%

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

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

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

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

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

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

                    \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)} \]
                  6. lower-*.f6456.3%

                    \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)} \]
                10. Applied rewrites56.3%

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

                if -7e103 < a

                1. Initial program 99.2%

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

                  \[\leadsto \frac{\color{blue}{1 + a}}{e^{a} + e^{b}} \]
                3. Step-by-step derivation
                  1. lower-+.f6481.1%

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

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

                  \[\leadsto \frac{1 + a}{\color{blue}{\left(1 + a\right)} + e^{b}} \]
                6. Step-by-step derivation
                  1. lower-+.f6482.0%

                    \[\leadsto \frac{1 + a}{\left(1 + \color{blue}{a}\right) + e^{b}} \]
                7. Applied rewrites82.0%

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

              Alternative 6: 93.2% accurate, 2.6× speedup?

              \[\begin{array}{l} \mathbf{if}\;a \leq -94999999999999992224817350588207255454399766741059799452217921129377556751955301525765481584743122206720:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \]
              (FPCore (a b)
                :precision binary64
                (if (<=
                   a
                   -94999999999999992224817350588207255454399766741059799452217921129377556751955301525765481584743122206720)
                (/ 1 (+ 2 (* a (+ 1 (* a (+ 1/2 (* 1/6 a)))))))
                (/ 1 (+ 1 (exp b)))))
              double code(double a, double b) {
              	double tmp;
              	if (a <= -9.5e+103) {
              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
              	} else {
              		tmp = 1.0 / (1.0 + exp(b));
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(a, b)
              use fmin_fmax_functions
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  real(8) :: tmp
                  if (a <= (-9.5d+103)) then
                      tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (a * (0.5d0 + (0.16666666666666666d0 * 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 (a <= -9.5e+103) {
              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
              	} else {
              		tmp = 1.0 / (1.0 + Math.exp(b));
              	}
              	return tmp;
              }
              
              def code(a, b):
              	tmp = 0
              	if a <= -9.5e+103:
              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))))
              	else:
              		tmp = 1.0 / (1.0 + math.exp(b))
              	return tmp
              
              function code(a, b)
              	tmp = 0.0
              	if (a <= -9.5e+103)
              		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(a * Float64(0.5 + Float64(0.16666666666666666 * 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 (a <= -9.5e+103)
              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
              	else
              		tmp = 1.0 / (1.0 + exp(b));
              	end
              	tmp_2 = tmp;
              end
              
              code[a_, b_] := If[LessEqual[a, -94999999999999992224817350588207255454399766741059799452217921129377556751955301525765481584743122206720], N[(1 / N[(2 + N[(a * N[(1 + N[(a * N[(1/2 + N[(1/6 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 / N[(1 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              \mathbf{if}\;a \leq -94999999999999992224817350588207255454399766741059799452217921129377556751955301525765481584743122206720:\\
              \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{1}{1 + e^{b}}\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if a < -9.4999999999999992e103

                1. Initial program 99.2%

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

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

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

                    \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                  3. Step-by-step derivation
                    1. Applied rewrites81.5%

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

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

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

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

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

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

                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                      6. lower-*.f6489.6%

                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                    4. Applied rewrites89.6%

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6} \cdot a}\right)\right)\right)} \]
                      8. lower-*.f6486.9%

                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)\right)} \]
                    7. Applied rewrites86.9%

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

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

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

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

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

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

                        \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)} \]
                      6. lower-*.f6456.3%

                        \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)} \]
                    10. Applied rewrites56.3%

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

                    if -9.4999999999999992e103 < a

                    1. Initial program 99.2%

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

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

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

                        \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites81.5%

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

                      Alternative 7: 87.3% accurate, 3.5× speedup?

                      \[\begin{array}{l} t_0 := \left(\frac{1}{2} \cdot b\right) \cdot b\\ \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}}\\ \mathbf{elif}\;b \leq 9599999999999999937557116997815619882469347802379932726602603143008612253696:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\ \mathbf{elif}\;b \leq 13500000000000000275507010685175621526490118987092636456657125042259125821644957267949903389666459196246900088209596760608108317076954234449082739494748160:\\ \;\;\;\;\frac{1}{2 + \frac{b \cdot b - t\_0 \cdot t\_0}{b - t\_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\ \end{array} \]
                      (FPCore (a b)
                        :precision binary64
                        (let* ((t_0 (* (* 1/2 b) b)))
                        (if (<= b -4436777100798803/158456325028528675187087900672)
                          (/ 1 (+ 1 (/ 1 (+ 1 (* b (- (* b (+ 1/2 (* -1/6 b))) 1))))))
                          (if (<=
                               b
                               9599999999999999937557116997815619882469347802379932726602603143008612253696)
                            (/ 1 (+ 2 (* a (+ 1 (* a (+ 1/2 (* 1/6 a)))))))
                            (if (<=
                                 b
                                 13500000000000000275507010685175621526490118987092636456657125042259125821644957267949903389666459196246900088209596760608108317076954234449082739494748160)
                              (/ 1 (+ 2 (/ (- (* b b) (* t_0 t_0)) (- b t_0))))
                              (/ 1 (+ 2 (* b (+ 1 (* 1/2 b))))))))))
                      double code(double a, double b) {
                      	double t_0 = (0.5 * b) * b;
                      	double tmp;
                      	if (b <= -2.8e-14) {
                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))));
                      	} else if (b <= 9.6e+75) {
                      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                      	} else if (b <= 1.35e+154) {
                      		tmp = 1.0 / (2.0 + (((b * b) - (t_0 * t_0)) / (b - t_0)));
                      	} else {
                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                      	}
                      	return tmp;
                      }
                      
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(a, b)
                      use fmin_fmax_functions
                          real(8), intent (in) :: a
                          real(8), intent (in) :: b
                          real(8) :: t_0
                          real(8) :: tmp
                          t_0 = (0.5d0 * b) * b
                          if (b <= (-2.8d-14)) then
                              tmp = 1.0d0 / (1.0d0 + (1.0d0 / (1.0d0 + (b * ((b * (0.5d0 + ((-0.16666666666666666d0) * b))) - 1.0d0)))))
                          else if (b <= 9.6d+75) then
                              tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (a * (0.5d0 + (0.16666666666666666d0 * a))))))
                          else if (b <= 1.35d+154) then
                              tmp = 1.0d0 / (2.0d0 + (((b * b) - (t_0 * t_0)) / (b - t_0)))
                          else
                              tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (0.5d0 * b))))
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double a, double b) {
                      	double t_0 = (0.5 * b) * b;
                      	double tmp;
                      	if (b <= -2.8e-14) {
                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))));
                      	} else if (b <= 9.6e+75) {
                      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                      	} else if (b <= 1.35e+154) {
                      		tmp = 1.0 / (2.0 + (((b * b) - (t_0 * t_0)) / (b - t_0)));
                      	} else {
                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                      	}
                      	return tmp;
                      }
                      
                      def code(a, b):
                      	t_0 = (0.5 * b) * b
                      	tmp = 0
                      	if b <= -2.8e-14:
                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))))
                      	elif b <= 9.6e+75:
                      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))))
                      	elif b <= 1.35e+154:
                      		tmp = 1.0 / (2.0 + (((b * b) - (t_0 * t_0)) / (b - t_0)))
                      	else:
                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))))
                      	return tmp
                      
                      function code(a, b)
                      	t_0 = Float64(Float64(0.5 * b) * b)
                      	tmp = 0.0
                      	if (b <= -2.8e-14)
                      		tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / Float64(1.0 + Float64(b * Float64(Float64(b * Float64(0.5 + Float64(-0.16666666666666666 * b))) - 1.0))))));
                      	elseif (b <= 9.6e+75)
                      		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(a * Float64(0.5 + Float64(0.16666666666666666 * a)))))));
                      	elseif (b <= 1.35e+154)
                      		tmp = Float64(1.0 / Float64(2.0 + Float64(Float64(Float64(b * b) - Float64(t_0 * t_0)) / Float64(b - t_0))));
                      	else
                      		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(0.5 * b)))));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(a, b)
                      	t_0 = (0.5 * b) * b;
                      	tmp = 0.0;
                      	if (b <= -2.8e-14)
                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))));
                      	elseif (b <= 9.6e+75)
                      		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                      	elseif (b <= 1.35e+154)
                      		tmp = 1.0 / (2.0 + (((b * b) - (t_0 * t_0)) / (b - t_0)));
                      	else
                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[a_, b_] := Block[{t$95$0 = N[(N[(1/2 * b), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -4436777100798803/158456325028528675187087900672], N[(1 / N[(1 + N[(1 / N[(1 + N[(b * N[(N[(b * N[(1/2 + N[(-1/6 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9599999999999999937557116997815619882469347802379932726602603143008612253696], N[(1 / N[(2 + N[(a * N[(1 + N[(a * N[(1/2 + N[(1/6 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 13500000000000000275507010685175621526490118987092636456657125042259125821644957267949903389666459196246900088209596760608108317076954234449082739494748160], N[(1 / N[(2 + N[(N[(N[(b * b), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(b - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(1/2 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                      
                      \begin{array}{l}
                      t_0 := \left(\frac{1}{2} \cdot b\right) \cdot b\\
                      \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\
                      \;\;\;\;\frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}}\\
                      
                      \mathbf{elif}\;b \leq 9599999999999999937557116997815619882469347802379932726602603143008612253696:\\
                      \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\
                      
                      \mathbf{elif}\;b \leq 13500000000000000275507010685175621526490118987092636456657125042259125821644957267949903389666459196246900088209596760608108317076954234449082739494748160:\\
                      \;\;\;\;\frac{1}{2 + \frac{b \cdot b - t\_0 \cdot t\_0}{b - t\_0}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\
                      
                      
                      \end{array}
                      
                      Derivation
                      1. Split input into 4 regimes
                      2. if b < -2.8000000000000001e-14

                        1. Initial program 99.2%

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

                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                          2. sinh-+-cosh-revN/A

                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                          3. add-flipN/A

                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                          4. cosh-neg-revN/A

                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                          5. sinh-neg-revN/A

                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                          6. sinh---cosh-revN/A

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                        5. Step-by-step derivation
                          1. lower-/.f64N/A

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

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

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

                            \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                          5. lower-neg.f6481.5%

                            \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                        6. Applied rewrites81.5%

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

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

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

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

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

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

                            \[\leadsto \frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}} \]
                          6. lower-*.f6454.9%

                            \[\leadsto \frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}} \]
                        9. Applied rewrites54.9%

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

                        if -2.8000000000000001e-14 < b < 9.5999999999999999e75

                        1. Initial program 99.2%

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

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

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

                            \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                          3. Step-by-step derivation
                            1. Applied rewrites81.5%

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

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

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

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

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

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

                                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                              6. lower-*.f6489.6%

                                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                            4. Applied rewrites89.6%

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6} \cdot a}\right)\right)\right)} \]
                              8. lower-*.f6486.9%

                                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)\right)} \]
                            7. Applied rewrites86.9%

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

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

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

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

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

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

                                \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)} \]
                              6. lower-*.f6456.3%

                                \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)} \]
                            10. Applied rewrites56.3%

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

                            if 9.5999999999999999e75 < b < 1.35e154

                            1. Initial program 99.2%

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

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                              2. sinh-+-cosh-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                              3. add-flipN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                              4. cosh-neg-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                              5. sinh-neg-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                              6. sinh---cosh-revN/A

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                            5. Step-by-step derivation
                              1. lower-/.f64N/A

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

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

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

                                \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                              5. lower-neg.f6481.5%

                                \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                            6. Applied rewrites81.5%

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

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

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

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

                                \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                              4. lower-*.f6450.2%

                                \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                            9. Applied rewrites50.2%

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

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{1}{2 + \frac{b \cdot \left(1 \cdot b\right) - \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right)}{b \cdot 1 - b \cdot \left(\frac{1}{2} \cdot b\right)}} \]
                              10. *-lft-identityN/A

                                \[\leadsto \frac{1}{2 + \frac{b \cdot b - \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right)}{b \cdot 1 - b \cdot \left(\frac{1}{2} \cdot b\right)}} \]
                              11. lower-unsound-*.f64N/A

                                \[\leadsto \frac{1}{2 + \frac{b \cdot b - \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right)}{b \cdot 1 - b \cdot \left(\frac{1}{2} \cdot b\right)}} \]
                              12. lower-unsound-*.f64N/A

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

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

                                \[\leadsto \frac{1}{2 + \frac{b \cdot b - \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right)}{b \cdot 1 - b \cdot \left(\frac{1}{2} \cdot b\right)}} \]
                              15. *-rgt-identityN/A

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

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

                                \[\leadsto \frac{1}{2 + \frac{b \cdot b - \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right)}{b - \left(\frac{1}{2} \cdot b\right) \cdot \color{blue}{b}}} \]
                              18. lower-*.f6443.1%

                                \[\leadsto \frac{1}{2 + \frac{b \cdot b - \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right) \cdot \left(\left(\frac{1}{2} \cdot b\right) \cdot b\right)}{b - \left(\frac{1}{2} \cdot b\right) \cdot b}} \]
                            11. Applied rewrites43.1%

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

                            if 1.35e154 < b

                            1. Initial program 99.2%

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

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                              2. sinh-+-cosh-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                              3. add-flipN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                              4. cosh-neg-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                              5. sinh-neg-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                              6. sinh---cosh-revN/A

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                            5. Step-by-step derivation
                              1. lower-/.f64N/A

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

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

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

                                \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                              5. lower-neg.f6481.5%

                                \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                            6. Applied rewrites81.5%

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

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

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

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

                                \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                              4. lower-*.f6450.2%

                                \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                            9. Applied rewrites50.2%

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

                          Alternative 8: 85.6% accurate, 5.6× speedup?

                          \[\begin{array}{l} \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}}\\ \mathbf{elif}\;b \leq 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}\\ \end{array} \]
                          (FPCore (a b)
                            :precision binary64
                            (if (<= b -4436777100798803/158456325028528675187087900672)
                            (/ 1 (+ 1 (/ 1 (+ 1 (* b (- (* b (+ 1/2 (* -1/6 b))) 1))))))
                            (if (<=
                                 b
                                 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216)
                              (/ 1 (+ 2 (* a (+ 1 (* a (+ 1/2 (* 1/6 a)))))))
                              (/ 1 (+ 2 (* b (+ 1 (* b (+ 1/2 (* 1/6 b))))))))))
                          double code(double a, double b) {
                          	double tmp;
                          	if (b <= -2.8e-14) {
                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))));
                          	} else if (b <= 2.9e+99) {
                          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                          	} else {
                          		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                          	}
                          	return tmp;
                          }
                          
                          module fmin_fmax_functions
                              implicit none
                              private
                              public fmax
                              public fmin
                          
                              interface fmax
                                  module procedure fmax88
                                  module procedure fmax44
                                  module procedure fmax84
                                  module procedure fmax48
                              end interface
                              interface fmin
                                  module procedure fmin88
                                  module procedure fmin44
                                  module procedure fmin84
                                  module procedure fmin48
                              end interface
                          contains
                              real(8) function fmax88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmax44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmax84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmax48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                              end function
                              real(8) function fmin88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmin44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmin84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmin48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                              end function
                          end module
                          
                          real(8) function code(a, b)
                          use fmin_fmax_functions
                              real(8), intent (in) :: a
                              real(8), intent (in) :: b
                              real(8) :: tmp
                              if (b <= (-2.8d-14)) then
                                  tmp = 1.0d0 / (1.0d0 + (1.0d0 / (1.0d0 + (b * ((b * (0.5d0 + ((-0.16666666666666666d0) * b))) - 1.0d0)))))
                              else if (b <= 2.9d+99) then
                                  tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (a * (0.5d0 + (0.16666666666666666d0 * a))))))
                              else
                                  tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (b * (0.5d0 + (0.16666666666666666d0 * b))))))
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double a, double b) {
                          	double tmp;
                          	if (b <= -2.8e-14) {
                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))));
                          	} else if (b <= 2.9e+99) {
                          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                          	} else {
                          		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                          	}
                          	return tmp;
                          }
                          
                          def code(a, b):
                          	tmp = 0
                          	if b <= -2.8e-14:
                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))))
                          	elif b <= 2.9e+99:
                          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))))
                          	else:
                          		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))))
                          	return tmp
                          
                          function code(a, b)
                          	tmp = 0.0
                          	if (b <= -2.8e-14)
                          		tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / Float64(1.0 + Float64(b * Float64(Float64(b * Float64(0.5 + Float64(-0.16666666666666666 * b))) - 1.0))))));
                          	elseif (b <= 2.9e+99)
                          		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(a * Float64(0.5 + Float64(0.16666666666666666 * a)))))));
                          	else
                          		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(b * Float64(0.5 + Float64(0.16666666666666666 * b)))))));
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(a, b)
                          	tmp = 0.0;
                          	if (b <= -2.8e-14)
                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (b * ((b * (0.5 + (-0.16666666666666666 * b))) - 1.0)))));
                          	elseif (b <= 2.9e+99)
                          		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                          	else
                          		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[a_, b_] := If[LessEqual[b, -4436777100798803/158456325028528675187087900672], N[(1 / N[(1 + N[(1 / N[(1 + N[(b * N[(N[(b * N[(1/2 + N[(-1/6 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216], N[(1 / N[(2 + N[(a * N[(1 + N[(a * N[(1/2 + N[(1/6 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(b * N[(1/2 + N[(1/6 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\
                          \;\;\;\;\frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}}\\
                          
                          \mathbf{elif}\;b \leq 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216:\\
                          \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}\\
                          
                          
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if b < -2.8000000000000001e-14

                            1. Initial program 99.2%

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

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                              2. sinh-+-cosh-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                              3. add-flipN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                              4. cosh-neg-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                              5. sinh-neg-revN/A

                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                              6. sinh---cosh-revN/A

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                            5. Step-by-step derivation
                              1. lower-/.f64N/A

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

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

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

                                \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                              5. lower-neg.f6481.5%

                                \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                            6. Applied rewrites81.5%

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

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

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

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

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

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

                                \[\leadsto \frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}} \]
                              6. lower-*.f6454.9%

                                \[\leadsto \frac{1}{1 + \frac{1}{1 + b \cdot \left(b \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot b\right) - 1\right)}} \]
                            9. Applied rewrites54.9%

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

                            if -2.8000000000000001e-14 < b < 2.9000000000000002e99

                            1. Initial program 99.2%

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

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

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

                                \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                              3. Step-by-step derivation
                                1. Applied rewrites81.5%

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                                  6. lower-*.f6489.6%

                                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                                4. Applied rewrites89.6%

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6} \cdot a}\right)\right)\right)} \]
                                  8. lower-*.f6486.9%

                                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)\right)} \]
                                7. Applied rewrites86.9%

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)} \]
                                  6. lower-*.f6456.3%

                                    \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)} \]
                                10. Applied rewrites56.3%

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

                                if 2.9000000000000002e99 < b

                                1. Initial program 99.2%

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

                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                  2. sinh-+-cosh-revN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                  3. add-flipN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                  4. cosh-neg-revN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                  5. sinh-neg-revN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                  6. sinh---cosh-revN/A

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                5. Step-by-step derivation
                                  1. lower-/.f64N/A

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

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

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

                                    \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                  5. lower-neg.f6481.5%

                                    \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                6. Applied rewrites81.5%

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

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

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

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

                                    \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                  4. lower-*.f6450.2%

                                    \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                9. Applied rewrites50.2%

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{b}\right)\right)} \]
                                  6. lower-*.f6454.6%

                                    \[\leadsto \frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)} \]
                                12. Applied rewrites54.6%

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

                              Alternative 9: 85.2% accurate, 6.6× speedup?

                              \[\begin{array}{l} \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\ \mathbf{elif}\;b \leq 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}\\ \end{array} \]
                              (FPCore (a b)
                                :precision binary64
                                (if (<= b -4436777100798803/158456325028528675187087900672)
                                (/ 1 (+ 1 (/ 1 (+ 1 (* -1 b)))))
                                (if (<=
                                     b
                                     2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216)
                                  (/ 1 (+ 2 (* a (+ 1 (* a (+ 1/2 (* 1/6 a)))))))
                                  (/ 1 (+ 2 (* b (+ 1 (* b (+ 1/2 (* 1/6 b))))))))))
                              double code(double a, double b) {
                              	double tmp;
                              	if (b <= -2.8e-14) {
                              		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                              	} else if (b <= 2.9e+99) {
                              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                              	} else {
                              		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                              	}
                              	return tmp;
                              }
                              
                              module fmin_fmax_functions
                                  implicit none
                                  private
                                  public fmax
                                  public fmin
                              
                                  interface fmax
                                      module procedure fmax88
                                      module procedure fmax44
                                      module procedure fmax84
                                      module procedure fmax48
                                  end interface
                                  interface fmin
                                      module procedure fmin88
                                      module procedure fmin44
                                      module procedure fmin84
                                      module procedure fmin48
                                  end interface
                              contains
                                  real(8) function fmax88(x, y) result (res)
                                      real(8), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                  end function
                                  real(4) function fmax44(x, y) result (res)
                                      real(4), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                  end function
                                  real(8) function fmax84(x, y) result(res)
                                      real(8), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                  end function
                                  real(8) function fmax48(x, y) result(res)
                                      real(4), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                  end function
                                  real(8) function fmin88(x, y) result (res)
                                      real(8), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                  end function
                                  real(4) function fmin44(x, y) result (res)
                                      real(4), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                  end function
                                  real(8) function fmin84(x, y) result(res)
                                      real(8), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                  end function
                                  real(8) function fmin48(x, y) result(res)
                                      real(4), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                  end function
                              end module
                              
                              real(8) function code(a, b)
                              use fmin_fmax_functions
                                  real(8), intent (in) :: a
                                  real(8), intent (in) :: b
                                  real(8) :: tmp
                                  if (b <= (-2.8d-14)) then
                                      tmp = 1.0d0 / (1.0d0 + (1.0d0 / (1.0d0 + ((-1.0d0) * b))))
                                  else if (b <= 2.9d+99) then
                                      tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (a * (0.5d0 + (0.16666666666666666d0 * a))))))
                                  else
                                      tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (b * (0.5d0 + (0.16666666666666666d0 * b))))))
                                  end if
                                  code = tmp
                              end function
                              
                              public static double code(double a, double b) {
                              	double tmp;
                              	if (b <= -2.8e-14) {
                              		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                              	} else if (b <= 2.9e+99) {
                              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                              	} else {
                              		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                              	}
                              	return tmp;
                              }
                              
                              def code(a, b):
                              	tmp = 0
                              	if b <= -2.8e-14:
                              		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))))
                              	elif b <= 2.9e+99:
                              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))))
                              	else:
                              		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))))
                              	return tmp
                              
                              function code(a, b)
                              	tmp = 0.0
                              	if (b <= -2.8e-14)
                              		tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / Float64(1.0 + Float64(-1.0 * b)))));
                              	elseif (b <= 2.9e+99)
                              		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(a * Float64(0.5 + Float64(0.16666666666666666 * a)))))));
                              	else
                              		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(b * Float64(0.5 + Float64(0.16666666666666666 * b)))))));
                              	end
                              	return tmp
                              end
                              
                              function tmp_2 = code(a, b)
                              	tmp = 0.0;
                              	if (b <= -2.8e-14)
                              		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                              	elseif (b <= 2.9e+99)
                              		tmp = 1.0 / (2.0 + (a * (1.0 + (a * (0.5 + (0.16666666666666666 * a))))));
                              	else
                              		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              code[a_, b_] := If[LessEqual[b, -4436777100798803/158456325028528675187087900672], N[(1 / N[(1 + N[(1 / N[(1 + N[(-1 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216], N[(1 / N[(2 + N[(a * N[(1 + N[(a * N[(1/2 + N[(1/6 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(b * N[(1/2 + N[(1/6 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\
                              \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\
                              
                              \mathbf{elif}\;b \leq 2900000000000000220958584518619378718576206097660833200853200506439430156592527384137291964367241216:\\
                              \;\;\;\;\frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}\\
                              
                              
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if b < -2.8000000000000001e-14

                                1. Initial program 99.2%

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

                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                  2. sinh-+-cosh-revN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                  3. add-flipN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                  4. cosh-neg-revN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                  5. sinh-neg-revN/A

                                    \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                  6. sinh---cosh-revN/A

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                5. Step-by-step derivation
                                  1. lower-/.f64N/A

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

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

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

                                    \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                  5. lower-neg.f6481.5%

                                    \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                6. Applied rewrites81.5%

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

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

                                    \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot \color{blue}{b}}} \]
                                  2. lower-*.f6454.5%

                                    \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot b}} \]
                                9. Applied rewrites54.5%

                                  \[\leadsto \frac{1}{1 + \frac{1}{1 + \color{blue}{-1 \cdot b}}} \]

                                if -2.8000000000000001e-14 < b < 2.9000000000000002e99

                                1. Initial program 99.2%

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

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

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

                                    \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites81.5%

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

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

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

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

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

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

                                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                                      6. lower-*.f6489.6%

                                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                                    4. Applied rewrites89.6%

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

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

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

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

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

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

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

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

                                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \color{blue}{\frac{1}{6} \cdot a}\right)\right)\right)} \]
                                      8. lower-*.f6486.9%

                                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)\right)} \]
                                    7. Applied rewrites86.9%

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

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

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

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

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

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

                                        \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{a}\right)\right)} \]
                                      6. lower-*.f6456.3%

                                        \[\leadsto \frac{1}{2 + a \cdot \left(1 + a \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot a\right)\right)} \]
                                    10. Applied rewrites56.3%

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

                                    if 2.9000000000000002e99 < b

                                    1. Initial program 99.2%

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

                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                      2. sinh-+-cosh-revN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                      3. add-flipN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                      4. cosh-neg-revN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                      5. sinh-neg-revN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                      6. sinh---cosh-revN/A

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

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

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

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

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

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

                                      \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                    5. Step-by-step derivation
                                      1. lower-/.f64N/A

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

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

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

                                        \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                      5. lower-neg.f6481.5%

                                        \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                    6. Applied rewrites81.5%

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

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

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

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

                                        \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                      4. lower-*.f6450.2%

                                        \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                    9. Applied rewrites50.2%

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

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

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

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

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

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

                                        \[\leadsto \frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{b}\right)\right)} \]
                                      6. lower-*.f6454.6%

                                        \[\leadsto \frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)} \]
                                    12. Applied rewrites54.6%

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

                                  Alternative 10: 82.0% accurate, 6.6× speedup?

                                  \[\begin{array}{l} \mathbf{if}\;b \leq \frac{-3422735716801577}{4503599627370496}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\ \mathbf{elif}\;b \leq 319999999999999989553922400211056615127884915412799357224512787796256103101104128:\\ \;\;\;\;\frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}\\ \end{array} \]
                                  (FPCore (a b)
                                    :precision binary64
                                    (if (<= b -3422735716801577/4503599627370496)
                                    (/ 1 (+ 1 (/ 1 (+ 1 (* -1 b)))))
                                    (if (<=
                                         b
                                         319999999999999989553922400211056615127884915412799357224512787796256103101104128)
                                      (/ 1 (- (+ (+ (+ 1 b) a) (* (* a a) 1/2)) -1))
                                      (/ 1 (+ 2 (* b (+ 1 (* b (+ 1/2 (* 1/6 b))))))))))
                                  double code(double a, double b) {
                                  	double tmp;
                                  	if (b <= -0.76) {
                                  		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                  	} else if (b <= 3.2e+80) {
                                  		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0);
                                  	} else {
                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  module fmin_fmax_functions
                                      implicit none
                                      private
                                      public fmax
                                      public fmin
                                  
                                      interface fmax
                                          module procedure fmax88
                                          module procedure fmax44
                                          module procedure fmax84
                                          module procedure fmax48
                                      end interface
                                      interface fmin
                                          module procedure fmin88
                                          module procedure fmin44
                                          module procedure fmin84
                                          module procedure fmin48
                                      end interface
                                  contains
                                      real(8) function fmax88(x, y) result (res)
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                      end function
                                      real(4) function fmax44(x, y) result (res)
                                          real(4), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                      end function
                                      real(8) function fmax84(x, y) result(res)
                                          real(8), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                      end function
                                      real(8) function fmax48(x, y) result(res)
                                          real(4), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                      end function
                                      real(8) function fmin88(x, y) result (res)
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                      end function
                                      real(4) function fmin44(x, y) result (res)
                                          real(4), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                      end function
                                      real(8) function fmin84(x, y) result(res)
                                          real(8), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                      end function
                                      real(8) function fmin48(x, y) result(res)
                                          real(4), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                      end function
                                  end module
                                  
                                  real(8) function code(a, b)
                                  use fmin_fmax_functions
                                      real(8), intent (in) :: a
                                      real(8), intent (in) :: b
                                      real(8) :: tmp
                                      if (b <= (-0.76d0)) then
                                          tmp = 1.0d0 / (1.0d0 + (1.0d0 / (1.0d0 + ((-1.0d0) * b))))
                                      else if (b <= 3.2d+80) then
                                          tmp = 1.0d0 / ((((1.0d0 + b) + a) + ((a * a) * 0.5d0)) - (-1.0d0))
                                      else
                                          tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (b * (0.5d0 + (0.16666666666666666d0 * b))))))
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double a, double b) {
                                  	double tmp;
                                  	if (b <= -0.76) {
                                  		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                  	} else if (b <= 3.2e+80) {
                                  		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0);
                                  	} else {
                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(a, b):
                                  	tmp = 0
                                  	if b <= -0.76:
                                  		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))))
                                  	elif b <= 3.2e+80:
                                  		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0)
                                  	else:
                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))))
                                  	return tmp
                                  
                                  function code(a, b)
                                  	tmp = 0.0
                                  	if (b <= -0.76)
                                  		tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / Float64(1.0 + Float64(-1.0 * b)))));
                                  	elseif (b <= 3.2e+80)
                                  		tmp = Float64(1.0 / Float64(Float64(Float64(Float64(1.0 + b) + a) + Float64(Float64(a * a) * 0.5)) - -1.0));
                                  	else
                                  		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(b * Float64(0.5 + Float64(0.16666666666666666 * b)))))));
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(a, b)
                                  	tmp = 0.0;
                                  	if (b <= -0.76)
                                  		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                  	elseif (b <= 3.2e+80)
                                  		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0);
                                  	else
                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (b * (0.5 + (0.16666666666666666 * b))))));
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[a_, b_] := If[LessEqual[b, -3422735716801577/4503599627370496], N[(1 / N[(1 + N[(1 / N[(1 + N[(-1 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 319999999999999989553922400211056615127884915412799357224512787796256103101104128], N[(1 / N[(N[(N[(N[(1 + b), $MachinePrecision] + a), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(b * N[(1/2 + N[(1/6 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                  
                                  \begin{array}{l}
                                  \mathbf{if}\;b \leq \frac{-3422735716801577}{4503599627370496}:\\
                                  \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\
                                  
                                  \mathbf{elif}\;b \leq 319999999999999989553922400211056615127884915412799357224512787796256103101104128:\\
                                  \;\;\;\;\frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)}\\
                                  
                                  
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if b < -0.76000000000000001

                                    1. Initial program 99.2%

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

                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                      2. sinh-+-cosh-revN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                      3. add-flipN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                      4. cosh-neg-revN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                      5. sinh-neg-revN/A

                                        \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                      6. sinh---cosh-revN/A

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

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

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

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

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

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

                                      \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                    5. Step-by-step derivation
                                      1. lower-/.f64N/A

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

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

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

                                        \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                      5. lower-neg.f6481.5%

                                        \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                    6. Applied rewrites81.5%

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

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

                                        \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot \color{blue}{b}}} \]
                                      2. lower-*.f6454.5%

                                        \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot b}} \]
                                    9. Applied rewrites54.5%

                                      \[\leadsto \frac{1}{1 + \frac{1}{1 + \color{blue}{-1 \cdot b}}} \]

                                    if -0.76000000000000001 < b < 3.1999999999999999e80

                                    1. Initial program 99.2%

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

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

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

                                        \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites81.5%

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

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

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

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

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

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

                                            \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                                          6. lower-*.f6489.6%

                                            \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                                        4. Applied rewrites89.6%

                                          \[\leadsto \frac{1}{\color{blue}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\right)}} \]
                                        5. Step-by-step derivation
                                          1. lift-+.f64N/A

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

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

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

                                            \[\leadsto \frac{1}{\left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\right) - -1} \]
                                          5. lower--.f6489.6%

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

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

                                          \[\leadsto \frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1} \]
                                        8. Step-by-step derivation
                                          1. lower-+.f6449.8%

                                            \[\leadsto \frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1} \]
                                        9. Applied rewrites49.8%

                                          \[\leadsto \frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1} \]

                                        if 3.1999999999999999e80 < b

                                        1. Initial program 99.2%

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

                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                          2. sinh-+-cosh-revN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                          3. add-flipN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                          4. cosh-neg-revN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                          5. sinh-neg-revN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                          6. sinh---cosh-revN/A

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

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

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

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

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

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

                                          \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                        5. Step-by-step derivation
                                          1. lower-/.f64N/A

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

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

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

                                            \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                          5. lower-neg.f6481.5%

                                            \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                        6. Applied rewrites81.5%

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

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

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

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

                                            \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                          4. lower-*.f6450.2%

                                            \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                        9. Applied rewrites50.2%

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

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

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

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

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

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

                                            \[\leadsto \frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \color{blue}{b}\right)\right)} \]
                                          6. lower-*.f6454.6%

                                            \[\leadsto \frac{1}{2 + b \cdot \left(1 + b \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot b\right)\right)} \]
                                        12. Applied rewrites54.6%

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

                                      Alternative 11: 78.3% accurate, 6.8× speedup?

                                      \[\begin{array}{l} \mathbf{if}\;b \leq \frac{-3422735716801577}{4503599627370496}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\ \mathbf{elif}\;b \leq 18999999999999999064581089979963101249120767266604493066770021892695906750618596520567186646577434152905173284039181572611431631767743819258237216708624384:\\ \;\;\;\;\frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\ \end{array} \]
                                      (FPCore (a b)
                                        :precision binary64
                                        (if (<= b -3422735716801577/4503599627370496)
                                        (/ 1 (+ 1 (/ 1 (+ 1 (* -1 b)))))
                                        (if (<=
                                             b
                                             18999999999999999064581089979963101249120767266604493066770021892695906750618596520567186646577434152905173284039181572611431631767743819258237216708624384)
                                          (/ 1 (- (+ (+ (+ 1 b) a) (* (* a a) 1/2)) -1))
                                          (/ 1 (+ 2 (* b (+ 1 (* 1/2 b))))))))
                                      double code(double a, double b) {
                                      	double tmp;
                                      	if (b <= -0.76) {
                                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                      	} else if (b <= 1.9e+154) {
                                      		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0);
                                      	} else {
                                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      module fmin_fmax_functions
                                          implicit none
                                          private
                                          public fmax
                                          public fmin
                                      
                                          interface fmax
                                              module procedure fmax88
                                              module procedure fmax44
                                              module procedure fmax84
                                              module procedure fmax48
                                          end interface
                                          interface fmin
                                              module procedure fmin88
                                              module procedure fmin44
                                              module procedure fmin84
                                              module procedure fmin48
                                          end interface
                                      contains
                                          real(8) function fmax88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmax44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmax84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmax48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmin44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmin48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                          end function
                                      end module
                                      
                                      real(8) function code(a, b)
                                      use fmin_fmax_functions
                                          real(8), intent (in) :: a
                                          real(8), intent (in) :: b
                                          real(8) :: tmp
                                          if (b <= (-0.76d0)) then
                                              tmp = 1.0d0 / (1.0d0 + (1.0d0 / (1.0d0 + ((-1.0d0) * b))))
                                          else if (b <= 1.9d+154) then
                                              tmp = 1.0d0 / ((((1.0d0 + b) + a) + ((a * a) * 0.5d0)) - (-1.0d0))
                                          else
                                              tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (0.5d0 * b))))
                                          end if
                                          code = tmp
                                      end function
                                      
                                      public static double code(double a, double b) {
                                      	double tmp;
                                      	if (b <= -0.76) {
                                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                      	} else if (b <= 1.9e+154) {
                                      		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0);
                                      	} else {
                                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      def code(a, b):
                                      	tmp = 0
                                      	if b <= -0.76:
                                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))))
                                      	elif b <= 1.9e+154:
                                      		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0)
                                      	else:
                                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))))
                                      	return tmp
                                      
                                      function code(a, b)
                                      	tmp = 0.0
                                      	if (b <= -0.76)
                                      		tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / Float64(1.0 + Float64(-1.0 * b)))));
                                      	elseif (b <= 1.9e+154)
                                      		tmp = Float64(1.0 / Float64(Float64(Float64(Float64(1.0 + b) + a) + Float64(Float64(a * a) * 0.5)) - -1.0));
                                      	else
                                      		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(0.5 * b)))));
                                      	end
                                      	return tmp
                                      end
                                      
                                      function tmp_2 = code(a, b)
                                      	tmp = 0.0;
                                      	if (b <= -0.76)
                                      		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                      	elseif (b <= 1.9e+154)
                                      		tmp = 1.0 / ((((1.0 + b) + a) + ((a * a) * 0.5)) - -1.0);
                                      	else
                                      		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      code[a_, b_] := If[LessEqual[b, -3422735716801577/4503599627370496], N[(1 / N[(1 + N[(1 / N[(1 + N[(-1 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 18999999999999999064581089979963101249120767266604493066770021892695906750618596520567186646577434152905173284039181572611431631767743819258237216708624384], N[(1 / N[(N[(N[(N[(1 + b), $MachinePrecision] + a), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(1/2 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                      
                                      \begin{array}{l}
                                      \mathbf{if}\;b \leq \frac{-3422735716801577}{4503599627370496}:\\
                                      \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\
                                      
                                      \mathbf{elif}\;b \leq 18999999999999999064581089979963101249120767266604493066770021892695906750618596520567186646577434152905173284039181572611431631767743819258237216708624384:\\
                                      \;\;\;\;\frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\
                                      
                                      
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if b < -0.76000000000000001

                                        1. Initial program 99.2%

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

                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                          2. sinh-+-cosh-revN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                          3. add-flipN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                          4. cosh-neg-revN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                          5. sinh-neg-revN/A

                                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                          6. sinh---cosh-revN/A

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

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

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

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

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

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

                                          \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                        5. Step-by-step derivation
                                          1. lower-/.f64N/A

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

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

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

                                            \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                          5. lower-neg.f6481.5%

                                            \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                        6. Applied rewrites81.5%

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

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

                                            \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot \color{blue}{b}}} \]
                                          2. lower-*.f6454.5%

                                            \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot b}} \]
                                        9. Applied rewrites54.5%

                                          \[\leadsto \frac{1}{1 + \frac{1}{1 + \color{blue}{-1 \cdot b}}} \]

                                        if -0.76000000000000001 < b < 1.8999999999999999e154

                                        1. Initial program 99.2%

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

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

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

                                            \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites81.5%

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

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

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

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

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

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

                                                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                                              6. lower-*.f6489.6%

                                                \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                                            4. Applied rewrites89.6%

                                              \[\leadsto \frac{1}{\color{blue}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\right)}} \]
                                            5. Step-by-step derivation
                                              1. lift-+.f64N/A

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

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

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

                                                \[\leadsto \frac{1}{\left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot a\right)\right) - -1} \]
                                              5. lower--.f6489.6%

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

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

                                              \[\leadsto \frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1} \]
                                            8. Step-by-step derivation
                                              1. lower-+.f6449.8%

                                                \[\leadsto \frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1} \]
                                            9. Applied rewrites49.8%

                                              \[\leadsto \frac{1}{\left(\left(\left(1 + b\right) + a\right) + \left(a \cdot a\right) \cdot \frac{1}{2}\right) - -1} \]

                                            if 1.8999999999999999e154 < b

                                            1. Initial program 99.2%

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

                                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                              2. sinh-+-cosh-revN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                              3. add-flipN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                              4. cosh-neg-revN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                              5. sinh-neg-revN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                              6. sinh---cosh-revN/A

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

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

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

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

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

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

                                              \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                            5. Step-by-step derivation
                                              1. lower-/.f64N/A

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

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

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

                                                \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                              5. lower-neg.f6481.5%

                                                \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                            6. Applied rewrites81.5%

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

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

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

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

                                                \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                              4. lower-*.f6450.2%

                                                \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                            9. Applied rewrites50.2%

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

                                          Alternative 12: 77.6% accurate, 7.9× speedup?

                                          \[\begin{array}{l} \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\ \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\ \mathbf{elif}\;b \leq 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\ \end{array} \]
                                          (FPCore (a b)
                                            :precision binary64
                                            (if (<= b -4436777100798803/158456325028528675187087900672)
                                            (/ 1 (+ 1 (/ 1 (+ 1 (* -1 b)))))
                                            (if (<=
                                                 b
                                                 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784)
                                              (/ 1 (+ 2 (* a (+ 1 (* 1/2 a)))))
                                              (/ 1 (+ 2 (* b (+ 1 (* 1/2 b))))))))
                                          double code(double a, double b) {
                                          	double tmp;
                                          	if (b <= -2.8e-14) {
                                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                          	} else if (b <= 2.8e+156) {
                                          		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))));
                                          	} else {
                                          		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          module fmin_fmax_functions
                                              implicit none
                                              private
                                              public fmax
                                              public fmin
                                          
                                              interface fmax
                                                  module procedure fmax88
                                                  module procedure fmax44
                                                  module procedure fmax84
                                                  module procedure fmax48
                                              end interface
                                              interface fmin
                                                  module procedure fmin88
                                                  module procedure fmin44
                                                  module procedure fmin84
                                                  module procedure fmin48
                                              end interface
                                          contains
                                              real(8) function fmax88(x, y) result (res)
                                                  real(8), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                              end function
                                              real(4) function fmax44(x, y) result (res)
                                                  real(4), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                              end function
                                              real(8) function fmax84(x, y) result(res)
                                                  real(8), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                              end function
                                              real(8) function fmax48(x, y) result(res)
                                                  real(4), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                              end function
                                              real(8) function fmin88(x, y) result (res)
                                                  real(8), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                              end function
                                              real(4) function fmin44(x, y) result (res)
                                                  real(4), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                              end function
                                              real(8) function fmin84(x, y) result(res)
                                                  real(8), intent (in) :: x
                                                  real(4), intent (in) :: y
                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                              end function
                                              real(8) function fmin48(x, y) result(res)
                                                  real(4), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                              end function
                                          end module
                                          
                                          real(8) function code(a, b)
                                          use fmin_fmax_functions
                                              real(8), intent (in) :: a
                                              real(8), intent (in) :: b
                                              real(8) :: tmp
                                              if (b <= (-2.8d-14)) then
                                                  tmp = 1.0d0 / (1.0d0 + (1.0d0 / (1.0d0 + ((-1.0d0) * b))))
                                              else if (b <= 2.8d+156) then
                                                  tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (0.5d0 * a))))
                                              else
                                                  tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (0.5d0 * b))))
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double a, double b) {
                                          	double tmp;
                                          	if (b <= -2.8e-14) {
                                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                          	} else if (b <= 2.8e+156) {
                                          		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))));
                                          	} else {
                                          		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(a, b):
                                          	tmp = 0
                                          	if b <= -2.8e-14:
                                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))))
                                          	elif b <= 2.8e+156:
                                          		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))))
                                          	else:
                                          		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))))
                                          	return tmp
                                          
                                          function code(a, b)
                                          	tmp = 0.0
                                          	if (b <= -2.8e-14)
                                          		tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / Float64(1.0 + Float64(-1.0 * b)))));
                                          	elseif (b <= 2.8e+156)
                                          		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(0.5 * a)))));
                                          	else
                                          		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(0.5 * b)))));
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(a, b)
                                          	tmp = 0.0;
                                          	if (b <= -2.8e-14)
                                          		tmp = 1.0 / (1.0 + (1.0 / (1.0 + (-1.0 * b))));
                                          	elseif (b <= 2.8e+156)
                                          		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))));
                                          	else
                                          		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[a_, b_] := If[LessEqual[b, -4436777100798803/158456325028528675187087900672], N[(1 / N[(1 + N[(1 / N[(1 + N[(-1 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784], N[(1 / N[(2 + N[(a * N[(1 + N[(1/2 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(1/2 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                          
                                          \begin{array}{l}
                                          \mathbf{if}\;b \leq \frac{-4436777100798803}{158456325028528675187087900672}:\\
                                          \;\;\;\;\frac{1}{1 + \frac{1}{1 + -1 \cdot b}}\\
                                          
                                          \mathbf{elif}\;b \leq 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784:\\
                                          \;\;\;\;\frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\
                                          
                                          
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 3 regimes
                                          2. if b < -2.8000000000000001e-14

                                            1. Initial program 99.2%

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

                                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                              2. sinh-+-cosh-revN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                              3. add-flipN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                              4. cosh-neg-revN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                              5. sinh-neg-revN/A

                                                \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                              6. sinh---cosh-revN/A

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

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

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

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

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

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

                                              \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                            5. Step-by-step derivation
                                              1. lower-/.f64N/A

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

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

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

                                                \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                              5. lower-neg.f6481.5%

                                                \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                            6. Applied rewrites81.5%

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

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

                                                \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot \color{blue}{b}}} \]
                                              2. lower-*.f6454.5%

                                                \[\leadsto \frac{1}{1 + \frac{1}{1 + -1 \cdot b}} \]
                                            9. Applied rewrites54.5%

                                              \[\leadsto \frac{1}{1 + \frac{1}{1 + \color{blue}{-1 \cdot b}}} \]

                                            if -2.8000000000000001e-14 < b < 2.7999999999999999e156

                                            1. Initial program 99.2%

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

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

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

                                                \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites81.5%

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

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

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

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

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

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

                                                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                                                  6. lower-*.f6489.6%

                                                    \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                                                4. Applied rewrites89.6%

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

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

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

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

                                                    \[\leadsto \frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)} \]
                                                  4. lower-*.f6452.1%

                                                    \[\leadsto \frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)} \]
                                                7. Applied rewrites52.1%

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

                                                if 2.7999999999999999e156 < b

                                                1. Initial program 99.2%

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

                                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                                  2. sinh-+-cosh-revN/A

                                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                                  3. add-flipN/A

                                                    \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                                  4. cosh-neg-revN/A

                                                    \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                                  5. sinh-neg-revN/A

                                                    \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                                  6. sinh---cosh-revN/A

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

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

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

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

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

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

                                                  \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                                5. Step-by-step derivation
                                                  1. lower-/.f64N/A

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

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

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

                                                    \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                                  5. lower-neg.f6481.5%

                                                    \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                                6. Applied rewrites81.5%

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

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

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

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

                                                    \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                                  4. lower-*.f6450.2%

                                                    \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                                9. Applied rewrites50.2%

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

                                              Alternative 13: 62.8% accurate, 9.3× speedup?

                                              \[\begin{array}{l} \mathbf{if}\;b \leq 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784:\\ \;\;\;\;\frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\ \end{array} \]
                                              (FPCore (a b)
                                                :precision binary64
                                                (if (<=
                                                   b
                                                   2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784)
                                                (/ 1 (+ 2 (* a (+ 1 (* 1/2 a)))))
                                                (/ 1 (+ 2 (* b (+ 1 (* 1/2 b)))))))
                                              double code(double a, double b) {
                                              	double tmp;
                                              	if (b <= 2.8e+156) {
                                              		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))));
                                              	} else {
                                              		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              module fmin_fmax_functions
                                                  implicit none
                                                  private
                                                  public fmax
                                                  public fmin
                                              
                                                  interface fmax
                                                      module procedure fmax88
                                                      module procedure fmax44
                                                      module procedure fmax84
                                                      module procedure fmax48
                                                  end interface
                                                  interface fmin
                                                      module procedure fmin88
                                                      module procedure fmin44
                                                      module procedure fmin84
                                                      module procedure fmin48
                                                  end interface
                                              contains
                                                  real(8) function fmax88(x, y) result (res)
                                                      real(8), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                  end function
                                                  real(4) function fmax44(x, y) result (res)
                                                      real(4), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmax84(x, y) result(res)
                                                      real(8), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmax48(x, y) result(res)
                                                      real(4), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmin88(x, y) result (res)
                                                      real(8), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                  end function
                                                  real(4) function fmin44(x, y) result (res)
                                                      real(4), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmin84(x, y) result(res)
                                                      real(8), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmin48(x, y) result(res)
                                                      real(4), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                  end function
                                              end module
                                              
                                              real(8) function code(a, b)
                                              use fmin_fmax_functions
                                                  real(8), intent (in) :: a
                                                  real(8), intent (in) :: b
                                                  real(8) :: tmp
                                                  if (b <= 2.8d+156) then
                                                      tmp = 1.0d0 / (2.0d0 + (a * (1.0d0 + (0.5d0 * a))))
                                                  else
                                                      tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (0.5d0 * b))))
                                                  end if
                                                  code = tmp
                                              end function
                                              
                                              public static double code(double a, double b) {
                                              	double tmp;
                                              	if (b <= 2.8e+156) {
                                              		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))));
                                              	} else {
                                              		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              def code(a, b):
                                              	tmp = 0
                                              	if b <= 2.8e+156:
                                              		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))))
                                              	else:
                                              		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))))
                                              	return tmp
                                              
                                              function code(a, b)
                                              	tmp = 0.0
                                              	if (b <= 2.8e+156)
                                              		tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(1.0 + Float64(0.5 * a)))));
                                              	else
                                              		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(0.5 * b)))));
                                              	end
                                              	return tmp
                                              end
                                              
                                              function tmp_2 = code(a, b)
                                              	tmp = 0.0;
                                              	if (b <= 2.8e+156)
                                              		tmp = 1.0 / (2.0 + (a * (1.0 + (0.5 * a))));
                                              	else
                                              		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                              	end
                                              	tmp_2 = tmp;
                                              end
                                              
                                              code[a_, b_] := If[LessEqual[b, 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784], N[(1 / N[(2 + N[(a * N[(1 + N[(1/2 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(1/2 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                              
                                              \begin{array}{l}
                                              \mathbf{if}\;b \leq 2799999999999999877191140408237791714304266252051693240387236978082789331230448443084335838169194391935053968040682242044884434993644427170305585304288886784:\\
                                              \;\;\;\;\frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)}\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\
                                              
                                              
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if b < 2.7999999999999999e156

                                                1. Initial program 99.2%

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

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

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

                                                    \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites81.5%

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

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

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

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

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

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

                                                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot a}\right)\right)} \]
                                                      6. lower-*.f6489.6%

                                                        \[\leadsto \frac{1}{1 + \left(e^{b} + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)\right)} \]
                                                    4. Applied rewrites89.6%

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

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

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

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

                                                        \[\leadsto \frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{a}\right)} \]
                                                      4. lower-*.f6452.1%

                                                        \[\leadsto \frac{1}{2 + a \cdot \left(1 + \frac{1}{2} \cdot a\right)} \]
                                                    7. Applied rewrites52.1%

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

                                                    if 2.7999999999999999e156 < b

                                                    1. Initial program 99.2%

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

                                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                                      2. sinh-+-cosh-revN/A

                                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                                      3. add-flipN/A

                                                        \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                                      4. cosh-neg-revN/A

                                                        \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                                      5. sinh-neg-revN/A

                                                        \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                                      6. sinh---cosh-revN/A

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

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

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

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

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

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

                                                      \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                                    5. Step-by-step derivation
                                                      1. lower-/.f64N/A

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

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

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

                                                        \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                                      5. lower-neg.f6481.5%

                                                        \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                                    6. Applied rewrites81.5%

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

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

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

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

                                                        \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                                      4. lower-*.f6450.2%

                                                        \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                                    9. Applied rewrites50.2%

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

                                                  Alternative 14: 53.0% accurate, 9.3× speedup?

                                                  \[\begin{array}{l} \mathbf{if}\;b \leq \frac{5342339453620755}{242833611528216133864932738352939863330300854881517440156476551217363035650651062272}:\\ \;\;\;\;\frac{1}{2 + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\ \end{array} \]
                                                  (FPCore (a b)
                                                    :precision binary64
                                                    (if (<=
                                                       b
                                                       5342339453620755/242833611528216133864932738352939863330300854881517440156476551217363035650651062272)
                                                    (/ 1 (+ 2 a))
                                                    (/ 1 (+ 2 (* b (+ 1 (* 1/2 b)))))))
                                                  double code(double a, double b) {
                                                  	double tmp;
                                                  	if (b <= 2.2e-68) {
                                                  		tmp = 1.0 / (2.0 + a);
                                                  	} else {
                                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  module fmin_fmax_functions
                                                      implicit none
                                                      private
                                                      public fmax
                                                      public fmin
                                                  
                                                      interface fmax
                                                          module procedure fmax88
                                                          module procedure fmax44
                                                          module procedure fmax84
                                                          module procedure fmax48
                                                      end interface
                                                      interface fmin
                                                          module procedure fmin88
                                                          module procedure fmin44
                                                          module procedure fmin84
                                                          module procedure fmin48
                                                      end interface
                                                  contains
                                                      real(8) function fmax88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmax44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmin44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                      end function
                                                  end module
                                                  
                                                  real(8) function code(a, b)
                                                  use fmin_fmax_functions
                                                      real(8), intent (in) :: a
                                                      real(8), intent (in) :: b
                                                      real(8) :: tmp
                                                      if (b <= 2.2d-68) then
                                                          tmp = 1.0d0 / (2.0d0 + a)
                                                      else
                                                          tmp = 1.0d0 / (2.0d0 + (b * (1.0d0 + (0.5d0 * b))))
                                                      end if
                                                      code = tmp
                                                  end function
                                                  
                                                  public static double code(double a, double b) {
                                                  	double tmp;
                                                  	if (b <= 2.2e-68) {
                                                  		tmp = 1.0 / (2.0 + a);
                                                  	} else {
                                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  def code(a, b):
                                                  	tmp = 0
                                                  	if b <= 2.2e-68:
                                                  		tmp = 1.0 / (2.0 + a)
                                                  	else:
                                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))))
                                                  	return tmp
                                                  
                                                  function code(a, b)
                                                  	tmp = 0.0
                                                  	if (b <= 2.2e-68)
                                                  		tmp = Float64(1.0 / Float64(2.0 + a));
                                                  	else
                                                  		tmp = Float64(1.0 / Float64(2.0 + Float64(b * Float64(1.0 + Float64(0.5 * b)))));
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  function tmp_2 = code(a, b)
                                                  	tmp = 0.0;
                                                  	if (b <= 2.2e-68)
                                                  		tmp = 1.0 / (2.0 + a);
                                                  	else
                                                  		tmp = 1.0 / (2.0 + (b * (1.0 + (0.5 * b))));
                                                  	end
                                                  	tmp_2 = tmp;
                                                  end
                                                  
                                                  code[a_, b_] := If[LessEqual[b, 5342339453620755/242833611528216133864932738352939863330300854881517440156476551217363035650651062272], N[(1 / N[(2 + a), $MachinePrecision]), $MachinePrecision], N[(1 / N[(2 + N[(b * N[(1 + N[(1/2 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                  
                                                  \begin{array}{l}
                                                  \mathbf{if}\;b \leq \frac{5342339453620755}{242833611528216133864932738352939863330300854881517440156476551217363035650651062272}:\\
                                                  \;\;\;\;\frac{1}{2 + a}\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)}\\
                                                  
                                                  
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if b < 2.2e-68

                                                    1. Initial program 99.2%

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

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

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

                                                        \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites81.5%

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

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

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

                                                            \[\leadsto \frac{1}{1 + \left(a + \color{blue}{e^{b}}\right)} \]
                                                          3. lower-exp.f6481.1%

                                                            \[\leadsto \frac{1}{1 + \left(a + e^{b}\right)} \]
                                                        4. Applied rewrites81.1%

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

                                                          \[\leadsto \frac{1}{2 + \color{blue}{a}} \]
                                                        6. Step-by-step derivation
                                                          1. lower-+.f6439.7%

                                                            \[\leadsto \frac{1}{2 + a} \]
                                                        7. Applied rewrites39.7%

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

                                                        if 2.2e-68 < b

                                                        1. Initial program 99.2%

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

                                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                                          2. sinh-+-cosh-revN/A

                                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                                          3. add-flipN/A

                                                            \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                                          4. cosh-neg-revN/A

                                                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                                          5. sinh-neg-revN/A

                                                            \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                                          6. sinh---cosh-revN/A

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

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

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

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

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

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

                                                          \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                                        5. Step-by-step derivation
                                                          1. lower-/.f64N/A

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

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

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

                                                            \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                                          5. lower-neg.f6481.5%

                                                            \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                                        6. Applied rewrites81.5%

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

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

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

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

                                                            \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot \color{blue}{b}\right)} \]
                                                          4. lower-*.f6450.2%

                                                            \[\leadsto \frac{1}{2 + b \cdot \left(1 + \frac{1}{2} \cdot b\right)} \]
                                                        9. Applied rewrites50.2%

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

                                                      Alternative 15: 39.7% accurate, 21.0× speedup?

                                                      \[\frac{1}{2 + a} \]
                                                      (FPCore (a b)
                                                        :precision binary64
                                                        (/ 1 (+ 2 a)))
                                                      double code(double a, double b) {
                                                      	return 1.0 / (2.0 + a);
                                                      }
                                                      
                                                      module fmin_fmax_functions
                                                          implicit none
                                                          private
                                                          public fmax
                                                          public fmin
                                                      
                                                          interface fmax
                                                              module procedure fmax88
                                                              module procedure fmax44
                                                              module procedure fmax84
                                                              module procedure fmax48
                                                          end interface
                                                          interface fmin
                                                              module procedure fmin88
                                                              module procedure fmin44
                                                              module procedure fmin84
                                                              module procedure fmin48
                                                          end interface
                                                      contains
                                                          real(8) function fmax88(x, y) result (res)
                                                              real(8), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                          end function
                                                          real(4) function fmax44(x, y) result (res)
                                                              real(4), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmax84(x, y) result(res)
                                                              real(8), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmax48(x, y) result(res)
                                                              real(4), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmin88(x, y) result (res)
                                                              real(8), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                          end function
                                                          real(4) function fmin44(x, y) result (res)
                                                              real(4), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmin84(x, y) result(res)
                                                              real(8), intent (in) :: x
                                                              real(4), intent (in) :: y
                                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                          end function
                                                          real(8) function fmin48(x, y) result(res)
                                                              real(4), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                          end function
                                                      end module
                                                      
                                                      real(8) function code(a, b)
                                                      use fmin_fmax_functions
                                                          real(8), intent (in) :: a
                                                          real(8), intent (in) :: b
                                                          code = 1.0d0 / (2.0d0 + a)
                                                      end function
                                                      
                                                      public static double code(double a, double b) {
                                                      	return 1.0 / (2.0 + a);
                                                      }
                                                      
                                                      def code(a, b):
                                                      	return 1.0 / (2.0 + a)
                                                      
                                                      function code(a, b)
                                                      	return Float64(1.0 / Float64(2.0 + a))
                                                      end
                                                      
                                                      function tmp = code(a, b)
                                                      	tmp = 1.0 / (2.0 + a);
                                                      end
                                                      
                                                      code[a_, b_] := N[(1 / N[(2 + a), $MachinePrecision]), $MachinePrecision]
                                                      
                                                      \frac{1}{2 + a}
                                                      
                                                      Derivation
                                                      1. Initial program 99.2%

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

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

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

                                                          \[\leadsto \frac{1}{\color{blue}{1} + e^{b}} \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites81.5%

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

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

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

                                                              \[\leadsto \frac{1}{1 + \left(a + \color{blue}{e^{b}}\right)} \]
                                                            3. lower-exp.f6481.1%

                                                              \[\leadsto \frac{1}{1 + \left(a + e^{b}\right)} \]
                                                          4. Applied rewrites81.1%

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

                                                            \[\leadsto \frac{1}{2 + \color{blue}{a}} \]
                                                          6. Step-by-step derivation
                                                            1. lower-+.f6439.7%

                                                              \[\leadsto \frac{1}{2 + a} \]
                                                          7. Applied rewrites39.7%

                                                            \[\leadsto \frac{1}{2 + \color{blue}{a}} \]
                                                          8. Add Preprocessing

                                                          Alternative 16: 39.2% accurate, 315.0× speedup?

                                                          \[\frac{1}{2} \]
                                                          (FPCore (a b)
                                                            :precision binary64
                                                            1/2)
                                                          double code(double a, double b) {
                                                          	return 0.5;
                                                          }
                                                          
                                                          module fmin_fmax_functions
                                                              implicit none
                                                              private
                                                              public fmax
                                                              public fmin
                                                          
                                                              interface fmax
                                                                  module procedure fmax88
                                                                  module procedure fmax44
                                                                  module procedure fmax84
                                                                  module procedure fmax48
                                                              end interface
                                                              interface fmin
                                                                  module procedure fmin88
                                                                  module procedure fmin44
                                                                  module procedure fmin84
                                                                  module procedure fmin48
                                                              end interface
                                                          contains
                                                              real(8) function fmax88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmax44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmin44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                              end function
                                                          end module
                                                          
                                                          real(8) function code(a, b)
                                                          use fmin_fmax_functions
                                                              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_] := 1/2
                                                          
                                                          \frac{1}{2}
                                                          
                                                          Derivation
                                                          1. Initial program 99.2%

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

                                                              \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{e^{b}}} \]
                                                            2. sinh-+-cosh-revN/A

                                                              \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b + \sinh b\right)}} \]
                                                            3. add-flipN/A

                                                              \[\leadsto \frac{e^{a}}{e^{a} + \color{blue}{\left(\cosh b - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)}} \]
                                                            4. cosh-neg-revN/A

                                                              \[\leadsto \frac{e^{a}}{e^{a} + \left(\color{blue}{\cosh \left(\mathsf{neg}\left(b\right)\right)} - \left(\mathsf{neg}\left(\sinh b\right)\right)\right)} \]
                                                            5. sinh-neg-revN/A

                                                              \[\leadsto \frac{e^{a}}{e^{a} + \left(\cosh \left(\mathsf{neg}\left(b\right)\right) - \color{blue}{\sinh \left(\mathsf{neg}\left(b\right)\right)}\right)} \]
                                                            6. sinh---cosh-revN/A

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

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

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

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

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

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

                                                            \[\leadsto \color{blue}{\frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}}} \]
                                                          5. Step-by-step derivation
                                                            1. lower-/.f64N/A

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

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

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

                                                              \[\leadsto \frac{1}{1 + \frac{1}{e^{\mathsf{neg}\left(b\right)}}} \]
                                                            5. lower-neg.f6481.5%

                                                              \[\leadsto \frac{1}{1 + \frac{1}{e^{-b}}} \]
                                                          6. Applied rewrites81.5%

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

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

                                                              \[\leadsto \frac{1}{2} \]
                                                            2. Add Preprocessing

                                                            Reproduce

                                                            ?
                                                            herbie shell --seed 2025271 -o generate:evaluate
                                                            (FPCore (a b)
                                                              :name "Quotient of sum of exps"
                                                              :precision binary64
                                                              (/ (exp a) (+ (exp a) (exp b))))